sentences:
Multiplayer Replication Unreal Engine 4 I have variable=count(integer) in a Character Blueprint.
I want to increment the variable when user presses the 'R' key.
What do I so in the Blueprint that variable remains the synchronized between the server & client?
For example:
In server- 'R' key pressed 3 times so count value should be 3.
In client-'R' key pressed 4 times, so then the value should be 7.

sentences:
How to reset a gameobject to it's prefab condition? I have a GameObject with a ragdoll in it. Gameobject comes from a prefab which is pooled. So whenever the enemy is killed it's disabled then enabled when spawn.

Problem is that the ragdoll settings and it's condition cannot be reset by enabling.  i.e. enemy stays dead even though respawned.
Is there a way to easily reset a GameObject to prefab state?

Solution online is to keep all the transforms and re-apply them by code. Is this the only way?

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:
Unity - Moving RigidBody to a point in a spherical world I have a planet ( a spherical planet) that have units on the surface , that units are attracted by the planet  with this

  public void Attract(Transform body,Rigidbody rigidBody)
    {
        Vector3 gravityUp =  (body.position - transform.position).normalized;
        Vector3 bodyup = body.up;
        Quaternion targetRotation = Quaternion.FromToRotation(bodyup, gravityUp) * body.rotation;

        body.rotation = Quaternion.Slerp(body.rotation, targetRotation, 50*Time.deltaTime);
        rigidBody.AddForce(gravityUp*gravity);
    }

I want them to also move to a specific point in the planet but I can't make it work, I tryed lot of things, the most "near" to the solution was this code on the Update method, but his make unit to "bounce",

Vector3 dir = (positionToAchieve - transform.position).normalized * speed;
rigidBody.velocity = rigidBody.velocity + dir;

Any idea /suggestion will be welcome, I am new in Unity and I am learning it

sentences:
Local avoidance together with any-angle types of A* Pathfinding Recently I have been implementing the Block A* any-angle path-finding algorithm in a project I have, for which I need extremely efficient results due to the large number of NPCs. However, I still do not know exactly how to handle the problem of local avoidance between the NPCs moving at the same time in the same scene.

So, my question is this: what is the best method to implement local avoidance with any-angle path-finding? Just testing for LOS and steering to the tangent of the predicted encounter is a good enough solution or should a specific AI implementation be included within the pathfinding routine?

I would highly appreciate references (academical or not) with state-of-the-art implementations of local avoidance for me to explore the most recent developments in that field.

Many thanks.

sentences:
Sprite Sheet Texture not being rendered I'm making space invaders (in OpenGL/SDL) and I've run into a problem
when trying to draw the sprite for the spaceship from the spritesheet.
In my entity class, I have a pointer for the sprite that belongs to the current instance of the object. In main, I make an instance on the heap of the
sheetSprite, passing in the u,v,width, and height of the sprite for
the parameters and then storing this reference in the mySprite field
of the spaceship entity.

The coordinates provided by the texture atlas are:                      <SubTexture name="playerShip2_green.png" x="112" y="866" width="112" height="75"/>

To draw the spaceship, I call the draw method from its "mySprite"
attribute. For some reason, only a white square is being rendered
without the actual texture. What could be causing the problem? The relevant code is below:

class SheetSprite {
public:

    SheetSprite(unsigned int textureID, float u, float v, float width, float height, float size, ShaderProgram program)
        :textureID(textureID), u(u), v(v), width(width), height(height), size(size), program(program) {}

    void Draw() {
        //glBindTexture(GL_TEXTURE_2D, textureID);
        glUseProgram(program.programID);
        GLfloat texCoords[] = {
            u, v + height,
            u + width, v,
            u, v,
            u + width, v,
            u, v + height,
            u + width, v + height
        };
        float aspect = width / height;
        float vertices[] = {
            -0.5f * size * aspect, -0.5f * size,
            0.5f * size * aspect, 0.5f * size,
            -0.5f * size * aspect, 0.5f * size,
            0.5f * size * aspect, 0.5f * size,
            -0.5f * size * aspect, -0.5f * size ,
            0.5f * size * aspect, -0.5f * size };
        glBindTexture(GL_TEXTURE_2D, textureID);
        //float vertices2[] = { -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5 };
        glVertexAttribPointer(program.positionAttribute, 2, GL_FLOAT, false, 0, vertices);
        glEnableVertexAttribArray(program.positionAttribute);
        //float texCoords2[] = { 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 };
        glVertexAttribPointer(program.texCoordAttribute, 2, GL_FLOAT, false, 0, texCoords);
        glEnableVertexAttribArray(program.texCoordAttribute);
        glDrawArrays(GL_TRIANGLES, 0, 6);
        glDisableVertexAttribArray(program.positionAttribute);
        glDisableVertexAttribArray(program.texCoordAttribute);
    }
    float size;
    unsigned int textureID;
    float u;
    float v;
    float width;
    float height;
    ShaderProgram program;
};

class Entity {

public:
    Matrix modelMatrix, projectionMatrix, viewMatrix;
    float width, height = 1.0;
    float xDir, yDir = 0.0;
    float posX, posY = 0.0;
    float objSpeed = 0.0;
    float rotState = 0.0;
    float u, v, spr_width, spr_hght, spr_size = 0.0;
    unsigned int textureID;
    ShaderProgram program;
    //GLuint spriteSheetTexture = LoadTexture("sheet.png");
    SheetSprite* mySprite;

    Entity(float wid, float hght, float xDirect, float yDirect,
        float xPosition, float yPosition, float speed, float rState, ShaderProgram program) : width(wid), height(hght),
        xDir(xDirect), yDir(yDirect), posX(xPosition), posY(yPosition), objSpeed(speed), rotState(rState), program(program) {}

//Extra methods
};

//instantiation of sheetSprite in main

Entity spaceship(0.1f, 0.7f, 1.0f, 1.0f, -5.1f, 0.0f, 3.0f, 0.0f, program);
    spaceship.objSpeed = 10;

    GLuint spriteSheetTexture = LoadTexture("sheet.png");
    spaceship.mySprite = new SheetSprite(spriteSheetTexture, 112.0f / 1024.0f, 866.0f / 1024.0f, 112.0f / 1024.0f, 75.0f / 1024.0f, 0.7, program);

//in the game loop

spaceship.mySprite->Draw();

sentences:
Monitoring and storing chat logs in a 3D space There are a lot of 3D games on the market with text chat functionality holding literally thousands of conversations happening at the same time.

Being in a 3D space is there a defacto method of monitoring and storing these?

The difficulty I can see is that not all text is visible to all participants at all times meaning a raw chat log wouldn't make any sense, with having so many conversations occurring in real time.

sentences:
How to make a customizable 3D character with maya for a flash game i'm working in a 3d flash role-playing game with alternativa 3d engine.

My game requires the main character to be customizable, for example, the player must be able to add a mustache, a hat, a tie, change colors of sking, clothing, etc, to the character.

How am i able to do that?.

(I'm using maya for modeling.)

Thanks in advance.

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:
Game mechanics for a persistent real-time strategic/tactical game I am designing a game based around a fairly realistic simulation of 'Age of sail'-like trading and combat, and I  am currently trying to decide whether to make the game a limited on-line application, in which the game world exists only while all the players - 2 to 8 of them - are all online, or a persistent real-time mmo application, in which game events occur on a set schedule.  As a game for a small number of players, uninteresting events could be time-accelerated away.

The trouble with a real-time MMO is that the world objects would be persistent, yet the players would be transient.  Since in-game encounters and combat would take place on a schedule determined by the actions of all the players, not just those that happen to be online, players could easily miss an encounter or battle in which their vessel happened to be involved - or at least could be involved.

An idea I had for the MMO version was that otherwise idle time could be spent in training - which would be simulated, not merely administrative, and that active crew positions such as gunners, helmsmen, marines and officers could be filled by players, so one ship might have many players online in engagements, each contributing to the success - or otherwise - of the battle.  These positions would be filled by players whose vessels were all engaged in uninteresting travel or laid up for repairs, using a matchmaking system to match the players' observed skill to that of the NPC into whose shoes they would be stepping.  NPC skill progression would be based upon the actual skill improvement of the players who step into the role.

What other game mechanics could allow a game such as this to be playable as a persistent real-time mmo, especially when vessels could spend a long time in transit, doing nothing much of interest?

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:
Which is better a computer science degree or a Software engineer degree? I'm asking here so since you all have experience in or around game programming, that's what I want to do, and I’m trying to find as many options as I can before my senior year, which is next year. So do you have any opinions on the matter of which would give me a better education in programming?

Please no talking about anything other than the two degrees because I know of game programming degrees out there but I like to see which of these would provide the best alternate choice.

sentences:
In Unity, how can I modify the shape of a sprite? I am new to Unity and programming in general, however, I wanted to know how to change a sprite's shape. I want to do this while the game is running, so I was thinking about removing a set of pixels given some condition after an event has happened and then adjusting the collider around the object. However, I don't know how to do this. I have searched in YouTube and Google but so far I have not found anything that is useful to me.

My first thoughts were to make the pixels in a sprite's texture transparent given a condition, and I was able to achieve this, but when the time came to translate the texture into the shape of the sprite I failed miserably. Then I thought about using meshes, but I think that meshes might be too hard on the engine and cause some slowdown. I want to make a digging game where I can dig through many different objects and those are my ideas thus far. If you think there are better ways or know of a place where I can learn or, ideally, were willing to give me some coding techniques in C# for achieving the above, I would be very grateful.

sentences:
Technique to have screen independent grid based puzzle with sprite animation let's say I have a fixed size grid puzzle game (8 x 10). I will be using sprites animation, when the "pieces" in the puzzle is moving from one grid to another grid.

I was wondering, what is the technique to have this game being implemented as screen resolution independent. Here is what I plan to do.

1) The data structure coordinate will be represented using double, with 1.0 as max value.

// Puzzle grid of 8 x 10
Environment {
    double width = 0.8;
    double height = 1.0;
}

// Location of Sprite at coordinate (1, 1)
Sprite {
    double posX = 0.1;
    double posY = 0.1;
    double width = 0.1;
    double height = 0.1;
}

// scale = PYSICAL_SCREEN_SIZE
drawBitmap (
    sprite_image,
    sprite_image_rect,
    new Rect(sprite.posX * Scale, sprite.posY * Scale, (sprite.posX + sprite.width) * Scale, (sprite.posY + sprite.Height) * Scale),
    paint
);

2) A large size sprite image will be used (128x128). As sprite image shall look fine if we scale from large size down to small size, but not vice versa.

Besides the above mentioned technique, is there any other consideration I had missed out?

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 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:
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: Making only parts of a mesh destroy in UE4 I am making a 3d, 3rd person shooter game where I want everything to be destructible. UE4 makes this possible by making meshes destructible, but the problem is that when the mesh is damaged, it destroys completely. This is not what I want, I would like to keep the destruction limited to some volume of the mesh proportional to the bullet's size. Also, the ground must be vulnerable to explosives and must crater as a result. I was just wondering if there was a way to limit the effect of the destruction to some part of a mesh only.

sentences:
What do I need in order to receive payments from Valve? I'm developer from Russia and I recently passed Steam Greenlight.

Now I'm stuck on the Valve program enrollment phase. From what I've seen in the Valve forms, it is not necessary to create a company, such as LLC, there is 'Sole proprietor' option here. So I decided to choose this.

The questions were easy, but then I bumped into two stoppers: information about my bank account and information related to taxes.

As for taxes, I think I understand what to do. I need to apply for EIN in IRS and then fill the form W-8BEN.

But bank account is the different beast. I cannot decide, which type of bank account to use. Will it be suffice to create simple bank account, like this you use in your everyday life? In which currency this account should be? In Russian roubles or in US dollars? Roubles are preferable to me, but it's not a problem to create USD bank account. I simply cannot decide which is better.

It will be great if some non-US (and maybe US too :) ) indie dev shared some knowledge about this. Again, my most important questions:

1) Are you using the 'Sole proprietor' option without creating any form of company? Is this indeed legal and acceptable?

2) Can you use ordinary bank account for the purpose of receiving payments from Valve? If yes, in which currency is this account of yours?

Please answer only if you are absolutely sure about it, e.g. you already using this scheme and received at least one payment from Valve.

Thanks in advance!

sentences:
XNA When to call LoadContent I have an enum in my game that denotes the game state ie MainMenu, InGame, GameOver, Exit
and I was wondering if it would be advisable to add a new one in for PrepGame - in which the game creates viewports for however many players there are, creates the battlefield etc.

I feel like this is a good idea except for one thing: should I make a call back to LoadContent() in this state? I could just put a switch statement in the LoadContent for my currentGameState. If it equals PrepGame load things like the skybox, ship models, texures, HUD graphics etc. Or is it a good idea to create an Asset Manager class in the first call to LoadContent() and load everything then.

I feel like both approaches have different benefits: faster, but more load times vs slower initial load time, but then all my objects are referencing the same variables so I only have to load each on once.

Any help is greatly appreciated.

Thanks,
Peter

sentences:
How can I store tile maps as PNG images? I want to let players of my top-down game save, load and share worlds as PNG images. How do I read the colors in a PNG file or change them?

I imagine something like this:

BufferedImage mapImg = ImageLoader.loadImage(path);

// (then, later)

for(x = 0; x < mapImg.width; x++) {
    for(y = 0; y < mapImg.height; y++) {
        // Look up the color at this position
    }
}

Here is my ImageLoader class:

public class ImageLoader {

    public static BufferedImage loadImage(String path) {
            try {
                return ImageIO.read(ImageLoader.class.getResource(path));
            } catch (IOException e) {
                e.printStackTrace();
                 System.exit(1);
            }
            return null;
    }
}

sentences:
Scaling and new coordinates based off screen resolution I'm trying to deal with different resolutions on Android devices.

Say I have a sprite at X,Y and dimensions W,H.

I understand how to properly scale the width and heigh dimensions depending on the screen size, but I am not sure how to properly reposition this sprite so that it exists in the same area that it should.

If I simply resize the width and heigh and keep X,Y at the same coordinates, things don't scale well.

How do I properly reposition? Multiply the coordinates by the scale as well?

sentences:
Character keeps moving I'm trying to create a stamina script, where you can only use rb.AddForce (movement) if you have stamina, else you shouldn't be able to move.

Here is my code so far (with help from here):

using UnityEngine;
using System.Collections;

public class PhysicsBall : MonoBehaviour {

    public float speed;

    private Rigidbody rb;

    public float maxStamina; // from the editor
    public float staminaReconveryRate; // from the editor
    public float staminaDrainRate; // from the editor
    public float joystickDeadband; // from the editor
    private float currentStamina;
    public float nothing;

    void Start ()
    {
        rb = GetComponent<Rigidbody> ();
        currentStamina = maxStamina;
    }

    // Update is called once per frame
    void FixedUpdate () {
        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");

        // Make sure the player actually ask to move; this is done to avoid spending stamina when
        // not expecting it
        bool hasHorizontal = false;
        bool hasVertical = false;
        if ( moveHorizontal > joystickDeadband )
            hasHorizontal = true;
        else
            moveHorizontal = 0.0f;

        if ( moveVertical > joystickDeadband )
            hasVertical = true;
        else
            moveVertical = 0.0f;

        // player requests to move
        if ( hasHorizontal || hasVertical )
        {
            // and has stamina
            if (maxStamina > 0.0)
            {
                // lets move him and consume stamina
                Vector3 movement = new Vector3 (moveHorizontal, 0, moveVertical);

                rb.AddForce (movement * speed);

                currentStamina -= Time.deltaTime * 70;
            }
        }
        else
        {
            // the player does not request to move, so we restore the stamina.
            moveHorizontal = 0.0f;
            moveVertical = 0.0f;
        }

    }

    void Update () {
        Debug.Log (currentStamina);
    }

}

Some of the code may be irrelevant as I'm building it off another answer I got but I can't seem to fix some of the bugs:

I can see the stamina decreasing to negative figures, which is good,
but even after it becomes negative the character is still able to
move normally.
The character can only move UP and to the RIGHT, not BACK and to the LEFT??

sentences:
Android Loop : Draw Loop : How to pull off smooth FPS? I am writing 2D side scrolling bullet hell-like game.
I am at a point where I struggle to pull off smooth fps.
I have separated loop that manages drawing.

However I want update the position of sprites from game logic(for bullets).
Since there are many bullets, waiting for new set of position significantly decreases the speed in which the drawing loop executes itself.

I thought about another approach like this:

I could upload and stack positions of bullets somewhere. So my drawing method can pull off only the previously completely uploaded data, but doing so it can free itself from worrying about waiting for updating since stacked data is already in there. however <- that approach seems counter intuitive.

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: Prefab won't change to custom shader I am writing here as I have encountered a problem with Unity. I have written my own surface shader and want to use it for a prefab. However, when I drag and drop the shader to the prefab in the editor, it recognizes it but it doesn't change the prefab. The prefab is a prefab for some objects which stays pink. What's the problem? The shader works, and I know that as I have tried to drag and drop the shader directly to some of the objects. In addition to that, I have also tried to create a material an drag and drop the shader that and then drag and drop the material to the prefab. That didn't work either.

sentences:
Simple Terrain Rendering For some reason I can not find a good example of terrain rendering, as in like "bare bones". Im reading Introduction to game Programming with DX10, and i've seen some other tutorials....but they all are complicated classes with ALOT of stuff thats unnecessary, and tbh just confuses a beginner like me. Like Raserteks tutorials are awesome, but it's SOO much code and classes, it's very difficult to understand the "3d" part when you have so many other classes.

Im just looking for the most BASIC terrain rendering (using a heightmap....or what have you).

It doesn't even have to have a camera or movement control, hell it can just be of one color. Im just trying to understand everything first. Does anyone know where I could find a sample of this? or heck if anyone would be willing to provide a simple sample of their own i'd be mega appreciative.

Dont get me wrong, the Book is great.....and I understand the functions, but the way the classes are put together...it makes it confusing of "what goes where".

edit: I've seen some Direct X 9 terrain demo's/samples....but isn't DX9 like WAYYY different from DX10 (if so thats why I wouldn't want to waste time on it). I could be wrong though.

sentences:
How do I debug within an animation loop? I'm trying to see some values within an animation loop, and am naively just console.log'ing when I need to, however, this usually results in the browser crashing from all the logs.

I'm working in JavaScript, but I don't think this issue is specific to JavaScript. How do people usually debug within an animation loop to see what values are?

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: How can i add mobile camera feed to unity? I want to take my mobile camera's feed to unity , where if the target image is found , some action should happen ( may be like a cuboid appears on the target image). I thought of using ip webcam app which generates ip address , through browser i was able to see the camera feed. I want the feed from camera but the action must be in my laptop.

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:
Infinite 3D Cave in Unity A friend and I are hoping to make a game in Unity in which you fly through an infinite 3D cave that can twist and wind in any direction (though obviously not to the point that the turns are impossible to make). We were thinking about creating a number of tunnel "pieces" that each curve a certain amount, and spawning each at the end of the one that came before.

But we have no idea how to make sure that the mouth of one tunnel piece always aligns perfectly (in both position and rotation) with the end of the previous one. Can anyone offer any advice on how to accomplish this?

Are we even going about it in the right way, or is there a better way to procedurally generate the cave? Bonus points: It'd be awesome if the cave could change in diameter and/or shape as well, though that'd just be gravy.

sentences:
Binding tiles with Rect I'm having trouble binding tiles with Rect. I've successfully bound other objects (such as the player, trees, etc) in my game with rectangles but I'm unable to do the same with the tiles and I don't know where I'm going wrong. Here's my tile class:

public class Tile {
    private float x, y;
    private int type;
    private static int VelX;
    private static int tileSpeed = -200;
    private static Rect tileRect;
    public Bitmap tileImage;

    public Tile (float x, float y, int typeInt) {
        this.x = x * 50;
        this.y = y * 50;
        type = typeInt;
        tileRect = new Rect();

        if (type == 2) {
            tileImage = Assets.grass;
        } else if (type == 1) {
            tileImage = Assets.dirt;
        }
    }

    public void update(float delta) {
        x += VelX * delta;
        tileRect.set((int) x, (int) y, (int) x + 50, (int) y + 50);
    }

    public static void accel() {
        VelX = tileSpeed;
    }

    public static void stop() {
        VelX = 0;
    }

    public float getX() {
        return x;
    }

    public float getY() {
        return y;
    }

    public int getType() {
        return type;
    }

    public static Rect getTileRect() {
        return tileRect;
    }

    public Bitmap getTileImage() {
        return tileImage;
    }
}

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:
How can I implement collision for a "pseudo-3D" game? I'm looking for high level implementation details, not specifics.

I've worked with bounding boxes before in some 2D games, but I'm currently tackling a "2D + depth" (2.5D?) style game along the lines of Double Dragon, Battletoads, TMNT: The Arcade Game, etc and I'm curious what a sensible collision system would be.

I think collisions between actual game objects is, for the most part, okay. I'm basically using a bounding box test that only executes if the objects' positions are within some depth threshold of each other. My real question is about collisions between floors and walls.

I want more freedom with the floors and walls than those older games listed as examples, so I've also put "mesh objects" into the game that are essentially just planes defined as combinations of triangles (simple floors also exist). The mesh objects can be static or dynamic (ie, floating platforms), and are built out of arbitrary points (ie, they are not always flat and parallel with the floor).

I can mathematically calculate collisions between objects and meshes, but I'm not sure how to go about calculating collisions between meshes themselves.

For example, how can I calculate whether two arbitrary triangles made of three arbitrary 3D points collide on a turn given position, speed, and acceleration vectors for each?

If this system sounds clumsy, I'm open to suggestions :)

sentences:
Algorithm to make groups of units In Age of Mythology and some other strategy games, when you select multiple units and order them to move to some place, they make a "group" when they reach the desired location:

I have a Vector with several sprites, which are the selected units, the variables tarX and tarY are the target x and y. I just want an example, so you can just set the x and y position and I can adapt it to my code. Also, I would like to ask that the algorithm calls "isWalkable" for the x and y position, to determine if it's a valid position for each unit.

sentences:
UI: Main Menu options for mobile games. What options should be listed? What do users want to see? When a user arrives at your main menu on your mobile touch phone game. What do you want them to see? What do they need to see?

Start, About, Load, Leaderboards, and Settings are just a few of the options that I "could" put on the Main Menu. The question really is what "should" be there and why?

My game is about surviving waves of enemies to get to the next level, with a twist of course.

What options could/should be shown on my Main Menu and why?

EDIT UPDATE:

Easy recognizable PLAY button.
Possible buttons include, but are not limited to Options, Stats/Achievements, Leaderboards, Level Solutions, and Promote Game.
Choose appropriate options for your type of game. (ie. Level Solutions good for puzzle games but not FPS)
Less is more, don't clutter the Main Menu to prevent users from getting confused. Weigh the benefits of an additional button against the risks of confusing users.
Symbols can be used to convey the meaning of a button, be sure to reach the largest audience possible.
Have as few clicks as possible to get into the game.

sentences:
Why does this variable keep returning to its original value? In my 2D platformer game, I'm trying to create a button that, when the player or a box is on top of it, opens a door of the same color. Here is the code for the button:
extends StaticBody2D

onready var is_object_on_button = false

func _on_Green_Button_Area_body_entered(body):
    is_object_on_button = true
    print("button is down")

func _on_Green_Button_Area_body_exited(body):
    is_object_on_button = false
    print("button is up")

Code for the door:
extends StaticBody2D

onready var is_object_on_button = Green_Button.is_object_on_button
onready var door_collision = $CollisionPolygon2D

func _process(delta):
    if is_object_on_button:
        door_collision.set_disabled(true)
        print("unlocked")
    else:
        door_collision.set_disabled(false)
        print("locked")

The button prints the right things at the right time, so I assume the button is working properly, but the door constantly stays (and prints) locked. How do I fix this?
Edit: After a bit of experimentation, I think that the problem is that is_object_on_button keeps returning to whatever value its assigned at the start: If I set it to true at the onready, it stays true. I do not know how to fix this, either.

sentences:
Different Sprite sizes for animation I have a character which has a size of 32x64 when walking or standing. Using the libgdx animation class I can easily animate him with a texture atlas.
When I want to make him attack however, the Sprite appears squished because the frames for the attack animation are 64x64 to accommodate the sword.
My question is as the artist and programmer, would it make more sense to have each Sprite frame for every animation be 64x64? Or in code, resize the Sprite origin and bounds before the attack animation and set them back to 32x64 when the attack is done?

sentences: The .apk file for my built game is much larger than expected Assets of my game are 15 MB, Player Settings are default, but my .apk file is 45 MB. I tried to change Player Settings and convert PNG images to JPEG, but this didn't work.

sentences:
Effect only on one object (two cameras) I have a problem. I want a Grayscale effect to be applied ONLY to the chair on the stage. The chair has a layer CurrentItem. And I have two cameras:

Camera_All renders everything except layer CurrentItem (I set this exception in CullingMask)
Camera_CurrentItem

Finally:

I need to apply not just one effect, but a few.

sentences:
Finding the nearest object, considering obstacles For the purposes of this question, we'll assume it involves a Janitor assigned to clean up trash in a building.  Given that it is a building, it is safe to assume there are one or more rooms, walls, etceteras that act as physical obstacles.

It's time for the janitor to earn his paycheck, and he heads to the nearest piece of trash to clean up.  We can resolve this in two ways:

The cheap way.  Simply do a distance check and head to the nearest.
The expensive way, Path-find to pieces of trash and pick the one with the easiest/shortest route.

Now, (1) is cheap computationally but can give false results.  A piece of trash could be on the other side of a wall but only 3 "squares" away - it'll actually take the janitor a lot more time to get there then say, a piece of trash in the same corridor 5-squares away.

(2) would give more accurate results, but requires a metric-ton more computation.

Are there better approaches to "nearest thing", or would you just have the janitor wander around on a pre-set route that covered "as much as possible" and just have him clean up as he goes?

sentences:
Slicing irregular spritesheet (automatically?) If found a cool sprite sheet on the internet but its irregular.

Is there any way besides manually cutting sprites to extract the separate pngs?
I need to pack them then again into the Texture Atlas under proper names.

Maybe theres some smart online tool that uses deep learning or something like that?

sentences:
What are some strategies for handling a zoomed out grid of sprites? I'm writing a grid-based 2D game in Unity3D that would ideally use grid sizes of around 200x200 or so, with multiple zoom levels, including all the way out. When I tried render a 200x200 grid at the most zoomed-out level where everything is visible, Unity crapped out saying that there were too many vertices to attempt to draw. This makes sense, as it's trying to render 40,000 sprites.

I was wondering, how do games like Dwarf Fortress and OpenTTD manage so many sprites at once on the screen when the map is zoomed out all the way? Are there any general strategies for handling the rendering of a large number of sprites such as this?

sentences:
Using canvas graphics instead of traditional sprites in phaser I'm trying to learn Phaser (total beginner with mild JS experience) and I'm following tutorials and such where everything is using sprites. I'm trying to get by with basic canvas shapes instead of creating sprites, but I'm having trouble implementing them in some situations.

I have a working player shape:

var playerGraphic = this.game.add.graphics(100, 100);

// set a fill and line style
playerGraphic.beginFill(0x555555);
playerGraphic.lineStyle(2, 0xffffff, 0.5);

// draw a shape
playerGraphic.drawCircle(0, 0, 20);
playerGraphic.drawCircle(5, 5, 10);

this.player = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, null);

this.player.addChild(playerGraphic);

But I'm unsure if this is the correct way of doing it.

I'm also struggling to get a tiled background to work, as it doesn't seem to work in the same way as above:

this.game.background = this.game.add.tileSprite(0, 0, this.game.world.width, this.game.world.height, null);

this.game.background.addChild(bgGraphic);

Any advice/help?

sentences:
How can I set the radius the object will rotate around the target? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetBehaviour : MonoBehaviour
{
    // Add this script to Cube(2)
    [Header("Add your turret")]
    public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.

    [Header("The axis by which it will rotate around")]
    public Vector3 axis;//by which axis it will rotate. x,y or z.

    [Header("Angle covered per update")]
    public float angle; //or the speed of rotation.

    public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;
    private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;

    // Update is called once per frame
    void Update()
    {
        //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update
        transform.RotateAround(Turret.transform.position, axis.normalized, angle);
        time += Time.deltaTime;
        //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay
        if (time > delay)
        {
            prevHeight = height;
            height = Random.Range(lowerLimit, upperLimit);
            time = 0;
        }
        //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)
        transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);
    }
}

Now it's rotating in a constant radius.
I set the variable axis to 0,1,0

But if I want the object to rotate around the turret very close to it or very far ? I want to add a radius variable so I can change and set the radius.

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:
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:
LibGDX Images not loading Now my Image isn't loading to the screen. I tried to be decorative with the code but since it isn't working I made it just like the video I'm whatching.
I don't get any exceptions, but the image doesn't appear still.

My main desktop launcher class:

public class DesktopLauncher {
public static void main (String[] arg) {
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    config.title = " Game Tests ";
    config.width = 500;
    config.height = 400;
    config.useGL30 = true;

    new LwjglApplication(new MyGdxGame(), config);
}
}

My Game class:

public class MyGdxGame extends Game {

@SuppressWarnings("unused")
private TestScreenA GameScreen;

@Override
public void create () {
    //loads image
    AssetLoaderTest.load();
    GameScreen = new TestScreenA(this);

}

@Override
public void render () {

}
}

My Screen class:

public class TestScreenA implements Screen{

@SuppressWarnings("unused")
private MyGdxGame game;

//Camera
private OrthographicCamera camera;

//images etc.
private SpriteBatch batch;

public TestScreenA(MyGdxGame game) {
    this.game = game;

    //Camera
    camera = new OrthographicCamera();
    camera.setToOrtho(false, 1920, 1080);

    batch = new SpriteBatch();

}

public void render(float delta) {
    //clears the screen with white
    Gdx.gl.glClearColor(1F, 1F, 1F, 1F);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();

    //loads images scaled to camera
    batch.setProjectionMatrix(camera.combined);

    batch.begin();
        batch.draw(AssetLoaderTest.s, 0, 0);
    batch.end();

}

public void resize(int width, int height) {

}

public void show() {

}

public void hide() {

}

public void pause() {

}

public void resume() {

}

public void dispose() {

}

}

My AssetLoaderTest class:

public class AssetLoaderTest {

//Images etc.

public static Texture t;
public static Sprite s;

static void load() {

    t = new Texture(Gdx.files.internal("testImgs/badlogic.jpg"));
    //Automatically scales texture based off of window size
    t.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    //a sprite is pretty much the body and the texture is the texture or image of it
    s = new Sprite(t);
    s.flip(false, true);

}

}

sentences: C++ SFML Performance I have recently started a project using SFML in C++. So far I haven't done much but I noticed an issue. Inside of the while(window.is_open()) loop I made a tick counter that increments every itteration through the loop, then I displayed the value with a sf::text object. I noticed that when I was in the starting resolution (~600 x ~400), It ran about 1000 - 1500 tick per second, but whenever I maximize, or even just increase the window size at all for that matter, the tick rate drops to around 250-500 per second. Is there anything I can do to elimante this, and possible any other performance issues I may encounter?

sentences:
What makes a game a 3D game? This may sound pretty obvious to game devs here but I'm wondering if a game can be called 3D if it has 3D assets but static isometric like camera view and not rotating at all.

I tried searching the different types of video game graphics but I only find the inverse which is called 2.5D because it tries to fake 3D and that it uses 2D isometric assets.

My question is

1) What really makes a game a 3D game?

2) If a game have 3D assets with a static non rotating isometric camera view is not called a 3D game, then what?

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:
Substance Painter: Fix color addition Substance Painter appears to add colors together wrongly when selecting "Normal Blending Mode"
The right side is what photoshop does correctly, meaning R+G+B values in the border region never exceed 255. On the left side is what Substance Painter does incorrectly, the green dot appears to have a glow around it.

If there is no quick way to fix this, I will have to export Red and Green and Blue layers individually and blend them together in Photoshop.

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: Do industry professionals building games using UE4 use Blueprints at all, or do they use C++ exclusively? As a teacher on a game development module I have usually insisted that users use C++, because it is a more sought-after skill in industry, but online support and information on C++ in Unreal Engine 4 seems to be relatively weak. Are professionals now using Blueprints as well, or not?

sentences:
Timed Events in a Unity WebGL game with a PHP / MySQL Server I want to make an online WebGL game with Unity with button based interaction.

So far I have my login and registration system, with some tables in MySQL to deal with that kind of stuff.

Next I need to deal with timed events.

In the game, you will start a mission just by pressing a button then you will wait a bit, like ten minutes.

How can I implement this wait?

Should I write a waiting routine in PHP, or use MySQL scheduled events? If using events, how many scheduled events can MySQL handle? Or should I use another server-side solution for that?

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:
Armature in Unity3d distorted On the left is a base mesh with armature in Blender. I imported this model and armature into Unity3d.

The result is on the right. The arms are clearly distorted, and I can't seem to fix it by rearranging the bone assignments.. It looks fine in Blender. Why is it doing this?

sentences:
What program generates character sprite sheets like this? I see template sprites like this a lot but cant find what program creates them.

To clarify I am looking for the program or generator that is creating the characters not laying them out. I've seen the same character as fat, skinny, and short which makes me think its just being generated by a program for reference.

sentences:
Hex axial coordinates to table coordinates conversion I am developing a browser game based on a hex map. I am storing my data based on axial coordinates system.

I developed a function which shows me axial coordinates of hexes within $distance from a given hex. Now I want to show those hexes in a form in a HTML table.

The data that I have is only axial coordinates of center hex as well a list of axial coordinates of hexes within distance (not sorted in any way)

As shown in the transition scheme below, hexes may always be shown in form of a simple HTML table:

But I am struggling at how to get each of the map hexes shown in a correct table field (row/column) of the table, assuming that table numbering looks like this:

To solve this out it seems to me that in first instance I need to determine the size of the HTML table that I need. If I will be able to determine what is table coordinate of center of the HTML table then I would be able to find out localisation of each hex in reference to the center hex.

In case of $distance = 1 I need 3 columns and 3 rows:

In case of $distance = 2 I need 5 columns and 5 rows:

This leads me to the conclusion that my required HTLM table size is:

$distance *2 + 1

The center hex lies in the middle of the table, so its coordinates are:

($distance *2 + 2) /2

But what is next, how to convert axial coordinates to table coordinates?

sentences:
How to orient a surface normal to a cubic surface The immediate question is: in HLSL, how can I orient a surface normal generated in UV space so that I can apply it to a cube face?

The overall project is that I'm trying to build a procedural planet generator.  I'm using a cube projected to a sphere where each face is a quad-tree.  The intermediate project is that I want to generate a normal map for the terrain.  I think the best way for me to do this (and understand what I'm doing) is to generate the normals for the cube version first, then work out the transformations to warp those normals to the sphere.

Ideally the method would not involve branching code based on which face I'm working on (i.e., if we're on the top side of the cube, then U = X and V = Y).  In other words, what I'm hoping for is some math-magic like "Oh, just cross multiply the terrain normal by the dot product of the cube face normal and blah blah blah".

9/20/10 ETA:

I know how to calculate normals for a flat surface.  My subsequent problem is two-fold:

How do I rotate the normal map so it is oriented correctly on each of the cube faces?
how do I warp the flat normal map so that it wraps the sphere?

I've found one solution that uses a Jacobian matrix, but I can't get it to work.  Even when all of the normals are pointing straight up (i.e. a flat surface), the HLSL code involving the Jacobian totally messes up the lighting--so it makes me not trust my implementation of the solution.

sentences:
Space Shooter Unity 5 Collisions not working After upgrading the official Space Shooter Tutorial to Unity 5, collisions stop working.

Additionally, the following error is reported:
Non-convex MeshColliders with non-kinematic Rigidbodies are no longer supported in Unity 5.0.

sentences:
How do I port a game which uses print-output to pygame font rendering with the least amount of work? I've been working on a text based RPG. It's pretty simple, I'm not very experienced with Python, or any other language for that matter.

Edit: For context, I recently posted this question: Python 3: How can I make my Text-based game windowed?

Here's my game you'd like to check out the code: https://gist.github.com/NervousTumbleweed/f42f326982f2af1549b528ce0156e34a

I took a long hiatus from working on the game because I became caught up in work, and after coming back to it today I've decided that I want it to run in a window, not a console.

I want my end product to have background art and audio files. I have a pretty good idea of how to do this (I've done very simple versions of this in languages like MATLAB and Processing)

What I'm beginning to realize though, is that many of the functions that I use in my game don't just magically "transfer" over to pygame. I don't get to just create a window and poof my game is there.

For example, my print() commands all won't appear in a pygame window, correct? So I did some research and it seems like I could (maybe) create a font, and replace them with:

textsurface = myfont.render('Some Text', False, (0, 0, 0))
screen.blit(textsurface,(0,0))

But then I realized, how the hell do I get commands in there?

What about strings that are attributes of objects, will those display?

Is the way my game logic is written even compatible with this module?

So now I'm pretty bummed out and frazzled. I'm willing to restart from scratch I guess, but part of what motivated me to come back to the game was that I wanted to finish it.

Would the best move be to completely start over, or can a good amount of my code be salvaged and made compatible with displaying in a pygame window?

sentences:
What's the name of the "Candy Crush" style of game? I'm currently creating an engine trying to auto-play games with a chess board, and I'm writing a report about it now.

However, I found it hard to properly describe it -- for the games like Candy Crush, which has a game board, filled with "candies," and a few rules.. is there a formal classification for it?

Is "board-game" a proper name? What about "rectangle-tile game", or "chessboard-based game?"

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:
Why don't ShaderToy shaders work with LibGDX? Can someone tell me what is different about the shader implementation in LibGDX that makes it incompatible with the shaders from ShaderToy? It looks like you can use ShaderToy shaders directly with other frameworks so am wondering what the difference is.
People talk about converting shadertoy shaders from GLSL to HLSL for use with Unity or Monogame, but as far as I know LibGDX uses GLSL so I don't see why the code is different?

sentences:
Get a warning about extension when compile GLSL code with glslc compiler shipped with vulkan SDK Trying to compile my pixel shader,and a warning generated:

D:\CS\ComputerGraphics\vulkan\WindowsProject1>D:\ProgrammingTools\vulkan\Bin\glslc shader.frag -o frag.spv
shader.frag:3: warning: '#extension' : extension not supported: GL_KHR_vulkan_glsl
1 warning generated.

The following is my pixel shade code:
#version 460
#extension GL_ARB_separate_shader_objects : enable
#extension GL_KHR_vulkan_glsl : enable
#extension GL_EXT_debug_printf : enable
//Input
layout(location = 0) in vec3 fragColor;
layout(location = 1) in vec2 fragTexCoord;
//Output
layout(location = 0) out vec4 outColor;
//uniform
layout(set = 0,binding = 2) uniform sampler2D texSampler;
void main() {
    outColor = texture(texSampler, fragTexCoord);
}

how do I fix this?

sentences:
RagDoll in AndEngine I want to create a RagDoll body in andEngine which can run and jump over different jumpObjects. Can any one give a nice tutorial on how to create RagDoll body and how to move it, like jump and running.

Thanks in Advance.

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:
Jitters in collision reaction I'm working on a project for school and I'm having some trouble solving a bug.
When the player collides with a rectangle the sprite/hitbox keeps jittering while the player has momentum in the direction.

I'm guessing that the reaction sometimes moves it so that they are right next to each other and sometimes it makes it so that there is a 1 pixel space between. Is this because I'm using float and it sometimes rounds up? If so what is a good way to solve it?

The order it happens in gameloop is:

Update player position
Check collision (move if there is one)
draw player to window

The code I use for collision detection and reaction is:

void Collider::collisionTest(Player &player, sf::RectangleShape &rec2, float push) {
    float intersectX;
    float intersectY;
    float deltaX;
    float deltaY;

    if(AABBCollision(player.getHitbox(),rec2, intersectX, intersectY, deltaX, deltaY))
    {
        push = std::min(std::max(push,0.0f), 1.0f);

        if(intersectX > intersectY){
            if (deltaX > 0.0f){
                player.playerMoveCollision(intersectX * (1.0f - push), 0.0f);
                rec2.move(-intersectX * push, 0.0f);
            }else
            {
                player.playerMoveCollision(-intersectX * (1.0f - push), 0.0f);
                rec2.move(intersectX * push, 0.0f);
            }
        }else{
            if (deltaY > 0.0f){
                player.playerMoveCollision(0.0f,intersectY * (1.0f - push));
                rec2.move(-intersectY * push, 0.0f);
                player.setIsJumping(false);

            }else
            {
                player.playerMoveCollision(0.0f,-intersectY * (1.0f - push));
                rec2.move(0.0f, intersectY * push);

            }
        }

    };

}

bool Collider::AABBCollision(sf::RectangleShape& rec1, sf::RectangleShape& rec2, float& intersectX,float& intersectY,float& deltaX,float& deltaY) {
    sf::Vector2f rec1Position = rec1.getPosition();
    sf::Vector2f rec1HalfSize = rec1.getSize() * 0.5f;
    sf::Vector2f rec2Position = rec2.getPosition();
    sf::Vector2f rec2HalfSize = rec2.getSize() * 0.5f;

    deltaX = rec2Position.x - rec1Position.x;
    deltaY = rec2Position.y - rec1Position.y;
    intersectX = abs(deltaX) - (rec2HalfSize.x + rec1HalfSize.x);
    intersectY = abs(deltaY) - (rec2HalfSize.y + rec1HalfSize.y);

    if (intersectX < 0.0f && intersectY < 0.0f){
        return true;
    }
    return false;
}

Edit:

So i kinda solved it in whats probably a bad way.

The problem was using abs(deltaX/deltaY) as i shaved off the decimal point of the float.

What i did to solve it was:

intersectX = abs(deltaX) - (rec2HalfSize.x + rec1HalfSize.x);
intersectY = abs(deltaY) - (rec2HalfSize.y + rec1HalfSize.y);

into

if(deltaX < 0)
{
    intersectX = (deltaX * -1) - (rec2HalfSize.x + rec1HalfSize.x);
}else
{
    intersectX = deltaX - (rec2HalfSize.x + rec1HalfSize.x);
}

if(deltaY < 0)
{
    intersectY = (deltaY * -1) - (rec2HalfSize.y + rec1HalfSize.y);
}else
{
    intersectY = deltaY - (rec2HalfSize.y + rec1HalfSize.y);
}

sentences:
Can I use Paragon assets store assets in other Engines besides Unreal? Epic Games recently released a lot of assets from their game Paragon for free. I like some of them but am not particularly fond of the Unreal Engine.
Can I use those assets in another engine like Unity or something custom?

sentences:
difference between an engine and a library I'd like to know the difference between a library and an engine. I've searched some information and if I'm not wrong, an engine gives you more options and makes work easier than a library.

An engine can help you for example handling user input or handling collisions but I don't know how. I mean I've been using SFML and it has a function that detects collision between two rectangles. You can handle user input too.

How does an engine work? In what ways handling collisions for example is easier with an engine than with a library?

sentences:
Box2D platformer: Why does horizontal movement stop jumping? I'm writing my sBox2D game character's movement code, but my implementation of jumping is failing:

When I press the Jump key, the character jumps OK. However, when I press jump and another key (like the left arrow key) at the same time, it kind of blocks the jump from happening.

I'm using applyForceToCenter and setLinearVelocity to move the character.

What could the problem be?

Here's how I've bound keys trigger movement:

// press W key (aka Up key or BTNup)
if (RHInput.isDown(RHInput.BTNup)) {

    if(rhcl.isPlayerOnGround()) {
        toniBody.applyForceToCenter(0, 100, true );
        System.out.println("Toni jumps");
    }
}

// press A key (aka Left key or BTNleft)
if (RHInput.isDown(RHInput.BTNleft)) {

    if(rhcl.isPlayerOnGround()) {
        toniBody.setLinearVelocity(-5, 0);
        System.out.println("Toni walks left");
    }
    else {
        toniBody.setLinearVelocity(-1, 0);
    }
}

sentences:
How to make a countdown timer based on local time I have a problem. In my GetTime.cs script, I am getting local time from an Android/iOS device, and simply assigning it to a Text component.
private void Update()
{
    time = System.DateTime.Now.ToLocalTime().ToString("HH:mm:ss");
    timeText.text = time;
}

I am making a travel system, that takes X amount of seconds to get from point A to point B. While in travel, you cannot do any actions.
How can I make this into a countdown timer based on local time? For example, I want to do travel from point A to point B like this:

I am in point A

I choose an option to travel to point B

I wait 30 seconds

I am at point B

But it has to be based on local time, and it has to work in the background, even when the app is not running.

sentences:
Structuring a game in Java I am currently programming my first game in Java and I'm having trouble structuring it.
My biggest concern is regarding the game loop.
Currently I have implemented a class with only a main function which first initializes all of the variables and then goes into a game loop. Here is the structure of the code:
public static void main(String args[])

//Initializing all the variables

//Main game loop

while(true)
{
  if (mouse is pressed)
  {
    do something
  }

  if (mouse is released)
  {
    do something
  }
  ......
}

The problem is that the "do something" parts are quite lengthy and my code looks quite messy. I would like to turn them into methods, however I am not really sure how to do it.

sentences:
How to determine if the player between two points? I'm making a skating game and I'm having trouble figuring out how to snap the player onto grinds and rails in between multiple points. My plan was to snap the player onto a point in between the two points using lerp, check which direction the player is facing using the dot product to compare direction of the rail from its first point to second and its second point to first and move them in direction that they are closer to.

But I'm having trouble with the first step. If the rail is more than two points how do I determine which two points do I use for lerping?

sentences:
Storing rigid body collision shapes in local or world coordinates I'm writing the beginnings of a lightweight 2d rigid body engine (in javascript, as a hobby project), and i'm debating whether to store collision shapes in local or in (updated as needed) world coordinates.

Most physics engines out there (e.g. box2d, bullet, dyn4j, chipmunk, PhysicsJS) and indeed most treatments of the subject store the collision shape(s) of a rigid body in local coordinates. Since the body is rigid, these local coordinates never have to be updated.

However, when performing collision detection, the shapes have to be transformed into world coordinates (or into the local coordinates of another body) - and even if most collisions can be discarded with some kind of broadphase culling, shapes that have moved still have to be transformed when updating bounding boxes/volumes (unless one uses some orientable or rotation invariant bounding box/volume).

In the worst case, in some of the above implementations, the shapes seem to be transformed multiple times each time-step (computing AABBs + multiple collision tests).

Would there not be a possible performance benefit in storing the shapes in world coordinates (and updating them when needed) instead, and why is it that no one seems to use this approach? There is at least a benefit for static bodies.

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 does my blur shader implementation produce this strange result? I tried to implement the blur shader shown here.

Instead of having a simple 2D texture I use Unity's GrabPass function to capture what's behind the plane to have a transparent effect. Then I apply this on a 3D plane:

struct v2f {
    float4 pos : SV_POSITION;
    float4 screenPos : TEXCOORD3;
    float3 uv;
};

v2f vert(appdata_full v)
{
    v2f o;
    o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    o.screenPos = ComputeScreenPos(o.pos);
    o.uv = UNITY_PROJ_COORD(o.screenPos);
    return o;
}

// In the frag part there is the shader blur computation but based on XYZ, with Z = 0

Then I apply the blur and this leads to this when I zoom in:

Is there a way to avoid this effect?

sentences:
Unity3d physics stability with low fixed timestep I'm developing a vehicle simulator game for mobile platforms. This vehicle has some hydraulic arms. I use hinge joints and configurable joints. There can be collisions to walls etc.

When I set a low Fixed Timestep (more fixed updates, less performance) like 0.001 it runs smoothly on editor and it handles the collisions well. But on the target mobile device, the performance drops to 2-3 FPS! So 0.001 (1000 fixed updates per second) is not an option.

When I change the Fixed Timestep to its default 0.02 value or 0.01, performance becomes acceptable on mobile. But when collisions occur, the vehicle is torn apart and everything flies away at a high velocity as if there was an explosion.

How can I achieve stable physics with 0.02 Fixed Timestep?

Note: I don't set the velocity or transform position. I move the vehicle by applying torque to the wheels.

Update 1 : The problem happens when the vehicle hits an obstacle that has a collider but doesn't have a rigidbody.

sentences: Is it possible to compile an android game for pc desktop? If I have an android game based on java native libraries. Is it to possible to compile into a windows/linux executable without a 3rd party emulator?

sentences:
How can I Implement spin in billiard game? I'm not sure that you played billiard or snooker before.if you played you should know about spin.
but anyway if you don't know about it you can see it in this video

I want to Implement spin like this game

for example difference between Top spin and Back spin is:

Top spin

Back spin

Spin behaviour

if you aim behind the ball you can shoot the ball in all direction

if you aim closest to right you can just aim the right

if you aim closest to left you can just aim the left

I found a same Issue that used Torque in stackoverflow but I don't know why didn't work!

Top Spin

GetComponent<Rigidbody>().AddTorque(Vector3.back * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

Back Spin

GetComponent<Rigidbody>().AddTorque(Vector3.forward * cueStrength );
GetComponent<Rigidbody>().AddForceAtPosition(cueStick.forward * cueStrength,transform.position,ForceMode.Acceleration);

I noticed that flyordie's snooker didn't use AddTorque.so I don't need answer that Implemented with AddTorque.

Update

What I tried

I add joystick to select spin angle

then I apply spin force ( It seems my spin works but sometimes didn't work that I attached video in end of my question).

this is my code:

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

public class MainBall : MonoBehaviour {

    private Vector3 FirstPos; // store first position as reset position
    public Transform SpinRoator; // spin rotator cylinder that show spin angle
    private Rigidbody rigidbody;
    public bool SpinUsed; // spin should use once
    private float v2;

    private void Start() {
        rigidbody = GetComponent<Rigidbody>();
        FirstPos = transform.position;
    }

    //After goal reset ball position
    public void ResetPos(){
        rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
        transform.position = FirstPos;

    }

    void SpinForce(){
        SpinUsed = true;
        float F = ComebackForce(); // calculate comeback force
        StopBall(); // stop ball
        rigidbody.AddForce(SpinRoator.forward*F);// apply spin force
    }

    // calculating return force after hitting f = m.a
    float ComebackForce(){
        var m = rigidbody.mass;
    var v1 = rigidbody.velocity.magnitude;

    var a = (v1 - v2) / Time.deltaTime;
        var F = m * a;
        v2 = rigidbody.velocity.magnitude;
        return F;
    }

    //stop ball
    public void StopBall(){
      rigidbody.velocity = Vector3.zero;
        rigidbody.angularVelocity = Vector3.zero;
    }

private void OnCollisionEnter(Collision other) {
    if(other.collider.tag == "Ball" || other.collider.tag == "ColorfulBall"){
    if(!SpinUsed){
    SpinForce();
    }
    }
}
}

but What is Problem?!

It seems works correctly but My Problem is sometimes Spin don't work correctly you can see this video that demonstrate this problem.my ball goes wrong direction of spin!!!

1.Ball goes Wrong sometimes

as you can see in above gif ball goes wrong direction!!! ball should go along yellow cylinder but I don't know what is problem of my code!!!

1.Ball goes slow sometimes

another problem is comeback force is slow sometimes!!!
I calculate comeback force F = m.a but why is it slow?!

sentences: Erase save file when the game gets force closed Unity C# Im making an old school arcade for android where you have to get the highest score between levels. At each level you can save the progress. If you die and have 0 lives left your save file gets deleted. However to prevent cheating I want the game to erase the save file when the player quits the game mid level instead of going back to the last save. What is the code for checking if the player force closed the game?

sentences:
XNA - Efficient way to get pixel color from rendertarget2D I'm stuck with a framerate perf down with getData from a rendertarget, what's your idea, what are the other options I can use ?

I explain my problem :
I'm making a board game, the objects or monsters are overflow the board rooms,
I use kryton framework to manage light sources, krypton is an efficient 2D pixel shader raycasting engine, I've made Hulls (#blocking light blocks) all around the rooms of my board, but the objects and monsters Texture2D were cutted by the hull shadows of the board sides... So I can't use Krypton to light my monsters

krypton give me a rendertarget of the screen which is a screen light color map
If I pick color from center board square, It give me the perfect color to draw my monsters, but with getData it's reaaaallllyy slow.

I'm using this code :

  public Color GetLightColorOnPoint(Vector2 position)
          {
              Vector2 v = WorldToScreen(position);
              return lightManager.GetLightColorAtPoint((int)v.X, (int)v.Y);
          }

  public Color LightManagerClass.GetLightColorAtPoint(int x, int y)
          {
              Color[] lightPixel = new Color[ 1 ];
              Rectangle sourceRectangle = new Rectangle(x, y, 1, 1);
              //rendertarget2D
              this.krypton_SolShadow.mMap.GetData(0, sourceRectangle, lightPixel, 0, 1);
              return lightPixel[0];
          }

(I don't understand well pixel shaders and I don't think you can pick a board square center color and apply it to an entire monster texture2D with the correct  offset/zoom of a camera 2D of course and variable texture2D size (a giant vs a rat texture2D size))

with 40 GetData (40 monsters on screen) per draw, the FrameRate slow down to 7 FPS :(, please help

sentences:
How to spin an object on its own axis? I'm trying to spin up my own 3D vector graphics engine, so I'd like to do this without an existing library. And I don't seem to be able to find the math for the correct approach in rotating an object around its own axis.

I can definitely do x/y/z rotations around a chosen point with values pt.x pt.y and pt.z. But I am unsure of how to make them unique to the object's orientation, so they are always being expressed in relation to the monitor (not even the environment yet, just the screen).

So which mathematical concept am I supposed to be applying here?

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:
Does Unity Pro Play Nice With 'Small' Teams Does anybody know how well Unity Pro plays well with-in small teams?
Our team makeup is 2 programmers, 1 audio, and 2 graphics peps.

How easy is it for somebody to mess up a Unity project? The graphics and audio people will likely only have a simplistic knowledge of Unity, and mainly in regards to only there area.

Do the graphics/audio even need access to the Unity editor?

I've seen the Asset Server and it seems like a very bare bones versioning system.

Before people start telling me that they should just learn it (as I agree) this is a rather last minute student prototype project.

sentences:
Lag compensation with networked 2D games I want to make a 2D game that is basically a physics driven sandbox / activity game. There is something I really do not understand though. From research, it seems like updates from the server should only be about every 100ms. I can see how this works for a player since they can just concurrently simulate physics and do lag compensation through interpolation.

What I do not understand is how this works for updates from other players. If clients only get notified of player positions every 100ms, I do not see how that works because a lot can happen in 100ms. The player could have changed direction twice or so in that time. I was wondering if anyone would have some insight on this issue.

Basically how does this work for shooting and stuff like that?

Thanks

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: Android OpenGL: Use several Textures for one Animated Sprite Good evening. I'm programming an Android Game. To reduce the amount of textures that need to be loaded (OpenGL ES 2.0) I've created several spritesheets of size 1024x1024. Some frames of the same animation are on different spritesheets. Now my question is if that is bad for the performance since I have to bind (OpenGL.bind()) a different texture for each animation frame? Thank you for clarification!

sentences:
Math needed to create a very simple 2D side view car game I'm trying to create a 2D side view car game (something like Hill Climb Racing, but much more simpler), but I'm confused on the math and physics.

Most of the tutorials I found were about making a top-down view game. The rest referred to the Unity3D engine, which does all the math behind the scenes and uses complex objects, whereas I'd like to achieve my goal using simple objects, such as 2D vectors and abstract them on my own (that is, without any game engine).

The project I'm working on assumes that a car is a rectangle with 2 wheels, which are ellipses. It doesn't need to brake, turn back and speed up, it should just go straight ahead (and eventually stop in case it looses all of its velocity).

An example terrain the car would be driving on:

I can't figure out how to move the car on an irregular terrain, as well as how to rotate and move it when it falls from a hillock, etc.

Have you any idea how to move and rotate the car with respect to its current position and velocity?

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:
From simple physics with a ball, to a more complicated shape Hello fellow game devs and stack overflowers...

I recently made a transition from OpenGL ES 1.1 to 2.0 (on Android via NDK) and things are going well so far. I'm working on doing a dice rolling application (gaming dice up to 20 sided, not just regular 6 sided die) as a way to learn more about how physics is implemented in a gaming environment.

I've explored implementing existing engine options (such as Bullet) and I don't think I need to implement something quite so sophisticated. I've found several tutorials that handle a lot of the general physics involved with initial trajectory, velocity, angle of contact and reflection angle, etc. I'm confident that I'd be able to implement ball-like behavior without much trouble.

My question lies in when I attempt to make the interaction of the die shape with another surface more "realistic," for example... the die strikes the floor surface at such an angle where only one corner makes contact with the floor. In my mind, the center of gravity of the object would play a part in determining how the die bounces away, possibly even spinning it it faster, etc... but I am not sure what the actual math involved is.

Are there any recommended resources for getting into this level of detail? Initial searches haven't turned up much...

Thanks to everyone in the community,
-Jeremiah

sentences:
How can I make a computer opponent for my board game? I am trying to create a game, not exactly checkers, but the level of its interactivity is on par with checkers as opposed to something more complex (I think) like chess.

Anyway, according to my analysis, the UI, gameplay, player turns, time constraints, rewards are very easy to implement.

What I find hard is the actual CPU logic.

I'm looking at checkers as an example because I used to play checkers on my PC and Nokia long before sophisticated modern AI became a thing. Are there techniques used in old checkers games that I could use to calculate which of its moves is the most advantageous for it to win the game?

I would implement a logic on my own but I need a special algorithm to compute every possible move, and this will def take me a decade to implement.

I am sure there is a smarter and quicker way but I have no idea.

sentences:
Should texture regions sizes be power of two? Is it advisable for my individual texture regions inside this texture to be power of two, or that won't make any difference?

I've read on several places that it's recommended to use power of two sized textures (e.g. Should I use textures not sized to a power of 2?).

sentences:
d3d11 renderqueue multi pass rendering design best practice The goal: issue least calls to d3d11 ImmediateContext and render advanced effects like toon / outline / anything that requires rendering the same vertex buffers with at least two different vertex shader and pixel shader programs efficiently by sorting opaque drawcalls front to back and transparent drawcalls back to front.

What I did: Abstract calls to d3d11 immediate context by a DrawCall struct that acts as a gpu command recorder. A call to DrawCall.SetIndexBuffer will create a c# Action that will issue a call on the ImmediateContext upon invoke call. The DrawCall internal gpu command list is sorted the following way: set shaders, set constantbuffers, set blendstate, set stencilstate, set vertexbuffers.... I am using sharpdx and c#.

My problem: I use a 64bit sortkey for my gpu commands. When rendering complex effects like outline or anything that requires state changes to outputmerger the whole idea with sorting doesn't seem right... example: I render opaque objects first and then transparent objects... I want to render an object opaque with a diffuse shader and it should have a red transparent outline. For this effect I have to modify stencil and blend states in between drawindexed calls. According to my sortkey those gpu commands are on different draw loops opaque<>transparent but the stencilstate requires both drawindexed calls to be one after another.

Should I implement a chained gpu command for multipass rendering or are there better ways to handle such effects?

sentences:
Photon2 billboards take a long time to face the camera I'm using PUN2 and trying to use nametag billboards for my players, but they are not facing forward correctly and I have to wait more than 20 seconds to make the name tag of player return to facing forward.
here's my code for my BillBoard Script:
public class BillBoard : MonoBehaviour
{
    protected Transform ThisCameraPlayerBillBoard ;

    private void Start()
    {
        ThisCameraPlayerBillBoard = GameSetup.GS.ThisCameraToBillBoard.GetComponent<Camera>().transform;

    }

    private void FixedUpdate()
    {
        transform.LookAt(transform.position + ThisCameraPlayerBillBoard .rotation * Vector3.forward,
            ThisCameraPlayerBillBoard .rotation * Vector3.up);

    }
}

sentences:
Can you create input actions using more than one key in the editor with the new Input System? The new input system documentation says it's possible to add actions that require input combinations within the editor or code. I only see an option to add one binding path per action within in the Actions UI.

From the documentation:

  ... require the left trigger to be held and then the A button to be pressed and held for 0.4 seconds?

var action = new InputAction();
action.AddBinding("/<gamepad>/leftTrigger")
    .CombinedWith("/<gamepad>/buttonSouth", modifiers: "hold(duration=0.4)");

  Again, setting this up with the inspector in the editor is an alternative to dealing with the path strings directly.

sentences:
Drawing multiple Textures as tilemap I am trying to draw a 2d game map and the objects on the map in a single pass.
Here is my OpenGL initialization code

// Turn off unnecessary operations
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glDisable(GL_STENCIL_TEST);
glDisable(GL_DITHER);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);

// activate pointer to vertex & texture array
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

My drawing code is being called by a NSTimer every 1/60 s.
Here is the drawing code of my world object:

- (void) draw:(NSRect)rect withTimedDelta:(double)d {
  GLint *t;
  glActiveTexture(GL_TEXTURE0);
  glBindTexture(GL_TEXTURE_2D, [_textureManager textureByName:@"blocks"]);
  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

  for (int x=0; x<[_map getWidth] ; x++) {
    for (int y=0; y<[_map getHeight] ; y++) {
      GLint v[] = {
        16*x ,16*y,
        16*x+16,16*y,
        16*x+16,16*y+16,
        16*x ,16*y+16
      };

      t=[_textureManager getBlockWithNumber:[_map getBlockAtX:x andY:y]];

      glVertexPointer(2, GL_INT, 0, v);
      glTexCoordPointer(2, GL_INT, 0, t);
      glDrawArrays(GL_QUADS, 0, 4);

    }
  }
}

(_textureManager is a Singelton only loading a texture once!)
The object drawing codes is identical (except the nested loops) in terms of OpenGL calls:

- (void) drawWithTimedDelta:(double)d {
  GLint *t;
  GLint v[] = {
    16*xpos ,16*ypos,
    16*xpos+16,16*ypos,
    16*xpos+16,16*ypos+16,
    16*xpos ,16*ypos+16
  };
  glBindTexture(GL_TEXTURE_2D, [_textureManager textureByName:_textureName]);

  t=[_textureManager getBlockWithNumber:12];

  glVertexPointer(2, GL_INT, 0, v);
  glTexCoordPointer(2, GL_INT, 0, t);
  glDrawArrays(GL_QUADS, 0, 4);
}

As soon as my central drawing routine calls the two drawing methods the second call overlays the first one. i would expect the call to world.draw to draw the map and "stamp" the objects upon it. Debugging shows me, that the first call is performed correctly (world is being drawn), but the following call to all objects ONLY draws the objects, the rest of the scene is getting black.

I think i need to blend the drawn textures, but i cant seem to figure out how.

Any help is appreciated.
Thanks

PS: Here is the github link to the project. It may not be in sync of my post here, but for some more in-depth analysis it may help.

sentences:
Minigame inside game in Unity I am developing a 2D game, and using an option of the game, it will open a minigame. I planned to set it as a separate scene, but I don't know how could I load a Scene into another scene as a window.

To give you an example, it would be something like Mass Effect and Piracy puzzle (as you can see, the game opens another game in a separate window).

Example:

As you can see, the Minigame is in some kind of Window, and in the background is the main game.

Anybody knows how could I do that?

Thank you

sentences:
libgdx - #iterator() cannot be used nested I'm getting this error when I try to check if any of the targets overlap each other:

iterTargets = targets.iterator();
while (iterTargets.hasNext()) {
    Target target = iterTargets.next();

    for (Target otherTarget:targets) {
        if (target.rectangle.overlaps(otherTarget.rectangle)) {
            // do something
        }
    }
}

So I can't do that? How am I supposed to check each member of an array to see if it overlaps any other member?

sentences:
Reacting to rectangle on rectangle collisions I don't know how to react to collisions between two axis aligned rectangles that have x, y, width and height values (x and y are from the centre of the box) to make them simply not overlap.

I figured I'd just make them move away from each other depending on how far they intersect in the opposite direction (left, right, up or down) of where they collided. If I check for collisions only on the x axis or only on the y axis it works fine, but when checking for both collisions crazy stuff happens.

This code executes when the first box collides with the second. It's in lua but feel free to answer in anything that isn't to too counter-intuitive.

if box1.x < box2.x then
    box1.x = box2.x - (box1.width / 2) - (box2.width / 2)
end

if box1.x > box2.x then
    box1.x = box1.x - (box1.x - box2.x - (box1.width / 2) - (box2.width / 2))
end

if box1.y < box2.y then
    box1.y = box2.y - (box1.height / 2) - (box2.height / 2)
end

if box1.y > box2.y then
    box1.y = box1.y - (box1.y - box2.y - (box1.height / 2) - (box2.height / 2))
end

sentences:
How to create a 2d jelly/soft/blob body? I'm a developer looking into game development. I have an idea that requires a 'character' that needs a jelly like body. I've found this video which really demonstrates what I want.

I've looked around and there are libraries/assets that do this (like Jelly Sprites) but none state how they do it, and that's what I'm interrested in.

What I've read so far is that a way of doing it is using multiple rigid bodies joined with joints that don't collide with each other. Witht he common sidenote that it might not perform that well.

I'm hoping anyone has any pointers or tutorials that explain the concepts of jelly/soft/blob bodies. Any pointers towards achieving the effect shown in the video would be awesome.

sentences:
How do I detect if two sprites are being touched at the same time? How do I detect if two sprites are being touched at the same time?

I was able to detect one sprite, but not if another sprite is being touched by the second pointer.

if(spr.getBoundingRectangles.contain(x,y))
{
    //do this
}

Then, I created two Vector3 variables for the pointer coordinates, before iterating to each pointer.

for(int i = 0; i < Constants.MAX_POINTERS; i++)
{
    if(Gdx.input.isTouched(i))
    {
        xy.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
        xy1.set(Gdx.input.getX(i), Gdx.input.getY(i), 0);
        WorldRenderer.camera.unproject(xy);
        WorldRenderer.camera.unproject(xy1);

        if(Spr.getBoundingRectangle().contains(xy.x, xy.y) &&
            Spr1.getBoundingRectangle().contains(xy.x, xy.y))
        {
            score += 1;
        }
    }
}

What happens is that xy and xy1 are always the same, so when I touch the screen with the second pointer, they will just both switch to the new coordinates instead of xy and xy1 having different x and y values.

sentences:
A-Star Pathfinding Not Giving Shortest Path I'm attempting to implement the A* pathfinding algorithm in Java. I thought it was working well, but then I found instances where it doesn't follow the shortest path

Green = start, red = target, black = walls (unwalkable), blue = path

Red # in top left is G value, green # in top right is H value, black # in middle is F value. Black lines show parents.

I have a Node class which has the following properties:
Integers x, y == 0
Integers f, g== -1
Node parent

H is calculated using the diagonal shortcut method described here

int xDist = Math.abs(end.x - x);
int yDist = Math.abs(end.y - y);
//end == target node
if (xDist > yDist) {
    h = 14 * yDist + 10 * (xDist - yDist);
} else {
    h = 14 * xDist + 10 * (yDist - xDist);
}

G is calculated as follows:

public int getG(boolean force) { //force == true will recalculate G
    if (g == -1 || force) {
        if (equals(start) || parent == null) {
            g = 0; //If its the start, g = 0
        } else {
            g = parent.getG(force) + (parent.x != x && parent.y != y ? 14 : 10);
            //10 for orthogonal moves, 14 for diagonal
        }
    }
    return g;
}

The path is calculated using this findPath method:

public static boolean findPath(Node start, Node end) {
    if (start.block || end.block) {
        //start or target has a wall on it
        return false;
    }
    Node.start = start;
    Node.end = end;
    LinkedHashSet<Node> open = new LinkedHashSet<Node>();
    LinkedHashSet<Node> closed = new LinkedHashSet<Node>();
    //open and closed lists, respectively
    boolean found = false;
    open.add(start);
    //add the starting node to open list
    while (open.size() > 0) {
        //while there is something in open list
        int lowF = Integer.MAX_VALUE;
        int curF = 0;
        Node curN = null;
        for (Node node : open) {
            curF = node.getF();
            if (curF < lowF) {
                lowF = curF;
                curN = node;
            }
        }
        //curN == lowest F value in open list
        if (curN == end) {
            //target has been found
            found = true;
            break;
        }
        open.remove(curN);
        closed.add(curN);
        //switch the lowest F value Node to the closed list
        for (Node node : curN.getAdjacent()) {
            //iterate over non-wall adjacent nodes
            if (closed.contains(node)) {
                //already on closed list
                continue;
            }
            if (!open.contains(node) || node.getG() < curN.getG()) {
                //not on open list OR it has a lower G cost
                node.parent = curN;
                //set node's parent to the lowest F cost Node from before
                node.getF(true);
                //recalculates the F (and G) values
                open.add(node);
                //add to the open list.
                //will NOT be readded if already present
            }
        }
    }
    return found;
    //loop is over, return true
}

I lead myself to believe that the issue was in my heuristic, however I'm not sure that's the case anymore: shouldn't the shortest path still be found eventually?

The path begins by approaching the target the fastest way because of the heuristic, but then seems to "change it's mind." I've been baffled for days.

When I remove the H value (i.e. set it to 0) I get the expected result.
When I remove diagonal movement I also get the expected result.

sentences:
How to create 3D area mask? I have two cubes, one parent and one child. I want to use the parent's cube mesh as a mask for the child cube. I want to make visible only the part of the child cube that it is inside the parent cube.

I can easily achieve this effect with 2D sprites using the Sprite Mask, but I can't find a way to do it for 3D areas or 3D objects.

What I have:

What I want:

sentences:
Relative movement in Box2D (keep object from falling off planet) I'm creating a game with planets orbiting around a sun, like this:
The brown square is the earth, rotating around its center and around the sun. The yellow square is the sun, which doesn't move.
Now imagine a player standing on the planet, the planet moves at a velocity of 20 m/s. How do I prevent the player from falling off? I have to give the perception to the player that the planet isn't moving.
I got the gravity on earth working, but I don't know how I can keep the player on the planet! I have thought about two solutions until now:

Just apply the angular velocity and linear velocity of the planet on the player (if it's in a specified radius), I think this method will cause jittery movement/glitches.

Create a separate Box2D world for the planet and render this Box2D world with the rotation/translation of the planet. This method is complex though since it would add the problem of moving bodies between different worlds if the player would leave the planet. This image explains it:

I think there is another (better) way to fix this problem, but I haven't found a solution yet.

sentences:
Best Way To Make Responsive UI Buttons in Unity I've been stuck on this for quite some time. I'm trying to make a platformer game for android so I need some touch buttons. I made some buttons in Photoshop but I can't figure out how to make them move the player right. I've tried implementing the IPointerDownHandler interface but once I get the player moving I can't stop it, even if I call a function in OnPointerUp to set the players velocity to a new vector3 where all values are zero. I've also tried attaching event triggers to the  buttons I made, but it's the opposite the player only moves for one frame and then I have to press the button again. I don't want to import any assets from the asset store and I don't want to use gui system. I want to learn how to do it myself. Thanks in advance. Here is the script in which I call functions from my PlayerController.

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

public class LeftButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
    public Image leftButton;

    private PlayerController player;

    private void Start()
    {
        leftButton = GetComponent<Image> ();
        player = FindObjectOfType<PlayerController> ();
    }

    public virtual void OnPointerDown(PointerEventData ped)
    {
        Debug.Log("LeftButton Pressed!!");
        player.moveLeft (-2);
    }

    public virtual void OnPointerUp(PointerEventData ped)
    {
        player.stopMoving ();
        Debug.Log ("Button Lifted!!");
    }
}

Here is my PlayerController script.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    private Rigidbody2D myrb;

    // Use this for initialization
    void Start ()
    {
        myrb = GetComponent<Rigidbody2D> ();
    }

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

    }

    public void moveLeft(float moveSpeed)
    {
        myrb.velocity = new Vector3 (moveSpeed, myrb.velocity.y, 0f);
    }

    public void moveRight(float moveSpeed)
    {
        myrb.velocity = new Vector3 (moveSpeed, myrb.velocity.y, 0f);
    }

    public void stopMoving()
    {
        myrb.velocity = new Vector3 (0f, 0f, 0f);
    }
}

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:
Python/java framework for developing artificial intelligence for board games like Diplomacy/Risk I am trying to pick a python/java framework for developing artificial intelligence for board games like Diplomacy/Risk for research purpose. I am specifically looking for multiplayer, multiple-round games without any dominant strategies that require players to cooperate as well as non-cooperate at certain times.

The idea of the research is to not build the game itself or the AI bot, but to discover novel methods for game theory, specifically to deceive other players- bots or humans.

This research is specifically based on Deceptive Artificial Intelligence. Please share any frameworks(game code with stubs for decision making) that you may know about. It would be a lot of help for my work.

If you have any ideas about some other game that I can pick, please mention that as well.

I have tried a few frameworks but the lack of documentation is extremely annoying and I haven't been able to move forward in the process.

Thanks and Regards!

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

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

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

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:
Why am I unable to edit the Input Field object's script? When attempting to edit an Input Field object's script like so

I get the following error:

  Unable to open C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll: Check external application preferences.

Why is Unity attempting to open a *.dll, here?

sentences:
Calculate whether you can jump from one platform to another I need some kind of formula that will help me connect two platforms that are reachable to each other by jump. I am working on a pathfinding implementation for a 2D platformer and preprocessing the map has been the bane of my existence. Here are some of the physics involved in this platformer:

fallSpeed = 670 px/s (Maximum speed falling in the downwards direction)

gravityAcc = 2000 px/s^2

jumpSpeed = 555 px/s (velocity component along the y-axis)

walkSpeed = 125 px/s (Base speed of a character)

sentences:
Unity C# order of execution for multiple start functions? I have a scene in my project where a lot objects need to access different objects to share data with.

Some objects have functions that need to be executed only once during the void Start function. These call a predefined function in a different class.

So now you know a bit what is happening I am experiencing an issue. During the Start function they call a method that only works when the Start function of that class has already been progressed.

Example:
Class A has certain values to calculate and set. Once this has happened function A will work.
Class B, C and D have a function B that is called at the last line of the Start function. Function B does some magic and then calls function A from Class A. The problem here is however that the void Start from class B, C and D executes before the Start from Class A. This results in not all values being set properly. I only discovered this through debugging and tracking timings of when each function was executed.

Is it possible for Class A to make the void Start execute before the void Start from the other classes? For example is the order of execution based on alphabetical values or something awake (per class) -> start (class A) -> start (class B) -> update (per class)? So that start A would happen before start B with a simple change of class name?

If I put this code in the awake call I will have the same issues since the awake in other classes might happen before or after the current awake will be executed.

To clarify, they all happen at the same time, but line 12 gets executed before line 13. Which is fairly logical, but how do you know which Start gets executed before the other Start? Or am I simply completely wrong?

I do realize that this might be a confusing read so please don't hesitate to ask questions so that I can explain my issue better.

sentences:
Exported shapekeys to unity don't play correctly (unity 2019 + blender 2.79) Hopefully someone can shed some light on this

I select all relevant parts of the mesh and armature etc and export to FBX 7.4 for use in Unity3d The model itself displays fine and so does the armature animations but the shapekeys come out really weird.

Any ideas or do you need more info?

sentences:
FIx color banding in unity I create archviz in oculus using unity. I didn't use any texture, just simple solid white color. But inside the room there is gradient from light to dark where i can see the color banding. i'm using baked GI and a single directional light. This banding effect is visible in 3d scene window and when i run on oculus as well.
What setting do i have to modify to fix it ?

sentences:
For Blender+Unity users— Would Blender's “UV Project Modifier” work in Unity? So, say in Blender you have a Cube that you put a "UV Project Modifier" on, with an Empty (controlled by a Bone) as the Projector. In Blender when you move the Bone, the UV moves on the cube. Great!

But now let's say you wanted to bring that to Unity. Would that still actually work (being able to move the UV around with bone movement) or would it be busted?

I'm trying to test it myself and it seems a dud but I already struggle with Blender's export process so wanted to check here.

sentences:
Using behavior tree with custom pawn and movement component I am trying to have a custom APawn along with its custom UPawnMovementComponent and AIController, to move to a location using the MoveTo node of a behavior tree.

I've followed the code in the engine from the MoveTo node in the behavior tree up to the navigation classes in order to understand how this work. What I tried so far is to have my movement component inherit from UPawnMovementComponent and use it to consume the input vector from its pawn (input vector that should be updated by RequestPathMove in UPawnMovementComponent).

I must have missed something as this solution isn't working and my pawn does not move at all.
Is there anything more that I should have done? Any other solution to achieve this?

EDIT:
A few things I checked:

I have a navmesh, it displays a green area where the pawn stands
The goal position is always in range
There is no physical constraints on any of the component of the pawn

sentences:
How to rotate a rectangle body around a fixed point? How to rotate a body around a point?
The body has x, y, speed and angle. Coordinates of the body relative to its center. Additional conditions: point position and distance from body to point.

sentences:
How can I get the Launch dynamic link in Unity? I have integrated firebase dynamic link sdk in my app and it is working perfectly fine,

I can generate dynamic links, and when clicked on them if the app is not installed it redirects me to the playstore and if installed open up the link in app.

My question is how can I get that generated link when I open the app through it, I just could not able to find anything in docs

the code I am using to listen for link clicks is as follows

void Start()
{
    DynamicLinks.DynamicLinkReceived += OnDynamicLink;
}

// Display the dynamic link received by the application.
private void OnDynamicLink(object sender, EventArgs args)
{
    var dynamicLinkEventArgs = args as ReceivedDynamicLinkEventArgs;
    Debug.LogFormat("Received dynamic link {0}", dynamicLinkEventArgs.ReceivedDynamicLink.Url.OriginalString);
    // Above line gets me the original base link,
    // But I want the link which I clicked
}

sentences:
Unable to save player data in a binary file within Update() method I'm trying to save player life within a binary file in Application.persistenceDataPath. I've written a method to store the player life:

  public void SaveLife()
     {
         BinaryFormatter bf = new BinaryFormatter ();
         FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
         PlayerData data = new PlayerData ();
         data.savedLife = life;
         bf.Serialize (file, data);
         file.Close ();
     }

The problem is that when the SaveLife() is called OnApplicationQuit it works. Instead, if I call it within an Update() method of a class, it doesn't work.

The Update() method is called when a certain event is triggered:

void Update()
{
    if (life < 20)
    {
        if (//certain event is triggered)
        {
            SaveLife();
        }

        lifeTimer -= Time.deltaTime;
        if (lifeTimer <= 0)
        {
            ResetLife ();
        }
    }

}

The container class for the data is

[Serializable]
 class PlayerData
 {
     public int savedLife;
 }

What could be the problem?

sentences:
Implement Hearthstone disenchant extra cards particles How would you implement the hearthstone flying particles? like you can see here
These are not just simple particles flying from a to b... I think that they are flying in some random spline, and stretched...

Any information, even to something similar that you can point me to would help!
Thanks

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:
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:
Does using Creative Common data in a GPL game mean the code must be CC-BY-SA? Let's assume we have a game where the code is GPL-licensed, and all the resources (like music, textures, etc.) are licensed under the CC-BY-SA license.

Now, the first issue would be that the GPL is not compatible with the CC-BY-SA, but since it only applies when actually linking code, it's okay in this case. Am I right?

The real problem is that, arguably, the game is "built upon" (to use the same terms as the license) the music, textures, etc. So wouldn't the CC license require the code to be released under the CC-BY-SA as well?

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:
What should I keep in mind when developing a game to be multiplayer? I am making 2d game, and it will be a game where players can move on in a 2D world and there will be physics with projectiles and such.

So far, I don't have much, just a tile engine a few other things.

But this game is going to be fully multiplayer, and I've never made a multiplayer game before. Obviously I can't be making multiplayer as I develop the game, I kind of have to make it and then hope it works once I add multiplayer.

So my question is, is there anything I should keep in mind when developing this game to be multiplayer? I'm not asking, how to make it multiplayer, thats a whole other question. I just don't want to have to re-develope everything because I did something wrong that does not work with multiplayer?

Edit: Also, as a side question, do you have any advice on what general order to create the game, and when to add multiplayer?

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:
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:
How to handle multiple events in SDL2 and C++? I'm working on an entity component based game and I ran into this problem.
I've got a component called PlayerControlComponent:

void PlayerControlComponent::HandleInput() {
    SDL_Event event;
    while(SDL_PollEvent(&event) != 0) {
        if(event.key.keysym.sym == SDLK_RIGHT) {
            Entity->MoveRight();
        }
        else if(event.key.keysym.sym == SDLK_RIGHT) {
            Entity->MoveLeft();
        }
        else {
            Entity->Stay();
        }
    }
}

and I've got a GameManager class that handles the input for the window, like if you hit escape it will quit:

void GameManager::HandleInput() {
    SDL_Event event;
    while(SDL_PollEvent(&event) != 0) {
        switch(event.key.keysym.sym) {
        case SDL_QUIT:
        case SDLK_ESCAPE:
            Quit();
        }
    }
}

After I put everything in my main function, it looks like this:

while(GameManager::GetInstance().IsRunning()) {
        //Inputs
        GameManager::GetInstance().HandleInput();
        player->GetComponent<PlayerControlComponent>()->HandleInput();
        //Update, Draw, etc..

My problem is that wich ever I put first gets executed only. So in this example the player won't handle inputs. If change it up and put the player first like so:

while(GameManager::GetInstance().IsRunning()) {
            //Inputs
            player->GetComponent<PlayerControlComponent>()->HandleInput();
            GameManager::GetInstance().HandleInput();
            //Update, Draw, etc..

..my player will move but than the window won't quit if I hit escape. For some reason wich ever input handling function is called first, gets executed. I figured out it has something to do with SDL_PollEvent(). So I created a global SDL_Event variable and changed up the code a bit so there is only 1 SDL_PollEvent() call wich happens in main:

while(GameManager::GetInstance().IsRunning()) {
        //Inputs
        while(SDL_PollEvent(&event) != 0) {
            GameManager::GetInstance().HandleInput();
            player->GetComponent<PlayerControlComponent>()->HandleInput();
        }
        //Update, Drawing, etc..

So as I said, the event variable is now global and both GameManager and Player uses the (only) same event variable.b Now everything works fine, but is that really the only option? (If so, than I don't know why would they allow us to declare multiple SDL_Events.)
So my question is:

Is there a way around this, can I handle multiple input events?

sentences:
XNA 2D Rotated Rectangle Collision Response I am using Rotated Rectangles which collide using the Separating Axis Theorem and they work perfectly fine for collision detection using Intersects and Contains.

However, I am starting to use faster objects in my game now and there is the issue of the two object overlapping during collision due to their higher velocities. I would like to do a collision response where I find out how much they are overlapping in the X and Y and put position them outside of each other.

I would like to use something like this: http://go.colorize.net/xna/2d_collision_response_xna/index.html.

But I am having some issues trying to adapt this to handle the rotation of the bounds.

Is this possible? Are there any resources out there that I can look at?

sentences:
Problem to change window view dragging the mouse I'm having a bad time trying to change the window view by dragging the mouse. I can precisely do that with the method:

void PlayScreen::MenuView(sf::RenderWindow& window)
{
    while (sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        old_mouse_position = new_mouse_position;
        new_mouse_position = sf::Mouse::getPosition(window);

        game_view.move(new_mouse_position.x - old_mouse_position.x, new_mouse_position.y - old_mouse_position.y);
    }
}

The problem is that the view is updated, (when I release the mouse, it's drawn in the correct position) but it's not drawn as I move the mouse. My gameLoop only draw after all the updates are made, and I was trying to keep the logic that way. Everytihng works fine if I draw inside MenuView while.

my Gameloop is quite simple:

while (main_window.isOpen())
{
    while (main_window.pollEvent(event))
    {
        GameOptions(event);
        DrawGame();
    }
}

Inside the GameOptions(event) there is a:

if (event.type == sf::Event::MouseButtonPressed)
{
    new_mouse_position = sf::Mouse::getPosition(window);
    if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
    {
        MenuView(window);
    }
    break;
}

I've tried without the while inside the MenuView, but it just don't work.

sentences:
Conceptual question regarding Belief-Desire-Intent agent I've been researching the Belief-Desire-Intent model and the way they used it in the original Black and White Game(which is the same, but they also defined decision trees as opinions).

I have a question about the distinction between opinion and belief.

From what I understand, beliefs are linked lists in the form of attribute: value.

So let's say a tree would be something like:
Condition: Inanimate
Type: Plant

So let's say I try to apply the command cut on it and the npc cuts down the tree in like 2 turns, by doing 50 damage each turn. So the newly formed belief is that the hp of a that tree is more than 50.

From what I understand, that this is now a newly formed belief, so the new belief about the tree would be:
Condition: Inanimate
Health: >50
Type: Plant

What about the fact that the npc now knows it takes 2 turns to cut down the tree, is that now a newly formed belief or an opinion? If it's not, what kind of opinion could be formed out of that?

Help from anyone who's dealt with this would be appreciated as I'm finding it hard to find open source code examples of this.

sentences:
Homing Fireball - Seiken Densetsu 3 style I'd like to reproduce the fireball spell of Seiken Densetsu 3.
The Fireballs  don't follow the target directly, but encircle it more or less until they hit the target.

I have no idea how to reproduce this encircling.
I tried using the Forward Vector of my Fireball and adding it to the velocity. At the same time, the Rotation is slowly interpolated.

But no matter how I tweak the values, my fireballs mostly miss the target due to too slow rotation or the fireballs go straight to the target due to too fast rotation.

Does someone have a formula/ can point me into the right direction?
Here's a video on how the Fireballs in SD3 work:
https://youtu.be/PxtHGny88DM

Note how sometimes a fireball misses and encircles the target before it hits.

sentences:
How to Convert Sprite into Texture I Have image with a sprite and i want to change this image sprite to Texture so that I can assign it to the material And i don't want to keep multiple copies for each image as a sprite and texture.

Is there any way to change sprite to texture at run time?

sentences:
Synchronization between several glDispatchCompute with same SSBOs Let's say I have one compute shader A which writes to an SSBO, and then a second compute shader B which reads from the same SSBO.

Do I need to do anything special to ensure that A has finished executing before B starts?

sentences:
How would I implement a level for a vertical shooter game I've been working in my free time on a vertical shooter similar to Xenon 2 Megablast. It's a tribute of sorts to the game that destroyed a considerable part of my childhood.

I've got the basic stuff in place - weapons, enemies, collision detection and a scrolling background. Now, I want to design the levels.

I want to create some kind of an engine which can render a level based on some kind of (say) textual description so that I can easily create levels. Are there any articles or links to how platformer/vertical shooter levels can be stored as files and loaded by the game engine? I'm not looking for completely solutions but ideas and starting points so that I can try to do it myself.

Specifically, how would you store the level of a platformer game like Prince of Persia or a shooter like Xenon 2?

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:
Game engine with good Lua entity creation/management I'm looking for an engine that constructs it's entities using Lua or other scripting language. This is in order to find inspiration and do it in my own engine as well.

I know that CryEngine does use Lua to make their entities, but I wanted to know if there are some other alternatives that I can look up.

Thanks!

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:
How to limit steering force at low velocities Sorry if this is posted before, but I didn't find an answer for this. I've been banging my head on this for a day now and I seems to be stuck.

I've implemented (see below) the 2D steering arrival behaviour described in http://www.red3d.com/cwr/steer/ which all works fine until there is a characters which wants to turn 180°. The character simply slows down, flips 180° and starts accelerating. I tried to illustrate this in Figure 1 (a).

Figure 1 - where red is the velocity and green the desired direction

What I would ideal like is a smoother path as seen in Figure 1 (b). I was thinking of using the clipped_speed in combination with steering 'left' or 'right', however I can't seem to figure out how to do this with vectors. If anyone could point me in the right direction, that would be great.

The implementation (using libgdx)

Vector2 target_offset = target.sub(position);
float dist = target_offset.len();
float clipped_speed = Math.min(max_speed * (dist / (20 * mass)), max_speed);

desiredVelocity = target_offset.mul(clipped_speed / dist);
steeringForce = desiredVelocity.sub(this.velocity);

truncate(steeringForce, max_force);
Vector2 acceleration = steeringForce.mul(1 / mass * 60 * delta);

velocity.add(acceleration);
truncate(velocity, max_speed);

position.add(velocity.mul(60 * delta));

And the code for truncate:

public void truncate(Vector2 v, float max) {
    float i = v.len() != 0 ? max / v.len() : 0;

    if(i < 1) {
        v.mul(i);
    }
}

EDIT: Using bobobobo input I think I'm there. So for those interested:

Vector2 target_offset = target.position().sub(position);

float dist = target_offset.len();
float clipped_speed = Math.min(max_speed * (dist / break_dist * mass), max_speed);

desiredVelocity = target_offset.mul(clipped_speed / dist);
steeringForce = desiredVelocity.sub(velocity);

truncate(steeringForce, max_force);
forward = steeringForce.mul(1 / mass * 60 * delta);

float a = (float) (Math.acos(velocity.nor().dot(forward.nor())) * MathUtils.radDeg);
if(Float.isNaN(a)) a = 0;

if(a > max_rot) {
    if(velocity.nor().crs(forward.cpy().nor()) < 0) {
        forward.setAngle(velocity.angle() - max_rot);
    } else {
        forward.setAngle(velocity.angle() + max_rot);
    }
}

velocity.add(forward);
truncate(velocity, dist < break_dist * mass ? dist / (break_dist * mass) * max_speed : max_speed);

Breaking is done by just scaling the velocity linearly, which isn't really all that nice implementation wise, but it give better stopping results. So we don't overshoot.

sentences:
MonoGame rendering text with black boxes? I have a UI manager that renders a background image and some images and buttons using BlendState.AlphaBlend. This works as intended. However, when I try and draw some text on top of it with the same BlendState, each character is encased in a black box and it looks awful. I played around a bit and found that BlendState.Additive was the only one that didn't render the black boxes. However, the text is now slightly transparent, which looks weird. I then decided to mess around with custom BlendStates, but after around 10 minutes I found that there could be over 67 million different BlendStates. Hmm. My last thought is that it could be the font that is breaking it, because I tried rendering with the Arial font and AlphaBlend worked fine. Is there a way round this using BlendStates without finding a new font?

tl;dr I can only render text either with black boxes or half transparent.

Text rendering code:

sb.Begin(samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend, transformMatrix: Game.Camera.GetViewMatrix());

sb.DrawString(Game.Font, text, position, color);

sb.End();

SpriteFont File (using the free Minecraftia font):

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
  <Asset Type="Graphics:FontDescription">
    <FontName>Minecraftia</FontName>
    <Size>6</Size>
    <Spacing>0</Spacing>
    <UseKerning>true</UseKerning>
    <Style>Regular</Style>
    <DefaultCharacter>?</DefaultCharacter>
    <CharacterRegions>
      <CharacterRegion>
        <Start>&#32;</Start>
        <End>&#126;</End>
      </CharacterRegion>
    </CharacterRegions>
  </Asset>
</XnaContent>

It's a pixelly game (so I need a blocky font to avoid weird antialiasing) and I think the font is a bitmap font. Just in case that makes a difference.

Edit: I found that setting the text size (in the SpriteFont file) to anything other than it's native size fixes the problem (but also renders with antialiasing, which I don't want). Also, this problem seems to happen with other bitmap fonts (tested 'Minecraftia' and '04b03').

sentences:
Draw a rotated rectfill in Allegro 4.2? I'd like to use Matricies to transform primitive geometric shapes and draw them using the Allegro library using version 4.2 (I can not switch to 5.x just yet). This works fine for non-filled objects that are just a series of lines and any filled object that require explicitly telling allegro each point in the shape (triangles and polygons).

However, I want to be able to draw a filled rectangle that is not axis-aligned.

Is there an algorithm that given the pixel locations of the four corners of a rectangle, allow drawing individual lines to fill it? That would solve the problem for the time being.

sentences:
How to make a model parts glow one after the another I have a brain model. I want to glow the parts of the brain model one after the another after a period of time. I have done to glow the parts, but when the second part glows, the color of the first part still remains.

public GameObject pons;
public GameObject frontallobe1;

void Update () {
    Invoke("PonsGlow",2);
    Invoke("frontalLobe1Glow",4);
}
void PonsGlow()
{
    pons.renderer.material.color=Color.red;
}
void frontalLobe1Glow()
{
    frontallobe1.renderer.material.color=Color.red;
}

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:
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:
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:
Strange GLSL performance problems I'm having weird performance problems with a GLSL shader I'm working on. This small example fragment shader:

#version 450
out vec4 fragColor;

struct ST { float a; float b; float c; float d; float e; };

void main() {
    ST s = ST (0.0,0.0,0.0,0.0,0.0);
    ST[1] stack;
    int ptr = 0;
    for (int i = 0; i < 32; i++) {
        if (i > -1) // Always true
            stack[ptr++] = s;
        s = stack[--ptr];
    }

    fragColor = vec4(1.0);
}

has horrible performance, but the same shader with almost anything taken out, for example, removing e from the struct, performs fine. I'm just using these on a fullscreen triangle.

I can't figure out what's going on, and how I could fix this problem in my actual shader. Any ideas?

sentences:
Deserialize inherited classes into the same list in XNA I am writing a Gui for a game (for what else ...).
Therefor I wrote a class GuiElement which has some serializeable fields. From this class I deflect a Class "Button" which has one serializeable field more.
Furthermore, I have a Class GuiWindow, which is as well deflected from "GuiElement".
An Object of this Class has a Field "HandledElements" of the type "List". To know the layout of the Menues, I use XML-Files, which look like that (for example):

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent xmlns:Generic="System.Collections.Generic">
 <Asset Type="System.Collections.Generic.List[GUI.GuiWindow]">
  <Item>
   <Position>0 0</Position>
   <AlternativeImagePath></AlternativeImagePath>
   <IsActive>true</IsActive>
   <Name>MainMenu</Name>
   <HandledElements>
    <Item>
      <Position>100 100</Position>
      <AlternativeImagePath></AlternativeImagePath>
      <IsActive>true</IsActive>
      <Name>Optionen</Name>
      <Caption>Optionen</Caption>
    </Item>
   </HandledElements>
 </Item>

  <Item>
   <Position>0 0</Position>
   <AlternativeImagePath></AlternativeImagePath>
   <IsActive>false</IsActive>
   <Name>Options</Name>
   <HandledElements>
   </HandledElements>
  </Item>
 </Asset>
</XnaContent>

As you can see, the first window has in its "HandledElements" List an Item with the Field . This is a field which only a Button has. The Problem is now: I can't deserialize this XML file, because GuiElement does not have this Field, it only has the few fields above.
I thought it would know automatically which Class to use,but it doesn't.
Do I really have to give my windows a list for each child class of GuiElement?
Or can I do another workaround?

sentences:
Remove nested if statements I have been learning a new method of programming. I have been programming many years and am recently finding out there is a better method in general via abstract classes.

My question is how to convert a small section of my code so i can understand how this works entirely. So far i could only figure out how to do 1 part:

public abstract class Water
{
    public abstract string GetString(double AmountToAdd);
}

public class AddTotalWater : Water
{
    public double TotalWater;

    public override string GetString(double AmountToAdd)
    {
        TotalWater += AmountToAdd;
        if (TotalWater > 999999)
            return TotalWater.ToString(Globals.ScientificNotationFormatter);
        else
            return TotalWater.ToString();
    }
}

and use it with:

TotalWater.text = AddTotalWater.GetString(amountToAdd);

I would just like some guidance to learn how to do this fully.
Is this the proper way to do this to begin with?

This is the nested nightmare I have currently that i want to convert:

public void DetermineWaterValues()
    {
        if (Time.deltaTime < TotalWaterProductionTime)
        {
            double tempWaterTime = waterCounter += Time.deltaTime;
            if (tempWaterTime > TotalWaterProductionTime)
            {
                tempWaterTime = TotalWaterProductionTime;
                waterCounter = 0;
                WaterProgressBar.fillAmount = 0;
                TotalWater.text = AddTotalWater.GetString(amountToAdd);
            }
            else
            {
                if (TotalWaterProductionTime >= 0.1)
                    WaterProgressBar.fillAmount = (float)(tempWaterTime / TotalWaterProductionTime);
                else
                    WaterProgressBar.fillAmount = 1;
            }
        }
        else
        {
            WaterProgressBar.fillAmount = 1;
            TotalWater.text = AddTotalWater.GetString(amountToAdd);
        }
    }

It's quite complicated to figure out how to do this properly.
This is the way i did it for over 10 years heh...

sentences:
Help with understanding "transform.root.GetComponent" in Unity I'm reading through a tutorial for making an RTS in Unity, and in certain scripts it wants you to make a Player field and then OnStart(){ transform.root.GetComponent}. I am not quite getting what that does or what purpose it serves.

Player.cs is added as a component to the game object "Player". Player.cs is the following:

public class Player : MonoBehaviour {

public string username { get; set; }
public bool human { get; set; }
}

Then on another script which is also attached to the Player (gameobject) as a component:

protected Player player;

protected void Start ()
{
    player = transform.root.GetComponent<Player>();
}

This is instructed: http://stormtek.geek.nz/rts_tutorial/part2.php right under "Camera Input". There is a description there, but I am confused by it since it does not allow you to actually interact with the game object Player, but the instance of the Player script.

I'm sorry if this was poorly worded, I can't think of a better way to ask this question. I am completely confused as to why it asks you to do this and what it actually does. I'm also very confused about how to reference instances of a class that are attached to a game object, and if the snippet in question assists with that (I can remove the snippet and things seem to work fine).

Edit: I have looked at the unity documentation on game objects, transform, root, getcomponents and other related methods.

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 can I create or extrude a mesh along a spline? Let's say, for example, that I have a working spline. I want to use this spline to create a mesh, but I'm not quite sure how to go about it. For example, I want to create a road along this spline. I can interpolate through the curve and generate my segments and use that. If I were just making a single straight line I could take the normal of that vector and extrude the endpoints to get the vertices for a quad and do it that way, but how should I handle the curve part? I can't just use the endpoints of one quad as the start of another because they won't line up at different angles.

What would be the proper way to extrude a spline into a mesh? I'm tagging this as Unity since that's what I'm using, though the answer I assume will be engine-agnostic.

sentences: Is it reasonable to write a game engine in C? Even though C++ appears to be king, from what I've been told C is still widely used in games, especially on the consoles. However, would writing an entire game engine in C be unreasonable today? What are, if any, some advantages that C has over C++? Why would someone possibly want to use C over C++?

sentences:
XNA draw 3d graphics in 2d game I am programming a simple pool game in XNA. I am using Farseer for simple 2d physics but I want to use 3d graphics. My problem is I can't get the rendering to work.

I have one model for the ball and one for the table, both exported from Cinema 4D into .fbx. I am able to load them and even display them, but not on the correct position. Farseer is using standart coordinate system (X+ to the right, Y+ down) and I need to somehow convert the position from farseer and display the models on the right place on the screen and with the correct size (this should be easy to achieve using scale matrix).

I need help finding what my projection, view, and world matrices I should use?

sentences:
2D Level design/editing/saving questions I thought about making a simple 2D Sidescroller game like SuperMario.
Then i wondered about how to save, load or create the levels for the game. The first thing i thought of was drawing a simple blocky png which represents the level, an making all the parts where the player can walk a special color (maybe lilac). I would import the level in blocks or tiles so i could check for collision.

so my questions are:
are there better methods for this?
what are the professional methods for this?
should i do this with Tiles and a Map editor based on tiles? (for some reason i dont like this, but i guess if its the best method i would use it)
with a tile based level, how would you realize slopes, and how would you check them for collisions?

sentences:
ListBox in Unity: how to do ? I'm come from WinForm/.NET development, where there is a lot of 'cool' ready made widget like: combo box, list view with scrolling system included.

Now I'm using Unity and I'm trying to implement user GUI, but i'm facing some trouble because as i can see there aren't much ready made widget.

Specifically, I'm trying to implement a saving/loading system and i'm trying to add a window with a list box containing list of saving file.

What's the best widget / approach to do this ?

Thanks

sentences:
Make UnityEvent wait for completion of method calls on listeners? I am using the UnityEvent EventManager script from this post in one of my games.

I want to know how I can make Unity wait for all the calls to methods on the listeners to finish before moving on to calling the next event?

For example,

If I have a method somewhere in my code that contains:

 EventManager.Invoke("MyFirstEvent");
 EventManager.Invoke("MySecondEvent");

How can MySecondEvent be invoked only after all the listeners of MyFirstEvent have finished ?

The reason being that I perform an operation in one of the listeners of MyFirstEvent which is needed for an operation performed in MySecondEvent.

Alternatively am I best to use a coroutine and call the MyFirstEvent on the first frame and MySecondEvent on the following one just to be sure. I read that spawning costly actions over a few frames can reduce spikes in CPU usage. However is it best practice to do so, or is it likely to cause problems down the line ?

Thanks

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:
How can I make grid tiles/plane transparent I have made a grid using multiple planes. Now I want to place a image on this grid so that user cant see the grid I have made and I ll have access of all points of the image using grid.

The problem is I am unable to place image on it, it shows me grid that I made before. I have tried Materials/Shader -> Transparent/Diffuse, but some blocks are still visible. How can I make grid tiles transparent ?

sentences:
OpenGL textureGather and DirectX gather These functions sample multiple RGBA pixels but return only a single component.
OpenGL: https://www.opengl.org/sdk/docs/man/html/textureGather.xhtml
DirectX: https://msdn.microsoft.com/en-us/library/windows/desktop/ff471525(v=vs.85).aspx

If you were to use this on an RGBA texture, and only gathering the red component, would the texture cache get loaded with the RGBA values, or would it only load the R values?

I'm curious because not all cards in use today support A8 textures (or other single channel 8 bit textures), and a workaround would be to store the data in 1/4 as many pixels by using RGBA and only grabbing the channel needed.

If this sounds obscure, a down to earth practical usage case is distance field textures.

Trying to see if using these functions would be a good alternative to cards that don't support A8.

Thanks!

sentences:
How can I add word wrap to EditorGUILayout.TextArea? How can I add word wrap to the editor textarea? I'm trying to mimic the [TextArea] attribute (word wrap, automatically increase height when needed)
For some reason GUILayout.TextArea() works fine, but EditorGUILayout.TextArea() doesn't have any word wrap. Here's my code:
obj.edibleFlavorText = EditorGUILayout.TextArea(obj.edibleFlavorText, GUILayout.MinHeight(textAreaHeight));

I've tried:

Adding GUILayout.ExpandHeight(true) to its options

Adding GUI.skin.textArea.wordWrap = true to the start of my editor script

sentences:
How do I go about making a text box that allows for highlight-able and copyable text in the new UI? I'm trying to make a simple chat system for our games lobby, however I am having issues making a text box that allows for text-highlighting. The Text component does not have interactible text, and the Inputfield allows for interaction, but I don't want the text to be editable in any way.

How would I go about doing this?

sentences:
Pathfinding with 2D, non-grid based movement over uniform terrain I'm looking for the best solution to pathfinding in my game. The map is ultimately grid-based, but entities are positioned using floats, and can move in any direction to any point on the map. The 'ground' in my game has a uniform movement cost, but of course there can be obstacles that block the way. The majority of obstacles will be static, and although there will be other animate entities in the game, I may get away with not considering them - it's an isometric Theme Hospital style strategy game, so no fighting.

Most of the path-finding articles I've seen cover 3D or grid-based 2D movement. Any suggestions for something that might cover my use-case? Many thanks.

sentences:
Programatically loading fonts, textures, and media in XNA So far, in my rhythm game, I've been using XNA's Content Pipeline for loading static resources in my app (videos, sound effects, etc). However, down the road I'd want to allow users to create their own themes, as well as making custom notecharts for whatever songs they'd like to play. Is there any way to load say, a Texture2D or Video object, from disk without using the Content Pipeline, given a file path to the resource?

EDIT: Even thought this is XNA, I'm targeting Windows only (no Zune, WP7, or Xbox 360).

sentences:
How can I use Drag handlers (IBeginDragHandler, IEndDragHandler, IDragHandler) with a 2D sprite renderer instead of a UI Image? In my game, I assigned all of the blocks to be 2D sprites so that they could be easily converted into prefabs:

However, when designing the drag and drop scripts, I noticed that all of the drag and drop handlers such as IBeginDragHandler, IEndDragHandler, IDragHandler, etc. weren't working at all. I later noticed that these were intended to be used by UI Images.
Now I am left wondering what I can do to make these 2D Sprites be usable by these functions for UI Images. Do I have any other options other than to start from scratch by making new UI Images?
Here's the small amount of code needed to create a reproducible example:
Public class DragDrop : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
{
    [SerializeField]
    private Canvas canvas;
    private CanvasGroup canvasGroup;

    private RectTransform rectTransform;

    private void Awake()
    {
        rectTransform = GetComponent<RectTransform>();
        canvasGroup = GetComponent<CanvasGroup>();
    }

    public void OnBeginDrag(PointerEventData eventData)
    {
        canvasGroup.alpha = 0.6f;
        canvasGroup.blocksRaycasts = false;
    }

    public void OnDrag(PointerEventData eventData)
    {
        rectTransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        canvasGroup.alpha = 1f;
        canvasGroup.blocksRaycasts = true;
    }
}

sentences:
Animation position leftover I am fairly new to unity and I have encountered this same problem previously.

I have a gun with hands and I created an animation that simulates shot movements with properties transform.position and transform.rotation. Root motion is applied and motion curves are generated for the animation.The default state animation for that object has no properties assigned to it and as much as I understand from the animation controller window, the shot animation is completed before the transition to the default state is made.

The problem is that on every 3 shots 0.001 is added to the X rotation; Y and Z positions are losing some small values.

I tried to prolong the animations exit time but the result is the same. I checked the key values and the motion curves, the first and last ones are the same. Why is this happening and how can I fix it ?

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:
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:
How do I get a Light's Range value in Shader? I'm trying to write a simple frag/vert shader that, depending on whether it is in the range of a light, will paint the appropriate colour from either the 'lit' texture or from the 'unlit' texture.

Therefore, I need to compare the distance between the light to the range of the light.
I've been googling all kinds of things, but I can't seem to find a way of accessing the range value of the light. Is there a way to do so? If not, is there some kind of derived data I could use as an alternative?

I was able to find this method here, which seems to be the most promising so far, however after playing around for a bit, I still can't seem to get what I need. There's some talk about _LightMatrix0 not being populated. Can anyone confirm?

I've also had it suggested to use SetFloat() and pass in the range like that...however, that provides no easy way of telling one light apart from another short of using the light's position as a key. As several key lights in the game will be moving this is just ugly and inefficient.

Update

I found the variable unity_LightAtten in the Unity Shader Variables documentation. However, this is only used for Vertex Lit shading, which isn't exactly ideal, especially considering the lack of console support.
Could there be a way to pipe this variable to Forward Rendering?

Update 2
For clarification, shading should otherwise be 'flat' (ie no need for diffuse etc):

Also, what I've currently got (albeit, not currently working as desired and currently using a workaround):

Shader "Lantern/Flat Pullup" {
Properties {
    _LitTex ("Lit (RGB)", 2D) = "white" {}
    _UnlitTex ("Unlit (RGB)", 2D) = "white" {}
    //_Falloff ("Falloff", 2D) = "white" {}
    _Pullup ("Pull up Point", Range(0,1)) = 0.7
}
SubShader {
    Pass{
        Tags { "LightMode"="ForwardBase" }
        LOD 200

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

        uniform sampler2D _UnlitTex;
        uniform float4 _UnlitTex_ST;
        uniform sampler2D _LitTex;
        uniform float4 _LitTex_ST;
        uniform float _Pullup;

        uniform float4 _LightColor0;

        struct VI {
            float4 vertex : POSITION;
            float4 tex : TEXCOORD0;
        };

        struct V2F {
            float4 pos : SV_POSITION;
            float4 tex : TEXCOORD0;
            float4 posWorld : TEXCOORD1;
        };

        V2F vert(VI v){
            V2F o;
            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
            o.tex = v.tex;
            o.posWorld = mul(_Object2World, v.vertex);
            return o;
        }

        float4 frag(V2F i) : COLOR {
            float3 flatReflection = _LightColor0.xyz *
                (1 / length(_WorldSpaceLightPos0.xyz - i.posWorld.xyz));
            float4 color;
            //Improve for light color etc
            if(length(flatReflection) > _Pullup){
                color = tex2D(_LitTex, i.tex.xy * _LitTex_ST.xy + _LitTex_ST.zw);
            }else{
                color = tex2D(_UnlitTex, i.tex.xy * _UnlitTex_ST.xy + _UnlitTex_ST.zw);
            }
            return color;
        }

        ENDCG
    }
}
FallBack "Diffuse"
}

sentences:
How to control JavaFX's animations execution order when animations "queue" is being altered in run-time? What is the proper way of handling synchronization between GUI animations' execution order and the user's dynamic input?

More specifically, I would like to know how to enforce some logical conditioning on the execution's order, while remembering, that the user's input cannot be foreseen.

For instance, a greatly simplified example:

9 rectangles are shown on a screen.
A click on a rectangle fades it out.
The user clicks whichever rectangle he wants in whatever order he likes and as fast as he feels is right.
The condition here breaks into two simple ones:

The rectangles must not fade out simultaneously.
The rectangles' fade out effect occurs in the same order as their clicks.

I would assume a simple FIFO methodology here where threads would register themselves in some ordered queue and be allowed to enter the critical code only on their turn would be sufficient.

A slightly more complicated scenario:

8 rectangles are shown on a screen - the 9th is an invisible rectangle.
A click on a rectangle that is a neighbor of the invisible one, activates a translate animation that swipes between the two.
The user clicks whichever rectangle he wants in whatever order he likes and as fast as he feels is right.
A "shuffle" button is shown on the screen - shuffles the rectangles in a legal manner, i.e., by randomly moving the rectangles many times.
The conditions:

The rectangles must not get swiped simultaneously when clicked directly, their animations must be played in the order they were clicked.
The rectangles must get swiped simultaneously when the "shuffle" button is clicked. Meaning, the user must only see each rectangle move to its final position.

Some constraints:

Each rectangle has a Coordinate field that itself contains xCoordinate & yCoordinate.
Checking if the clicked rectangle is a neighbor of the invisible one will be done by comparing the rectangles' Coordinates and not their positioning on the screen, i.e., translateX, translateY.
If they are neighbors: the rectangles swipe places.
Else: the rectangle shows a nudge animation (as in invalid move).
Only after the animation is finished, rectangles' Coordinates can be swiped.
Each process (containing the needed steps after a click) apart from the animation itself, should be handled in a different thread.

A question: If the Coordinates can be swiped only after the animation is done, meaning each click activates a thread that holds all other threads(clicks that came after) until it is done so it can swipe the coordinates so the next thread's neighbor check is based on correct data, how would it be possible to allow the "shuffle option" without creating an entirely different execution path, i.e., by reusing most of the already written code and leveraging the Java & JavaFX's strengths?

What if we add a constraint that only every second click should be executed?

My point being, these problems can appear in various ways. There must be someone who thought of providing some kind of framework or an abstract solution to this kind of problems. Or is it each case for itself?

sentences:
Oriented Bounding Box - How to? I've been trying to write my own collision code, less because I want to, more because I want to understand its working.

To do this, i've been working off of the popular collision book i'm sure you've all heard of: Morgan Kaufmann Real Time Collision.

I'm on the subject of Oriented Bounding Boxes. These are boxes that can have an orientaiton applied to them.
If it matters, i'm doing my code in 2D. It seems easy enough to just cut out an axis from the books calculations.

Here is the OBB they define:

// Region R = { x | x = c+r*u[0]+s*u[1]+t*u[2] }, |r|<=e[0], |s|<=e[1], |t|<=e[2]
struct OBB {
    Point c;     // OBB Center Point
    Vector u[3]; // Local x-, y-, and z-axes
    Vector e     // Positive halfwidth extents of OBB along each axis
};

The confusing one is the Vector array, u.

Point c is the center 3 axis position of the box.
Vector e is the width, height, and length of the box.
Vector u[3] baffles me. My best guess is that it is the center-point of each of the 3 sides (with the reflected 3 finishing the box)

How does rotation work into this? Is the Vector u[3] taking the roation in somehow? How?

sentences:
Which version of OpenGL for Android? I've been trying to learn OpenGL ES 2.0 to create a simple 2D game. I bought a book on android development, but after seeing that the author uses his own SDK that implements OpenGL ES 1.0 I decided to just use online tutorials. I've been so lost trying to find out what to use. The Matrices and shaders of 2.0 confuse me and I can't find any tutorial that just explains how to texture map a simple 2D image.
Basically:

OpenGL ES 1.x or 2.0 for simple 2D with little OpenGL experience
If 2.0 Any good tutorials for 2.0, I've found so many for 1.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 Nethack frontends work? I have been trying to learn about GUI frontends for Nethack, but I have been unable to determine how do they get the game information (map, inventory, player info, enemy locations, etc) from Nethack? As in, is there some API that allows these frontends to query these information? If so, how are they used?
I have looked up everywhere but unable to find any documentation that describes how to do so.

sentences:
Help me adjust this RPG logarithmic leveling formula! I'm trying to find a formula that's fits the way I want my player to gain experience and level up. I know this is primarily opinion based but I hope someone can help me!

I've used the following formula as a base, I found it here:

//Calculate level
Level = Math.Max( Math.Floor(6.7f * Math.Log(Experience + 455f) + -40f), 1 );

//Calculate experience for level
Experience = (long)(Math.Exp((Level - -40f) / 6.7f) - 455f);

I wrote a script that will show what it will look like, which is this:

I want to find a way to make it very easy for the player at early levels (let's say until level 15~), and then slowly harder. I'm not sure how to change the formula or if it's even possible! Hope you can help!

sentences:
Which is the best approach to make a 2D character to be able to use tons of different equipments when in action? I want to create a 2D game but I'd like to have the character to wear tons of different equipments on different combinations, like a RPG or something.

So let's say the user changes his/her shoulders and pants, this must be shown to the player and all these different equipments must follow the different characters action (hitting, being hit, spelling magic, etc.).

I see a few problems that I'd like to know the best approach/algorithm/architecture to solve.

1 - Sprites or Animations

Should I create different sprites for each equipment in each action animation?

Is it better to just have the equipment sprite and animate it directly on code like rotating and translating (using something like tween on Flash)?

Is there any other better option? (I really don't like the ideas above)

2 - Positions

Let's say during one of the character's move he starts looking directly in front to the player's view but ends his movement showing his right side to the player (like if he swings his sword from one side to the other).

If we consider one part of the user, like his head for example, it starts in front and then turns left.

It means at least 3 different positions for each head equipment (helmet, cap, whatever).

This surely influence the answer of #1 question. How is the best way to achieve that?

3 - Layers

Let's consider a character move where he spins 360 degrees with his arms open. At the beginning of the animation, his right hand is close to the user's view and then, at the middle of the movement, this is probably behind the character's body on the animation.

Whatever is the option on #1 question, you surely needs to use some kind of layer model to make this sprite or animation to starts closer to the player's view and later change to far away from player's view.

Is there any good way to do that?

I know the question is quite long and difficult to understand. Let me know if you think it's better to have some drawings to try to explain which one and I'll try to do that.

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:
adding vertical scrolling to 2D platformer in libgdx I am trying to make a two sided platform game in Libgdx. Where I am scrolling through the TiledMap.
I was easily implementing the horizontal scrolling using..

camera.position.x = player.getPositionX();

and it works fine. But when it comes to Vertical scroll .. I am observing very bad effects doing the same thing on y-axis. I tried it many ways. But No code could give could a real look and feel.
Later I happen to find this video

http://blog.mimeoverse.com/post/581467761/the-ideal-platformer-camera-should-minimize

it says "
The ideal platformer camera should:

minimize vertical motion
lead in the direction the player is facing
remain motionless during horizontal micro-adjustments
The secret to achieving all three is (what I call) the trap. The trap is an invisible rectangle (made visible for this demo), roughly twice as wide and tall as the player sprite, with the same starting coordinates. Rather than follow the player sprite directly the camera follows the trap. When the player moves within the trap, the camera does not move. The trap only moves when the player pushes against one of its edges.
"
it demonstrates a good idea but Still there still seems something bad .. I am writing some wrong code

Rectangle trap_old,trap_new;

.....

trap_old = new Rectangle(player.getPositionX()-2*player.getWidth(),
                        player.getPositionY()+5*player.getHeight(),
                        5*player.getWidth(),
                        6*player.getHeight());

//.. inside render

trap_new = getNewTrapArea(player.getPositionX(),
                        player.getPositionY(),
                        player.getWidth(),
                        player.getHeight());

camera.position.x = trap_new.x;
camera.position.y = trap_new.y;
camera.update();

private Rectangle getNewTrapArea(float positionX, float positionY, float width, float height) {
    Rectangle temp = new Rectangle(positionX, positionY, width, height);
    if(temp.overlaps(trap_old))
        trap_new = trap_old;
    else
        trap_old = trap_new = new Rectangle(positionX-2*width, positionY+5*height, 5*width, 6*height);
    return trap_new;
}

sentences:
How can I handle bouncy collision lag in an online game? In my online game, each client sends its player's x/y location to the other clients, and the other clients update the location as they receive it, with some interpolation.

Issue:
The game has bouncy collisions. So if one player collides with another player at speed, it should push that player away. But if I push another player, it won't move away because it's still receiving info from the other end, where it's stationary.

The other player will move away, however, but only after receiving that info from its client.

Question: What are some good ways of handling this problem, while keeping player positions as accurate as possible?

P.S.: I know having an authoritative server can make this better, but we don't have the time to switch over.

sentences:
Save and retrieve image from database in unity I have done a sample to insert and retrieve data from MySQL in unity.Now I need to insert and retrieve image from MYSQL in unity. The images are files selected by the user from their filesystem.

Can anybody please help me?

Below is the sample code for inserting data

<?php

  $database = mysql_connect('localhost', 'root', 'amma') or die('Failed to connect: ' . mysql_error());
    mysql_select_db('igrms_db') or die('Failed to access database');
    $query="INSERT INTO igrmsdata(id,name,description) VALUES('$id','$name','$description');";
    //$query="INSERT INTO igrmsdata(id,name,description) VALUES('100','Tippu','Welcome to Tippu');";
    $result=mysql_query($query);
    echo "DataEntered";

 ?>

Unity code for inserting data

string IGRMSDataEntryCode="http://192.168.173.243/IGRMSDataEntry.php";
public InputField artifactidField;
public InputField artifactnameField;
public InputField artifactdescriptionField;
public Text messagebox;
public static string artifactid="";
public static string artifactname="";
public static string artifactdescription="";

void Start () {

}

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

}
public void IGRMSDataEntryDetailsDB()
{
    artifactid=artifactidField.text;
    artifactname=artifactnameField.text;
    artifactdescription=artifactdescriptionField.text;
    if(artifactidField.text=="" || artifactnameField.text=="" || artifactdescriptionField.text=="")
    {
        messagebox.text="All fields are mandatory";
    }
    else {
        StartCoroutine(AddArtifacts(artifactid,artifactname,artifactdescription));
    }

}

public void IGRMSDataReset()
{

    artifactidField.text="";
    artifactnameField.text="";
    artifactdescriptionField.text="";
    messagebox.text="";
}

IEnumerator  AddArtifacts(string id,string name,string description)
{

    //string register_url = getscoreCode + "?name=" + user + "&score=" + scor;
    string register_url = IGRMSDataEntryCode + "?id=" + id + "&name=" + WWW.EscapeURL(name) + "&description=" + WWW.EscapeURL(description);

    WWW entereddata = new WWW (register_url);
    yield return entereddata;
    messagebox.text="Data Uploaded Successfully";
    artifactidField.text="";
    artifactnameField.text="";
    artifactdescriptionField.text="";
}

sentences:
Handle actor deletion undo in Unreal Editor? I have some objects pointing to a scene component of an actor:

class MyObject
{
    USceneComponent* Component;
}

When the actor is deleted, all its components are also deleted. So when the delete action is undone (transaction undo), the component pointer (in MyObject) becomes invalid. This is not a problem, but the pointer must be updated after the redo (when the actor and its components are automatically re-created).

How can I detect which actor was created by the redo?

sentences:
Maintain Vuforia tracking during Unity Ad My game uses Vuforia pos and ground plane tracking.

During gameplay players are given the option to watch a video to gain additional health.

When 'No' is chosen gameplay resumes fine. However when 'yes' is chosen Vuforia tracking is lost during the video and afterwards all gameobjects are locked in a static position in relation to the AR camera.

Is there anyway to maintain pos tracking during the video?

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:
LightMap not working properly I've made a chips bag model for my game:

http://imgur.com/JcumRF4

And I textured it like this:

http://imgur.com/wpyeACZ

and I googled on how to make lightmaps all of them say "Smart UV project" but when I do that, texture on my model gets broken, so thats why I dont want to use smart uv project

Is there another way?, it has to be.

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:
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:
Where to generate data in an Entity-Component System? So I'm making a small game where I generate 2D landscape using perlin noise when the game first loads.

I've got it working in a OO way, but want to move over to an ES architecure, and I'm  just struggling to work out the right place for the code that does the generation to go?

In OO world, I have a World object which gets passes a coordinate value that is used as the seed for the perlin noise, and generates all the points for the land mass when the world is created.

I'm thinking I need a World component with a coordinate field on it - that's an easy part.

From there - is it right for a component to generate data when it's first initialised (or is that too OO?)?
Or should a System be doing that instead, when the game first starts?

Or... some other solution I'm not aware of?

Thanks in advance for any guidance.

sentences:
How can I stop my collision detection from registering multiple times per frame? I am working on a side-scroller shooter right now. Everything is working fine along with the collision detection however, my problem is that the collision triggers my health deduction code multiple times per bullet. Here is the code where the bullet hits a turret. Supposedly doing 5.0 damage but instead it randomly does a lot more damage since the collision runs multiple times with just one bullet. How could I prevent this?

void TurretCollision()
{
 int BulletNo = 0;
        int MissileNo = 0;

for (BulletNo = 0; BulletNo < MAX_BULLETS; BulletNo++)
{
    if (Turret[1] == true)
    {
        //cout << TurretH[1];
        if ((BulletX[BulletNo] >= 103 && BulletX[BulletNo] <= 103.09) && (BulletY[BulletNo] <= -38 && BulletY[BulletNo] >= -45))
        {
            BulletActive[BulletNo] = false;
            TurretTrial = TurretTrial - 5.0;

            if (TurretTrial <= 0.0)
            {
                Turret[1] = false;
            }
        }
    }

}

}

sentences:
FBO lack of 3D Precision I am trying to do some post processing on my 3d scene. When I render directly to the screen edges are sharp, however when I render my scene to an offscreen FBO then render that to a texture that is then drawn to the screen I get strange Z-fighting around object edges. Any Idea how this can be resolved?

The resolution of the FBO image seems to be worse in some places too, however the FBO size is set to the window width and height.

Thanks!

Direct Rendering

FBO rendering

Depth Buffer Code

private int createDepthBufferAttachment(){
    depthTexture = Game.textureManager.genTexture();//call to GL11.glGenTextures()
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTexture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT16, Game.WIDTH, Game.HEIGHT, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    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.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);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexture, 0);

    return depthTexture;
}

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:
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 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:
Objects desync position when speed is not multiple of 10 While finishing up game loop and rendering integration, i made some blocks move back and forth in the x axis to test things out. Their initial positions are as follows:

The first block starts at 0,0(Top-left) and subsequent ones add 40 to both x and y.

Move code

s16 speed = 10;

if(block->sprite->position.x >= viewportWidth - block->sprite->width)
{
    block->sprite->position.x = viewportWidth - block->sprite->width;
    block->dir = -1;
}
else if(block->sprite->position.x <= 0)
{
    block->sprite->position.x = 0;
    block->dir = 1;
}

block->sprite->position.x += speed * block->dir;

However, if i change the speed to a number not multiple of 10(or using deltaTime to influence the speed), the blocks will de-sync when changin directions, as shown bellow:

Result of using roundf(1000 * deltaTime) as speed

Result of using 13 speed and removing the clamping of position

I thought it was related to me using ints instead of floats for positions, tried to change but no luck. Looking at the game loop update, no block is being left out of any update phase either.

What bit of math an i missing? What causes this?

Thanks.

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:
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:
onClickListeners not working correctly (conflicting) In my pause dialog, the exit is working correctly, but the resume isn't, if I press resume 3 times, the third time it's going to exit.

ImageButton btnPlayOn = UIFactory.createButton(txtrPlayOn);
btnPlayOn.setSize(40, 40);
btnPlayOn.setPosition(75, 75, Align.center);
dialogP.addActor(btnPlayOn);

ImageButton btnEndGame = UIFactory.createButton(txtrEndGame);
btnEndGame.setSize(40, 40);
btnEndGame.setPosition(75, 55, Align.center);
dialogP.addActor(btnEndGame);

btnPlayOn.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("resuumeeeeeeee");

            }
        });

        btnEndGame.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("exiiiiiiiiit");

            }
        });

I think I know why, it's because both buttons have the same x so the listener is getting confused. Anyhow I don't know how to fix it.

sentences:
Direct3D9: How to switch from one full-screen monitor to another? I know how to display my game in full-screen on a specific monitor by specifying an adapter number when the D3D device is created.

However, I don't know how to switch from one monitor to another while the game is already running, without re-creating the D3D device from scratch. Is this even possible?

Thanks!

sentences:
Gaussian blur filter and "shimmering" I have a fairly bog-standard Gaussian blur filter (seperable) I'm using to make a glow effect in my pipeline.  At the moment I'm rendering it only to 256x256 texture and then doing a very simple additive combine with the scene to get the effect.

Due to the low resolution of the blur texture, I get quite a bit of "shimmering" of the blur when the camera moves around.  Actually I noticed this in the Mass Effect 2 game, where they "glow" the specular highlights and shimmering is visible there.

Does anyone know of any technique for reducing or eliminating shimmering/aliasing that doesn't involve rendering the blur to a higher resolution texture (and so killing performance)?  I'm already using GL_LINEAR in my samplers, which helps a bit, but not all that much.

Here's a little YouTube clip of the blur, although it's hard to see after YouTube have downsized and messed around with the clip, unfortunately.

Note that I read this article about real-time glow, and they briefly mention shimmering, but don't go into detail about solutions.

For completeness, I include my blur shader below.

#version 420

// Input uniforms.

uniform vec2 uniform_TexelSize;
uniform float uniform_BlurScale;
uniform float uniform_BlurStrength;
uniform int uniform_Orientation;
uniform int uniform_BlurAmount;

// Shared.

in vec2 attrib_Fragment_Texture;

// Samplers

uniform sampler2D Map_Diffuse;

// Result

out vec4 Out_Colour;

// Local Functions

float Gaussian (float x, float deviation)
{
    return (1.0 / sqrt(2.0 * 3.141592 * deviation)) * exp(-((x * x) / (2.0 * deviation)));
}

// Main

void main(void)
{
    float halfBlur = float(uniform_BlurAmount) * 0.5;
    float deviation = halfBlur * 0.35;

    deviation *= deviation;

    float strength = 1.0 - uniform_BlurStrength;

    vec4 colour = vec4(0.0), texColour = vec4(0.0);

    // Horizontal or vertical?

    if (uniform_Orientation == 0)
    {
    // Horizontal.

        for (int i = 0; i < 10; ++i)
        {
            if (i >= uniform_BlurAmount)
                break;

            float offset = float(i) - halfBlur;

            texColour = texture2D(Map_Diffuse, attrib_Fragment_Texture + vec2(offset * uniform_TexelSize.x * uniform_BlurScale, 0.0)) * Gaussian(offset * strength, deviation);

            colour += texColour;
        }
    }
    else
    {
        // Vertical.

        for (int i = 0; i < 10; ++i)
        {
            if (i >= uniform_BlurAmount)
                break;

            float offset = float(i) - halfBlur;

            texColour = texture2D(Map_Diffuse, attrib_Fragment_Texture + vec2(0.0, offset * uniform_TexelSize.y * uniform_BlurScale)) * Gaussian(offset * strength, deviation);

            colour += texColour;
        }
    }

    Out_Colour = colour;
}

sentences:
Algorithm to generate random shapes that fill up a rectangle? The final result can be like this

I've thought up several approaches:

Generate random curved lines to "cut" the rectangle (or generate random dots and form the line from the dots)
Break the rectangle with Fracture Voronoi algorithm and shrink the broken parts to make the curved lines thicker.
Generate random shapes and let it fall into the rectangle like the game Tetris

But before implement the ideas, I want to know if there is an algorithm (with pseudo code) to generate random shapes that fill up a rectangle?

sentences:
Are there any pitfalls with this approach to isometric map generation? First of all, I don't have much experience on game development but I do have experience on development. I do know how to make a map, but I don't know if my solution is a normal or a hacky solution. I don't want to waste my time coding things, and realise they're utterly crap and lose my motivation.

Let's imagine the following map. (2D - top view - A square)

X: 0 to 500
Y: 0 to 500

My character currently stands at X:250,Y:400, somewhere near center of 100px above bottom and I can control him with my keyboard buttons. LEFT button does X--, UP button does Y-- etc.

This one is kid's play.

I'm asking this because I know there are some engines that automate this task. For example, games like Diablo 3 uses an engine. You can pretty much drag drop a rock to map, and it is automatically being placed here - making player unable to pass through/detect the collision. But what the engine exactly does in the background? Generates a map like mine, places a rock at the center, and checks it like:

unmovableObjects = array('50,50'); //we placed a rock at 50,50 location

if(Map.hasUnmovableObject(CurrentPlayerX, CurrentPlayerY))
{
     //unable to move
}
else
{
     //able to move
}

My question is: Is this how 2D/Isometric maps are being generated or there is a different and more complex logic behind them?

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:
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:
Check collision between instantiated objects? I am using a script to instantiate multiple objects having rigidbody with different velocities at different positions. I want to destroy two or more objects when they collide, but I'm not getting anything inside:

void OnCollisionEnter(Collision collision){}

The details of the object I'm instantiating. http://i.imgur.com/rLnOM.png

The script is attached to an empty GameObject and Instantiated GameObject is stored in a array of GameObjects:

 Block[0] = Instantiate(boxPiece) as GameObject;

where boxPiece is the Object I want to instantiate.
And I'm checking for collisions in this very same script.

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:
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:
How to switch between views in android? I've tried several methods to switch between two views in my program. I've tried creating a new thread then have the view run for 5 seconds before creating intent to start my main activity. This is the code snippet from the said view class:

mHelpThread =  new Thread(){
        @Override
        public void run(){

            try {
                synchronized(this){
                    // Wait given period of time or exit on touch
                    wait(5000);

                }
            }
            catch(InterruptedException ex){
            }

            finish();

            // Run next activity
            Intent intent = new Intent(Intent.ACTION_MAIN, null);
            intent.addCategory(Intent.CATEGORY_HOME);
            startActivity(intent);
            //stop();
        }
    };

    mHelpThread.start();

I can access the said view without error but it doesn't disappear after 5 seconds nor did it switched to main view when I even utilized an onTouchEvent() to detect touch on the screen of which it should have automatically closed.
I've also tried adding a button on the said view to manually switch to main view:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.help);
    final HelpView helpView = this;
    final Button btnback = (Button) findViewById(R.id.back);
    btnback.setOnClickListener(new View.OnClickListener(){
        public void onClick(View v) {
            Intent intent = new Intent(helpView, MainActivity.class);
            startActivity(intent);
        }
    });

}

These codes worked, though, for creating a launcher for my program. So I thought that it would work the same if I added an option for help/rules(for the game) that would switch to another view. I've only since started using eclipse for android so pardon my lack of knowledge. Here is also the snippet from my manifest:

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="MainActivity"
        android:label="@string/title_activity_main">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <intent-filter></intent-filter>
    </activity>
    <activity android:name="SplashScreen"
              android:theme="@style/Theme.Transparent">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity android:name="HelpView"
              android:theme="@style/Theme.Transparent">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <intent-filter></intent-filter>
    </activity>
</application>

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: Can the solar system be accurately represented in 3d space using doubles (or longs)? I would like know to how to best manage coordinates in a 3D game whose aim is to realistically model the entire solar system, yet be able to handle the smallest movements in a "ship" (ie: perhaps we can consider 1cm to be the smallest acceptable movement for a frame). Do 64-bit doubles (or 64-bit longs) support this, or do we run into overflow problems? If not, then should longs or doubles be used, or if so, then which alternative approach do you think is the most sensible for modelling positions in the solar system in a 3D game? (ie: only holding a bit of the system in the display at a time based on distance to ship, or having the system somehow represented in a different co-ordinate space etc)

sentences:
using Mathf.Clamp in Vector3 to restrict object drag I'm making a checkers game and I've got a movement controller working to move the pieces. I want to restrict the drag to be within the board. The center of the board is 0,0 so the far left side's x value is -4, top of the boards y is 4, etc...

This is my drag script so far

void OnMouseDrag()
{
        float distance_to_screen = Camera.main.WorldToScreenPoint(gameObject.transform.position).z;
        transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance_to_screen));
}

but when I try to clamp my new Vector3's x and y between -4 and 4 like this,

transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Mathf.Clamp(Input.mousePosition.x,-4f,4f), Mathf.Clamp(Input.mousePosition.y,-4f,4f), distance_to_screen));

it shoots the pieces way off camera. This may be because don't truly understand Camera.main.ScreenToWorldPoint, is it returning different x,y coordinates than the global ones?

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:
How to custom UI Slider with Unity UGUI I want to use Unity UGUI to custom a slider and the final looking show be like this:

And the images I use are:

But I found it hard to accomplish:
The handle will be screeched and the fill will not be fully filled with the handle

Can somebody tell me how I could accomplish this?

sentences:
Games with rubbing/scratching as interaction? I'm brainstorming a game aimed for touchscreen. Its primary interaction involves a lot of rubbing and scratching with the finger to the on screen objects, sort of like Fruit Ninja, but a bit more work than a single swipe. I recall there are somewhat similar operation in Rayman Raving Rabbid that uses Wiimote to draw shapes.

At this stage, the interactions in my mind looks repetitive and unappealing. I'm trying to find similar examples that appear repetitive but still fun to play. Besides these two, are there any others?

sentences:
Lights system with shaders in OpenGL? In more than just 1 occasion, i read about 2 ways of doing a light's system in OpenGL:

normal way? i don't know how to call this one
with the shaders ( GLSL )

The problem is i don't get the difference in terms of rendering performance and system usage, what are the pros and cons for each one ?

Thanks.

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:
in Unity3d, how to automatically create fixed joints in a wall of cubes? I want to create a wall:
width  6 cubes
height 7 cubes

therefore I have 22 cubes on the margins and 20 cubes inside. For each of the margins cubes(except the corners) I have to set 3 fixed joints, and for the cubes inside the wall I have to set 4 fixed joints - all this to have good physics behavior.

Pretty much I have to create a fixed joint between a cube and all his neighbors => and that's a lot!
Is there a way to automatically create these fixed joints?

Is there another way to create a physics friendly wall? I want to simulate a wall of bricks hited by a projectile.

sentences:
What are the common character animation techniques used in tile based hack&slash games? I wonder what kind of animation techniques are used for creature and character animation in modern hack&slash type tile based games? Keyframing for different actions may be one option. Skeletal framing may be another. But how about the physics? Or do they use a totally hybrid system of inverse kinematics supported with a skeleton,physics and mixed with interpolated keyframing for more realistic animations? If so, how and for what reasons? I can think of many different solutions for the issues below but I wonder what's used and best suited for issues like:

Walking or moving on an uneven terrain
Combat interaction, combat physics and collisions
Attaching rigid items to character and their iteractions ih physics world
Soft body dynamics like hair, vegetation, clothes and fabric in line with animations and iteractions.

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:
Is it possible to compile both VS and PS in a single file in VS2012? VS2012 has a built-in option for compiling *.hlsl files at compile time (e.g. to check for errors). But from what I've seen it requires me to provide the entry point (function) name for each file. What if I have both Vertex Shader and Pixel Shader in 1 file? Is it possible to make VS2012 still compile that file (both shaders) to check for errors?

I know it's possible with Custom Build Tool option and using fxc in the Command Line (I just tell it to compile the file without specifying the entry point). But since by default VS2012 is using fxc as well I thought it should be possible to compile 2 shaders in a single file when choosing HLSL Compiler option, too.

sentences:
How do I turn an image into a Box2D physics object? I'm using Box2D for a Game Programming course, and I was wondering if it is possible to choose the best shape and size of shape for the rigidbody/fixture for a sprite based on its transparency.

I've tried to build with the idea of new content being easy to add (all data for enemies, terrain, etc. is stored in XML documents). Because of this, there will not be a new class for every enemy. This makes creating the fixture shapes difficult, since it has to be a generic solution but still map realistically to the sprite when the game is being played. The best solution I've come up with so far is to somehow figure out where the majority of the non transparent pixels are in the sprite and build the shape from that.

Does something like this exist? If not, would it be hard to implement?

sentences: Making an object swing from one rope to another I am trying to make a Tarzan like game with Cocos2D and Box2D. I am having issues with the physics - making an object swing from one rope to another. I am not really sure how to do this. Could anyone please help me.

sentences:
How to rotate a triangle towards the point in Qt? I have an issue with items rotating.

I have a point and a triangle which needs to be rotated with its apex point towards the taregt point. The right side of the picture represents how it is should to be, and the left side represents how it works. Red dashed arrows represent motion, the triangle moves along its arrow. Green dashed arrow represent rotation, the triangle should rotates along its arrow.

How do I do calculations:

calculating desired velocity aka direction

velocity(direction) = Vec2DNormalize(targetPoint - locationPoint) * maxVelocity;

calculating angles for target point and location point

float angleLoc = atan2(rect->location.y, rect->location.x);

float angleTarg = atan2(rect->target.y, rect->target.x);

rotating after subtracting angleLoc - angleTarg

rotate((angleLoc - angleTarg) * 100);

Here it is the source code.

ster.cpp

#include "steer.h"
#include <QPointF>
#include <QBrush>
#include <QPen>
#include <vector2d.h>
#include <QGraphicsPolygonItem>
#include <QPolygonF>
#include <QPointF>
#include <QGraphicsItem>
#include <QDebug>
#include <cmath>
#include <vector>
#include <QtWidgets>

void Steer::seek()
{
    //calculating desired velocity aka direction
    rect->desired = Vec2DNormalize(rect->target - rect->location) * rect->maxspeed;

    //calculating steering force
    rect->steer = rect->desired - rect->velocity;

    //if the steer force is bgger than maxforce
    rect->steer.Truncate(rect->maxforce);

    //adding to acceleration steering force
    rect->acceleration += rect->steer;

    //add to velocity acceleration which has steering force only
    rect->velocity += rect->acceleration;

    //if the velocity is bgger than maxspeed
    rect->velocity.Truncate(rect->maxspeed);

    //changing our position
    rect->location += rect->velocity;

    //reset the acceleration
    rect->acceleration *= 0;

    viewport()->repaint();
}

Steer::Steer(QGraphicsView *parent)
    : QGraphicsView(parent)
{
    scene = new QGraphicsScene;
    rect = new Vehicle;

    scene->setSceneRect(0, 0, 500, 500);

    polygon <<  QPointF(5.0, 0.0) << QPointF(-5.0, 0.0) <<  QPointF(0.0, 20.0);
    rect->triangle = scene->addPolygon(polygon);

    this->setScene(scene);

    timer = new QTimer(this);
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(seek()));
    timer->start();

    this->show();
}

void Steer::paintEvent(QPaintEvent *)
{
    QPainter painter(viewport());

    painter.setBrush(QBrush(Qt::green));
    painter.setPen(QPen(Qt::black));

    painter.save();

    //moving to position
    painter.translate(rect->location.x, rect->location.y);

    //calculating angles for target point and location point
    float angleLoc = atan2(rect->location.y, rect->location.x);
    float angleTarg = atan2(rect->target.y, rect->target.x);

    //rotating after substracting angleLoc - angleTarg
    painter.rotate((angleLoc - angleTarg) * 100);

    painter.drawPolygon(polygon);

    painter.restore();

    for(int i = 0; i < vec.size(); i++)
        painter.drawEllipse(vec[i].x() - 1, vec[i].y() - 1, 1 * 2.0, 1 * 2.0);
}

void Steer::mousePressEvent(QMouseEvent * click)
{
    point = mapToScene(click->pos());

    vec.push_back(point);

    rect->target.x = point.x();
    rect->target.y = point.y();
}

Here the whole project.

sentences:
3D infinite platform generation: Can't increase space between platforms. (Unity) As seen in the images, changing the value of 'spawnZ' affects the distance between the initial platform and the first generated platform but afterwards it has no affect whatsoever.

public GameObject[] tilePrefabs;

public float spawnZ = 10f;
public float tilelength;
public int amnTilesOnScreen = 5;
public Transform playerTransform;

// Use this for initialization
void Start () {
    for (int i = 0; i<amnTilesOnScreen; i++)
    {
        SpawnTile();
    }
}

// Update is called once per frame
void Update () {
if(playerTransform.position.z>(spawnZ - amnTilesOnScreen * tilelength))
    {
        SpawnTile();
    }
}

private void SpawnTile(int prefabIndex = -1) {
    GameObject go;
    go = Instantiate(tilePrefabs[0]) as GameObject;
    go.transform.SetParent(transform);
    go.transform.position = Vector3.forward * spawnZ;
    spawnZ += tilelength;

}

sentences:
Axis of affine transformation matrix Let's say I have a right handed column major 4x4 transformation matrix. Can I safely assume (even though there exist non uniform scale) that first column is X axis vector, second column is Y axis vector and third column is Z axis vector?

$$
\begin{bmatrix}
Xx & Yx & Zx & 0 \\
Xy & Yy & Zy & 0 \\
Xz & Yz & Zz & 0 \\
0  &  0 &  0 & 1
\end{bmatrix}
$$

Iis the above layout correct? By the way I am using glm and I don't know if there is a function to extract these axis.

sentences:
How to iterate through members of lists of members of lists within members of previous lists? I'm sorry for the clumsy title, and for what will be the continuation of further clumsiness in my question - I'm not even sure how to properly ask this, so please allow me to illustrate:

I'm writing a game using XNA and C#.

I have 'nodes' in 2d space, and I'm trying to create a network of nodes representing traverse-able world-space.

The nodes themselves store a list of their 'neighbors', and an associated dictionary that refer to how an AI might travel from one node to a node's neighbor, either by walking, or jumping.

I'm trying to find a way that I may iterate from the list of one node's neighbors, to its neighbor's neighbors, to its neighbor's neighbor's neighbors, etc. etc. etc., to test each for contiguous neighboring connections based on whether or not they are all reachable to each other by 'Walk' (so I can find whole walkable platform segments).

sentences: How can I run a .jar file with XNA? Could someone help me to develop a method to run any .jar file (with parameters) from in C# with XNA?

sentences:
Do leaderboard sets (in Game Center) allow 500 unique leaderboards? The Game Kit Programming Guide for iOS claims:

  The number of different leaderboards allowed increases to 500
  leaderboards per game when leaderboard sets have been
  enabled...Leaderboard sets offer developers the ability to combine
  several leaderboards into a single group.

But their example (see image below) implies that a single leaderboard is placed into multiple leaderboard sets. Is that the only way to be able to use the full 500 leaderboards? by combining the same leaderboard into multiple sets? I want to be able to have 500 unique leaderboards that are not duplicated between sets. Is this possible?

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:
Game Engine framework or library I'm on the planning stages for an internal game engine I am about to start creating, which will be used for all my games going forward. But I'm struggling a bit with how it should be built.

The choices come down to: framework or library.

My basic objective is to hide engine details as much as possible to keep high level game development on scripts and config files as much as possible. But also to reuse the core engine for any tools we might develop in the future.

Frameworks can make things nice and easy for development, but then you're locked in. Libraries are good if you're only interested in a specific subsystem. But we need to glue everything together in a game by game basis.

Well there is also another, building the engine as a standalone exe that handles all game resources, and all the subsystems. Game logic (and other per game dynamic stuff) is done exclusively on scripts with config files to configure each internal engine subsystem.

Which one will give me more flexibility in the future.

Thanks.

Edit:
Thanks everybody, guess I was looking at this in the wrong perspective. We can't really plan something like this without a priori knowledge of what the games need, guess this is why there is no such thing as a general engine for all genres.

I'll focus first on the game proper then iteratively analyze at the end of each game how to make decent abstractions for libraries or frameworks depending on my work-flow (or possibly that of a future team).

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:
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:
Game State Management using Lua I want to be able to (only) define game states using Lua script, but I'm not sure how I should do it. Here's what I have in mind currently:

For each state, I will create a .lua file that contains a class (table) that has the same name as the file name. Each table must have a set of event handlers: onEnter (called when the state is entered), onUpdate (called every frame) and onExit (called when exiting the state). So if I want to have a MainMenuState, I will have a file called "MainMenuState.lua" which will contain something like this:

MainMenuState = {}

MainMenuState["onEnter"] = function()
end

MainMenuState["onUpdate"] = function(elapsedTime)
end

MainMenuState["onExit"] = function()
end

Defined states will be exposed to the game engine via a singleton StateManager class. StateManager will have a function that registers a state under a unique name:

void registerState(string stateName, string fileName);

State registration will be done in script by placing the registration codes inside an init script that is called once after the game engine is initialized:

--init.lua
--Register all the states needed by the game
StateManager:registerState("SplashScreen", "SplashScreen.lua")
StateManager:registerState("MainMenuState", "MainMenuState.lua")
StateManager:registerState("InGameState", "InGameState.lua")
-- etc etc

StateManager will also keep track of which state is currently active and also handle state transitions:

//cpp
void changeState(string state);

--lua
StateManager:changeState("PauseMenuState")

sentences:
UDK license (DLLBind) I dont understand part of UDK's license about DLLBind:

does it allow to use DLLBind in UDK projects? Could I use DLLBind for commercial games without buying c++/native license?

sentences:
How import and draw a tiledmap with slick2d How I can import and draw a tilemap with different layers? I have the next code and send me error if the tilemap have more than one layer.

public class Map {

    private TiledMap map = null;

    private int bg,level,extras;

    public void init(GameContainer container) throws SlickException {

        map = new TiledMap("assets/levels/default.tmx", false);

    }

    public void render(int type, GameContainer container, Graphics g) {

//      map.render(0, 0, 0, 0, 19, 13);

    }

    public void update(GameContainer container, int delta) {}

}

I was thinking to save each layer in a different variable for later draw each layer. But Im not sure how I can do it. I have been looking for tutorials, and the slick2d API. And this is the error.

Fri Feb 06 22:18:30 GMT 2015 ERROR:For input string: ""
java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1008)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
    at gameEngine.Map.init(Map.java:54)
    at states.Play.init(Play.java:26)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at gameEngine.Main.main(Main.java:31)
Fri Feb 06 22:18:30 GMT 2015 ERROR:Failed to parse tilemap
org.newdawn.slick.SlickException: Failed to parse tilemap
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:695)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
    at gameEngine.Map.init(Map.java:54)
    at states.Play.init(Play.java:26)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at gameEngine.Main.main(Main.java:31)
Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1008)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
    ... 7 more

sentences:
Aron Granbergs Unity Pathfinding AI goes back and forth The agent goes back and forth after calculating the path with seeker.StartPath (transform.position,target.transform.position, OnPathComplete);. The gizmo shows the correct path. Please watch this short video to get an impression on what happens.
It starts after adding about 100 obstacles during runtime. Is this a known bug or am I doing something wrong? My test case is really simple. I can provide the project if necessary.

Link to the Video:
http://screencast.com/t/2ww04975l

sentences:
Collider inside another collider: Move the brain via mouse while being able the click the spheres The spheres have a sphere collider on them and are clickable via this script:Clickable.cs
public class Clickable : MonoBehaviour
{

    void Update()
    {
         ClickDetect();
    }

    void ClickDetect()
    {

        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit))
        {
            Transform t = hit.collider.transform;

            if (t.name == "Sphere(Clone)")
            {
                if (Input.GetMouseButtonDown(0))
                {
                        hit.collider.gameObject.GetComponent<Light>().color = new Color(1, 0, 0, 0.7f);

                    Debug.Log(t.parent.name + (t.GetSiblingIndex() + 1));
                }
            }
        }
    }
}

and the brain has a box collider on it and is moved by this script RotateonMouse
void Rotation()
{
    if (_isRotating)
    {
        // offset
        _mouseOffset = (Input.mousePosition - _mouseReference);

        // apply rotation
        _rotation.y = -(_mouseOffset.x) * _sensitivity;
        _rotation.x = -(_mouseOffset.y) * _sensitivity;

        // rotate
        transform.eulerAngles += _rotation;

        // store mouse
        _mouseReference = Input.mousePosition;
    }
}

The issue arises when I try to click on the spheres when the box collider on the brain is on.
I end up rotating the brain instead of being able to click the spheres.
Is there a way to be able to click inside the collider while also on the collider to rotate the brain?

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:
What is a fast way to darken the vertices I'm rendering? To make a lighting system for a voxel game, I need to specify a darkness value per vertex. I'm using GL_COLOR_MATERIAL and specifying a color per vertex, like this:

glEnable(GL_COLOR_MATERIAL);

glBegin(GL_QUADS);

glColor3f(0.6f, 0.6f, 0.6f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.3f, 0.3f, 0.3f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.7f, 0.7f, 0.7f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.9f, 0.9f, 0.9f);
glTexCoord2f(...);
glVertex3f(...);

glEnd();

This is working, but with many quads it is very slow.. I'm using display lists too. Any good ideas in how to make vertices darker?

sentences:
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:
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:
How can I distribute powerups "fairly"? I'm implementing a Bomberman-esque game in which players try to eliminate each other on a square tile-based arena. I'm currently implementing powerups that give the player who collected them a bonus (such as a larger inventory or faster movement speed).

How should the game system place these powerups such that, provided players collect powers closest to them, the game remains fairly balanced?

My first approach was to spawn a powerup on a random empty tile every few seconds. The problem with this purely random approach is that a player can have a massive advantage early in the game just by the luck of having many powerups spawn near them.

Ideally, I'd like powerups appear equally often near each player, but occasionally spawn near the map's center to encourage competition. To be clear, I do want some element of randomness -- specifying exactly which powerups spawn when and where would make the game predictable and dull.

What alternatives exist?

sentences:
How can I create a custom List-of-GameObject inspector which works like the default one in Unity? I need to

drag and drop GameObject to ObjectField.
drag and drop a group of GameObjects to list name.

The main problem is either do 1 or 2 work. I need the function same as unity List Inspector for future devolvement. Code as follow.

static SerializedProperty ThisList;
public override void OnInspectorGUI()
{
    ThisList = serializedObject.FindProperty("G");//List name call G
    serializedObject.Update();
    Show(ThisList);
    serializedObject.ApplyModifiedProperties();
}

public static void Show(SerializedProperty list)
{
    EditorGUILayout.PropertyField(list);
    EditorGUI.indentLevel += 1;
    if (list.isExpanded)
    {         EditorGUILayout.PropertyField(list.FindPropertyRelative("Array.size"));
        ShowElements(list);
    }
    EditorGUI.indentLevel -= 1;
}

private static GameObject[] a =new GameObject[50000];
private static void ShowElements(SerializedProperty list)
{
    //This code can drag and drop GameObject to ObjectField.
    for (int i = 0; i < list.arraySize; i++)
    {
        list.GetArrayElementAtIndex(i).objectReferenceValue = EditorGUILayout.ObjectField("OBj", list.GetArrayElementAtIndex(i).objectReferenceValue, typeof(GameObject));
    }

    //This code can drag and drop a group of GameObjects to list name.
    if (Event.current.type == EventType.DragUpdated)
    {
        DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
        Event.current.Use();
    }
    else if (Event.current.type == EventType.DragPerform)
    {
        for (int j = 0; j < DragAndDrop.objectReferences.Length; j++)
        {
            a[j] = (DragAndDrop.objectReferences[j] as GameObject);
        }
        Event.current.Use();
    }
}

However, it not work when both codes together.

If -> EditorGUILayout.PropertyField(list, true);
I can get the same result as the unity function. but I cant Custom the List. (such as add name, change position, add button...)

sentences:
How to swap row/column major order? I'm trying to get a sprite sheet clipped in the right order but I'm a bit stumped, every iteration I've tried has tended to be in the wrong order. This is my current implementation.

    Frames = (TempSurface->h / ClipHeight) * (TempSurface->w / ClipWidth);
    SDL_Rect Clips[Frames];
    for (i = 0; i < Frames; i++) {
            if (i != 0 && i % (TempSurface->h / ClipHeight) == 0)
                    ColumnIndex++;
            Clips[i].x = ColumnIndex * ClipWidth;
            Clips[i].y = i % (TempSurface->h / ClipHeight) * ClipHeight;
            Clips[i].w = ClipWidth;
            Clips[i].h = ClipHeight;
    }

Where TempSurface is the entire sheet loaded to a SDL_Surface and Clips[] is an array of SDL_Rects. What results from this is a sprite sheet set to SDL_Rects in the wrong order.

For example I need a sheet of dimensions 4x4 to look like this:

| 0 | 1 | 2 | 3 |
| 4 | 5 | 6 | 7 |
| 8 | 9 | 10| 11|
| 12| 13| 14| 15|

But instead I get this order:

| 0 | 4 | 8 | 12|
| 1 | 5 | 9 | 13|
| 2 | 6 | 10| 14|
| 3 | 7 | 11| 15|

Columns and rows order does not match. What should I do to fix the order?

sentences:
Atmospheric scattering and fog I've implemented a dynamic sky model (Preetham). I've got Rayleigh and Mie scattering working fine, but I'm not sure how to get the foggy effects in this Unity article

Here is what I have so far:

How do I get the fog/haze in my scene ? Is it a matter of adding the same scattering shader to each mesh in my scene ?
I tried adding a fog shader to my meshes but the fog colour will obviously not match the sky colour.
I've also tried adding volumetric light scattering as a post-process from this GPU gems but I can't come close to getting the result I'm looking for.

In both cases I end up having my meshes be a distinct colour along the horizon, they do not fade out into the horizon nor do they have all the nice haze above them.

sentences:
Designing Diverse 2D Environment Tilesets Is there an established methodology for designing diverse, quality 2d environment tilesets? I understand creating corners and borders and edges for different terrain types and materials, but I'm at a loss when considering how to make a terrain tileset that accomodates all types of concave edges and convex corners.

For example, the following Tilemap from Chrono Trigger:

They are able to basically create any shape they want with the surface tiles, and the rocky cliffs are perfectly matched.

How do you approach designing such a versatile tileset? Is there a specific set of required tiles that you need to design? Is there a basic terrain shape that should be designed that encompasses all these corners and types of tiles, that is later converted to a proper tileset?

Is it just a lot of artist work, or are there shortcuts?

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:
corona sdk scale images How to scale images to full screen on all devices, i want to use %

The method I've seen so far is to define pixels

image_variable_name = display.newImage( "testimage.jpg", 100, 300 )

I want to do something like

image_variable_name = display.newImage( "testimage.jpg", 100%, 100% )

But that won't work, I want something like fluid CSS, the image will maintain the size no matter what is the size of the screen. Is it possible?

sentences: How can I provide a csv file to a player on mobile? It seems many people do this with regards to game data so they recommend userprefs, but I just want the user to have the file in the end, whether this is the Files app on iOS or choosing a folder to save in on Android or even just attaching the file as an attachment to an email that they can send using their preferred mail app or something.

sentences:
Saving Complex Data to File Javascript My game uses lots of complex objects to store game data. (Each block and entity has its own instance of a class)
I am trying to create a saving and loading system, where the user can save game progress to a text file.
But a simple JSON.stringify won't cut it. These objects are very complex and nested, with instances of different classes contained within. (For example, one instance of the Block class may contain multiple instances of the Text class)
I need a way to boil all this meta data down into text. I've tried multiple libraries, but those don't work with my custom classes.
Any advice on this would be super appreciated!
EDIT: An attempt at writing my own method for doing this
function superString(obj) {
let result = "";
for(var property in obj) {
if(Array.isArray(property)) {
  result += superString(property)
}
else if(property instanceof Block) {
  console.log("EXPORTING BLOCK")
  result += property.exportString();
}
else if(property instanceof Entity) {
  result += property.exportString();
}
else if(typeof property === 'object' && property !== null) {
  result += superString(property)
}

else result += JSON.stringify(property)
}return result;
}

sentences:
How do I set shape density in PhysX 3.1? I'm using PhysX 3.1. I need to give shapes different densities (there are several shapes for my single rigid actor). I know that the shape's density can be set by NxShapeDesc::density in PhysX 2.8, but I can't find such an interface in PhysX 3.1.

I know mass properties can be set in PhysX 3.1 just as the snowman example in the SDK. Is there a direct interface to set density for each shape?

sentences:
Unity AudioMixer sets AudioSources to 0 regardless of decibel value My code for the decibel and volume/linear conversion is good already. I just can't figure out why my AudioMixer keeps on setting my AudioSources to 0. I've double checked to see if my decibel value on my AudioMixer is updating. It updates accordingly. But, my AudioSources remain to have a volume of 0 regardless of any update or not.

Any ideas on what could be the problem?

sentences:
Unity3d: Delay between animation cycles trying to create simple 360 rotation animation on 2d object but can't understand delay between animation cycles, please check youtube video with issue:
https://www.youtube.com/watch?v=JlLJLHvnkgo

sentences:
DirectX depth/order render issue I have what appears to be a depth or order rendering problem which I have never seen happen before. My terrain and water are rendered with my displacement shader, and at the moment all other models are rendered with my standard shader, and I am using deferred rendering.
Now, as you can see in the images, I have a sphere that is half cut off, as though d3d thinks that the water is somehow in front of the sphere, which it is not. If I move down to water level, you can see the whole sphere.
If I render the same sphere with my displacement shader, there is no problem at all. If I go into my displacement shader class, and cut out the hull and domain shader stages, then the terrain and water start to do the weird z buffer issue that the sphere is having.
Is there something conceptual anyone can think of without me having to post hundreds of lines of code? However, happy to post code if needed.

Thank you

UPDATE:
I've narrowed it down to the domain shader - the line that physically changes the output triangles' position. When I comment out this line, it solves the problem, although then I have no tessellation. Do I need to do some kind of manual depth writing after changes the position?

Domain Shader:

cbuffer cbDomainInfo
{
    float3 g_vEyePosition;
    float _padding;
};

struct PatchTess
{
    float flEdges[ 3 ] : SV_TessFactor;
    float flInside : SV_InsideTessFactor;
};

struct DomainInput
{
    float4 vPosition    : POSITION;
    float2 vTexcoord    : TEXCOORD0;
    float3 vNormal      : NORMAL;
    float3 vViewVec     : TEXCOORD1;
    float flAlpha       : ALPHA;
};

struct DomainOutput
{
    float4 vPosition    : SV_POSITION;
    float2 vTexcoord    : TEXCOORD0;
    float3 vNormal      : NORMAL;
    float3 vViewVec     : TEXCOORD1;
    float flAlpha       : ALPHA;
};

Texture2D g_texDispMap;
SamplerState g_samSampler;

[ domain( "tri" ) ]
DomainOutput DS( PatchTess input, float3 uvwCoord : SV_DomainLocation, const OutputPatch<DomainInput, 3> patch )
{
    DomainOutput output;

    output.vPosition = uvwCoord.x * patch[ 0 ].vPosition + uvwCoord.y * patch[ 1 ].vPosition + uvwCoord.z * patch[ 2 ].vPosition;
    output.vNormal = uvwCoord.x * patch[ 0 ].vNormal + uvwCoord.y * patch[ 1 ].vNormal + uvwCoord.z * patch[ 2 ].vNormal;
    output.vTexcoord = uvwCoord.x * patch[ 0 ].vTexcoord + uvwCoord.y * patch[ 1 ].vTexcoord + uvwCoord.z * patch[ 2 ].vTexcoord;
    output.vViewVec = uvwCoord.x * patch[ 0 ].vViewVec + uvwCoord.y * patch[ 1 ].vViewVec + uvwCoord.z * patch[ 2 ].vViewVec;
    output.flAlpha = uvwCoord.x * patch[ 0 ].flAlpha + uvwCoord.y * patch[ 1 ].flAlpha + uvwCoord.z * patch[ 2 ].flAlpha;

    output.vNormal = normalize( output.vNormal );

    float flMipInterval = 20.f;
    float flMipLevel = clamp( ( distance( output.vPosition, float4( g_vEyePosition, 1.f ) - flMipInterval ) ) / flMipInterval, 0.f, 6.f );

    float flHeightMap = g_texDispMap.SampleLevel( g_samSampler, output.vTexcoord, flMipLevel ).r;

    //TODO: Pass in height scale via cbuffer
    //This next line causes the problem:
    output.vPosition += float4( ( 20.f *( flHeightMap - 1.f ) ) * output.vNormal, 1.f );

    return output;
}

sentences:
Place actors that attach to other actors and simulate physics as a single object I'm super new to UE4. I'm making a block-based building game (I know, I know) in which I want to place actors (blocks) that can "attach" to another actor(block), and then simulate physics as a single object - become one object, rather than say, garys mod welding, which I definitely don't want.
Im looking for pointers rather than specific code - to be honest I have no idea where to start with this. My plan is to create some kind of a blueprint that can be hold multiple blocks,  called a structure, but even this I'm not sure how to go about. About all I have working currently is spawning actors in during run time

sentences:
Game Loop and Animation states/frames I just wanna be straighforward. I read a dozen of articles talking about game loop, components, modules, structures, time control, etc...

But, in the end I'm still somewhat confused of how animation actually takes place in the game flow...

Explicitly: Each time the render() assumes command It may render (say) a player sprite (in 2D game). The player "animations" would be expanded in a spritesheet (?) and player object may hold it's state and frame. Say "running" frame 'n'. So the render will render that sprite.

Is that it?

If so, how should I control the actual frame when using a time based game loop (for fps control)?

How do I sinc that with the update variables (x and y position) of the player itself. That will mean that the character will "slide" until next frame (in a walking sequence)...?

Comments, pseudo-codes and maybe a link to a more deep-in article concerning these issue is appreciated... ;)

Thx,

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:
Compare responsibility among copy-left license I have checked out many source about the free and open source licenses (Wikipedia), but what I really want to know what is our responsibility when we use the open source that has these licenses.
For example:

Zlib:
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgement in the product documentation would be appreciated but is not required. (from Irrlicht's readme.txt file)

LGPL:
dynamically linking to it from a closed source app is allowed, but also means any changes made to soft (which has LGPL) itself do need to be made available publicly. (source: from a comment)

GPL: The license for libmad is GPL, which means that in order to use it your application must also be GPL (source: from SDL Mixer README.txt file)

Please make a quick compare like that so I can understand fully about my responsibly when I use an open source software for my project.

PS:
In this question, I like to limit the comparison to the most popular copy-left licenses:

Apache License
BSD License
GNU General Public License
GNU Lesser General Public License
MIT license
zlib/libpng license

sentences:
What would cause my graphics to stop updating when the mouse is moving? I'm learning metro development with c++, DirectX, win8 CP, vs11 beta. I've come across some unexpected behavior:

Running the tutorial series ( Direct3D Tutorial Sample 1 ), and any sample or app for that matter, If I'm watching motion on the screen such as the cube slowly rotating, and I move the mouse, the object stops updating/rotating until I stop moving the mouse.

Here is a very short video of what I mean: http://www.screencast.com/t/cEHkVUaRcw

It even does this with the shooting sample game, which is very mouse intensive. It makes all the motion very jumpy.

I believe it has something to do with the system. I can interrupt the dispatcher from processing messages and it stops manifesting this behavior so it feels like the computer is so busy processing messages that it can't keep up with the rest of the updating. But this problem only started recently so I do not believe it is a problem with my computer's processing power.

Has anyone else experienced this and know how to resolve it or does anybody have an idea into why this is going on?

Here is the game loop code that MS ships with the sample.

while (!m_windowClosed)
{
    timer->Update();
    CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
    m_renderer->Update(timer->Total, timer->Delta);
    m_renderer->Render();
    m_renderer->Present(); // This call is synchronized to the display frame rate.
}

Thank you.

sentences:
Swapping a mesh from MCS female to a custom mesh I'm trying to swap a mesh from the MCS female CBJacket with a custom mesh that's supposed to be a lab coat. But it keeps turning in to a ball of spiky mesh! I made sure the avatar and armature for the custom fbx was the same as the official one but i'm not getting any where with this problem.

any help (as always) is greatly appreciated

sentences:
Adding Score to score canvas after collision Simply a player has to move through pipes falling down, once the player moves through the gap it should add a score and increase the scoring after each pipe the player goes through, pretty basic.

I have made a prefab object and it is a block with a collider on it and another collider that acts as a trigger behind it stretched out so it can be accessed on both sides. I then added to the main scene canvas >> textmeshpro>>> added a script with the following code however, when the player hits the collider the score does not increase in the scene. But if I remove the GetComponent then it increases by increments of 4 in the inspector.

using System.Collections.Generic;
using UnityEngine;

public class Game : MonoBehaviour
{
    public int Score = 0;

    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        GetComponent<UnityEngine.UI.Text>().text = Score.ToString();
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        AddScore();
    }

    void AddScore()
    {
        Score++;
    }
}

sentences:
Help for sorting cars that are 1 lap behind the others (latecomers) Think of 22 cars running in circuit.

I can sort them based on the order they reach the finish line.

I start to have problems, because over time, the faster cars start to reach the slower cars.

Making the cars slower latecomers/laggards/lapped (blue flag in F1).

Event (collision car with finish line):

other.position[other.collision]=pilot;
other.lap[other.collision]=timeLap;
other.timeTotal[other.collision]=timeTotal;
other.collision+=1;

if(other.collision>22){
    other.collision=1;
}

OBS - The collision event (shown above) is performed on the car. Every variable (other.) Is because it belongs to the finish line.

I use a variable that serves to define which array index will be defined (other.collision).

Draw Event (Finish Line):

repeat(22){
    draw_text(1280,100+(20*(i-1)),string(position[i]));
    draw_text(1430,100+(20*(i-1)),string(lap[i]));
    draw_text(1530,100+(20*(i-1)),string(timeTotal[i]));
    i+=1;
}

i=1;

What happens is that when the first car overcomes the last one, it ends up having the index 22. Becoming the last and vice versa.

I tried to use the time, but the faster car does more turns in less time. Time equals or does not work correctly. So I would also have to use the amount of laps.

That's when I got completely confused.

I am trying to use arrays to order them with the bubble sort, but I didn't get anything functional..

I tried a few more things, but I got lost and I don't even know how to explain it to you.

sentences:
Why and how should I cast DirectX function parameters? I'm learning DX11 and I found that in some D3D functions, a parameter has to be cast just like in the GetBuffer function of the swapChain: the third parameter has to be of type void*, so when calling this function the conversion is done just writing (void*) before, a C conversion if I'm not wrong.

But in other functions with a pointer like type** (where type IS NOT void) is used the reinterpret_cast. I wanted to know if the difference is because of the void type respect to the other types and, if it's not because of the void type, when should I use (type**) and when should I use reinterpret_cast.

sentences:
How to map gamepad inputs for my platformer? With keyboard+mouse controls, we seem to have an unspoken control mapping standard, with keys be like WSAD for moving, E for use, mouse button for attacks or interactions, spacebar for jumping, and so on. But I'm unsure what conventions apply to gamepads.
I'm doing the typical platformer game, so my input would be:

movement
sprinting
jumping
attack
interacting
accessing main menu
accessing inventory menu.

How can I map these actions to a gamepad's buttons/sticks in a way that will be intuitive for my players?

sentences:
Running Unity development build in Android emulator without signing I am working on project with a friend who uses Windows while I am using Ubuntu. We are using Unity collaborate and it's going fine except when we want to build.

The keystore is in his filesystem, D:/Programs -Work/Game Dev/Keystore/user.keystore and I can't replicate his path.

Also, when I try to do a development build and run, it fails because Unity says the apk isn't signed, contrary to this article which says that development builds do not need to be signed.

So this leads to two questions:

Is there any way to build from both devices?
Is there any way to emulate the game on android emulator?

sentences:
Getting error when I Send a message to the RaycastHit object I have created a shooting game, here when I am shooting I have a c# script for damage for enemies.I have Used Raycast to Shoot enemies.if the RaycastHit becomes an enemy, it will be deducted it's health.It works properly.But the thing is, If I shoot objects except enemies it causes an error.
I have provided some details about that.this is the script,

public class DamageSMG : MonoBehaviour
{
    public int DamageAmount = 5;
    public float TargetDistance;
    public float AllowedRange = 50;
    public RaycastHit Shot;
    public int Firing;
    void Update()
    {
        if(Input.GetButton("Fire1")){
            if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward),out Shot))
            {
                TargetDistance = Shot.distance;
                if (TargetDistance < AllowedRange)
                {
                    if (Firing == 0)
                    {
                        Deduct();
                    }
                }
            }
        }
    }
    public void Deduct()
    {
        Firing = 1;
        Shot.transform.SendMessage("DeductPoints", DamageAmount);
        StartCoroutine(Wait());

    }
    IEnumerator Wait()
    {
        yield return new WaitForSeconds(0.1f);
        Firing = 0;
    }
}

I am using an machine gun.therefore I have created Script to fire coutinously with 0.1sec break.When I press Fire1 button, The RayCastHit Object is received a message where the method called DeductPoints with the DamageAmount.As this Script my enemies are deduct point 5 by 5 every hit.Then Destroy the object.The Enemy script is this.

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

public class EnemyScript : MonoBehaviour
{
    public int EnemyHealth = 20;
    void DeductPoints(int DamageAmount)
    {
        EnemyHealth -= DamageAmount;
    }

    // Update is called once per frame
    void Update()
    {
        if (EnemyHealth <= 0)
        {
            Destroy(gameObject);
            GlobalScore.GlobalScorecount += 1;
        }

    }

}

But my problem is when I shoot objects except Enemies(Ex: walls),The console gives an error.The error is like this
SendMessage DeductPoints has no receiver
How can I solve this error or is there any other way of Deducting enemy health with raycast?
I can play the game with this error in UnityEngine.but it is not possible to Build the game.Please help me to Solve this..

sentences:
Why is Particle System Not Visible Without Scene Window Viewing the Origin? I have a particle system, which is supposed to be highlighting an important game object, but the Particle System doesn't show on the game window unless the Scene window camera has the Origin (0,0,0) in view. The origin is at the corner of my UI canvases, in which you can see the two white lines marking the edges.

Take a look at these screenshots. On the 1st screenshot, the particle system is not visible. The 2nd screenshot was taken just moments later and the particle system is completely visible (and the number of particles is as if it had already been emitting the whole time.) The only difference is that I slightly rotated the camera of the Scene Window in between screenshots.  The camera was rotated down just a tiny bit to put the origin visible in the scene view.

The particle system immediately becomes visible on the game window as soon as I rotate the SceneView camera so that the Origin is in view.

This is Unity version 5.6.0f3.

There are other questions about particle systems not working, but the cause and solutions appear to be very different.

Here are things I've already tried:

The particle system is already set to "Play on Awake" both before and
after rotating the camera.
I've ensured that all of components and game objects are visible and
enabled both before rotating toward the origin and after.
All of the particle settings (size, etc.) are correct both before
rotating to the origin and after.

Why is the particle system not visible without the origin in the scene view?

sentences:
Different ways to store a 2D map/landscape in XNA I was looking around at this site about eight months ago and wish I saved the location of this topic but I was wondering the different map rendering styles that you can do in XNA.  The one style I looked at was using a text file to pull characters like "X" would be a monster and "O" would be the player.  Is there another way with out an external file that I can put tiles from a sprite sheet to randomly create a map.  Of course when dealing with random buildings I would have certain building designs so that if some one was playing they wouldn't see a building with half a wall missing.

This is for a top down 2D game.

sentences:
DataPath error when loading images on Android So yesterday i was trying to load some textures asynchronously and managed to make this
 private IEnumerator GetTextureFromPath(string _dirname)
    {
        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + _dirname + "/"  ,"*.jpg");
        Debug.Log("data Path" + Application.persistentDataPath);
        source = new Texture2D[fileNames.Length];
        Array.Sort(fileNames, (s1, s2) => Path.GetFileName(s1).CompareTo(Path.GetFileName(s2)));
        int index = 0;
        Debug.Log(fileNames);
        foreach (var fileName in fileNames)
        {
            UnityWebRequest webRequest = UnityWebRequestTexture.GetTexture(fileName);
            while (!webRequest.isDone)
            {
                yield return webRequest.SendWebRequest();
            }
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                Debug.Log(webRequest.error);
            }
            else
            {
                source[index] = ((DownloadHandlerTexture)webRequest.downloadHandler).texture; //LoadTextureFromPath(fileName);
                source[index].name = fileName;
                index++;
                Debug.Log("Ends server comm");
            }
        }
    }

now once i use it like this i get errors on the mobile build
2021/05/27 14:44:03.305 16476 25662 Error Unity Curl error 7: Failed to connect to localhost port 80: Connection refused

which i also tried by replacing ((DownloadHandlerTexture)webRequest.downloadHandler).texture with LoadTextureFromPath(fileName) and that cannot find the path which exists in my device and in that exact path. in the filder LevelAnimals are images which i want to load
DirectoryNotFoundException: Could not find a part of the path '/file:/storage/emulated/0/Android/data/com.FocusPoint/files/LevelAnimals'.

i found out after googling a bit that i might need to use "file///" or "file//" before the path but that didnt work either.
This script works on the editor and does the job that its supposed to do but it does not load the images on the device build.
now the LoadTexture is this
 public Texture2D LoadTextureFromPath(string path)
    {
        if (string.IsNullOrEmpty(path))
        {
            Debug.LogError("Texture path is null or empty");
            return null;
        }

        if (!File.Exists(path))
        {
            Debug.LogError($"File not found: {path}");
            return null;
        }

        byte[] bytes = File.ReadAllBytes(path);
        Texture2D texture = new Texture2D(2048, 2048, TextureFormat.RGB24, false);
        texture.LoadImage(bytes);
        Debug.Log("success");
        return texture;
    }

Any help would be appreciated thank you!

sentences:
Model texture flipped? Im making a custom Wavefront .obj loader and the images loads but the texture is flipped. What is the problem? here is code and a image.

std::vector<UINT> vertexIndices, uvIndices, normalIndices;
std::vector<UINT> indices(4119);
std::vector< XMFLOAT3> temp_vertices;
std::vector< XMFLOAT2 > temp_uvs;
std::vector< XMFLOAT3 > temp_normals;
std::vector< XMFLOAT3> out_vertices;
std::vector< XMFLOAT3> out_normals;
std::vector< XMFLOAT2> out_uvs;
std::vector<Vertex::Basic32> vertices( 4119);
const char *path = "C:\\Users\\terry\\Desktop\\untitled.txt";

FILE * file = fopen(path, "r");
if( file == NULL ){
    printf("Impossible to open the file !\n");
    return;
}

while( 1 ){

    char lineHeader[128];
    // read the first word of the line
    int res = fscanf(file, "%s", lineHeader);
    if (res == EOF)
        break; // EOF = End Of File. Quit the loop.

    // else : parse lineHeader

    if ( strcmp( lineHeader, "v" ) == 0 ){
    XMFLOAT3 vertex;
    fscanf(file, "%f %f %f\n", &vertex.x, &vertex.y, &vertex.z );
    temp_vertices.push_back(vertex);
    }else if ( strcmp( lineHeader, "vt" ) == 0 ){
    XMFLOAT2 uv;
    fscanf(file, "%f %f\n", &uv.x, &uv.y );
    temp_uvs.push_back(uv);
    }else if ( strcmp( lineHeader, "vn" ) == 0 ){
    XMFLOAT3 normal;
    fscanf(file, "%f %f %f\n", &normal.x, &normal.y, &normal.z );
    temp_normals.push_back(normal);
    }else if ( strcmp( lineHeader, "f" ) == 0 ){
    std::string vertex1, vertex2, vertex3;
    unsigned int vertexIndex[3], uvIndex[3], normalIndex[3];
    int matches = fscanf(file, "%d/%d/%d %d/%d/%d %d/%d/%d\n", &vertexIndex[0], &uvIndex[0], &normalIndex[0], &vertexIndex[1], &uvIndex[1], &normalIndex[1], &vertexIndex[2], &uvIndex[2], &normalIndex[2] );
    if (matches != 9){
        printf("File can't be read by our simple parser : ( Try exporting with other options\n");
        return;
    }
    vertexIndices.push_back(vertexIndex[0]);
    vertexIndices.push_back(vertexIndex[1]);
    vertexIndices.push_back(vertexIndex[2]);
    uvIndices    .push_back(uvIndex[0]);
    uvIndices    .push_back(uvIndex[1]);
    uvIndices    .push_back(uvIndex[2]);
    normalIndices.push_back(normalIndex[0]);
    normalIndices.push_back(normalIndex[1]);
    normalIndices.push_back(normalIndex[2]);
    }
}

 for( unsigned int i=0; i<4119; i++ ){
     unsigned int vertexIndex = vertexIndices[i];
     XMFLOAT3 vertex = temp_vertices[ vertexIndex-1 ];
     out_vertices.push_back(vertex);
     unsigned int normalIndex = normalIndices[i];
     XMFLOAT3 normal = temp_normals[ normalIndex-1 ];
     out_normals.push_back(normal);
     unsigned int uvIndex = uvIndices[i];
     XMFLOAT2 uv = temp_uvs[ uvIndex-1 ];
     out_uvs.push_back(uv);

 }

 for( unsigned int i=0; i<4119; i++ ){
     vertices[i].Pos = out_vertices[i];
     vertices[i].Normal = out_normals[i];
     vertices[i].Tex = out_uvs[i];
     vertices[i].Tex.y = vertices[i].Tex.y * -1.0f;
     indices[i] = i;
 }

sentences:
Android game loop's effect on cpu/battery usage - unexpected results I will try to keep this question as concise and as readable as I can.

I recently came across an odd problem with my Android game that I'm developing.

It's an openGL ES 2.0 game and initially I was using RENDERMODE_CONTINUOUSLY, my gameloop was running on the OpenGL provided rendering thread and I was basically limiting the logic updates (to say, 30 times per second), while letting the rendering run as fast as the device could handle.

Please note that I'm not using thread.sleep() and do not want to as I've read various articles advising against it

Everything works well, but when I ran the game on an old Galaxy Ace phone it was rendering at 85+ Frames Per Second which got me thinking that it could be using more battery than it needed to (because it was rendering frames which didn't need to be rendered as there were no logic updates in-between them).

So what I did was this:

I set RENDERMODE_WHEN_DIRTY, started another thread myself, put my game loop into that thread and from this loop, called update() (For logic updates) and requestRender() (for drawing). I altered the gameloop so that it would only render when there was an update.

Now, the way it stands, If I limit my loop to say, 30 ticks per seconds, then all is good, both rendering and logic run at a smooth 30 tics per seconds.  If things get too much and the device can't handle the rendering, and the frame rate drops (lets say, to 12FPS), then the logic will carry on at 30 times per second which is exactly what I'm after.

Howevever, I've used the CPU Meter in Jellybean and it would appear that the first option (2 threads, rendering flat out) is more CPU (and therefore, I assume battery) efficient that the 2nd method (3 threads, but with rendering limited).

I'm trying to figure out why this would be?

Please note that I can't test the CPU usage on the Galaxy Ace phone as it doesn't run jelly bean, but certainly on my Nexus 10 tablet, the CPU usage is more when using the 3 threaded approach.

I understand that now, my loop still 'loops', even when it has no updates or rendering to do (never sleeping), but this was the case in the first loop too (well, when it had no updates, it would carry on rendering regardless).

So what gives here?

Note: I haven't posted code as it's not really relevant to the question. But if you want to see the loop, please ask and I will post - thanks

With OpenGL, am I best to just leave the device to render as fast as it can?  That certainly seems to be the way it's been set up (at least when using RENDERMODE_CONTINUOUSLY)

sentences:
How to write shaders that can be compiled for DirectX, OpenGL, and Vulkan I recently finished writing the DirectX renderer for my game engine.
Now I have an OpenGL, DirectX as well as a not yet finished Vulkan renderer.
Well, the majority of the renderers work perfectly now but I have a problem: I need a shader programming language.
The problem is that OpenGL and Vulkan use GLSL but DirectX uses HLSL (and Apple's Metal API uses MSL). So I searched for a High Level Shader Language and found only C for graphics from NVIDIA. But since this project was deprecated I looked for something else: Without success.
It's a bit annoying to write for 3 shader programming languages at the same time, so I'm looking for a language that can be translated into the native language immediately when the game starts (or is simply compatible with a lot of rendering APIs)
After several weeks of finding nothing, I decided to write my own language for it. But before I invest too much time I want to know if there is another solution to this problem.

sentences:
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 to rotate a triangle to look at a point? Lets say I have a triangle defined by 3 vertices and a center point, how do I rotate the triangle so its normal is looking at a specified point?

sentences:
How to store ever-expanding maps with top-bottom, left-right hierarchy? I'm writing a game that will largely take place on only a screen-worth of hexagons, but which will require map to expand in every direction. Also the way I want to display those hexagons requires that I have to be able to iterate over them in order from top to bottom, left to right.

I have already written coordinate system, which can represent coords as 2d (axial) or 3d (cube). The system regards (0, 0) as the center hex, so it means I need to store negative coords as well.

What I don't have is data structure that fufills my needs.

I'm thinking about writing a data structure myself, which will consist of 4 two-dimensional vectors (each for one quadrant of the map in regards to positive/negative) that would be able to get hexes in order I want, but this solution (using 4 vectors) seems unintuitive and long to write.

So is there a simpler, possibly already implemented, way?

sentences:
How does this example make efficeint voxel engines using "chunks"? I'm currently looking in to how voxel engines works, with a view to possibly making one, myself. I see a lot of material, like "Let's Make a Voxel Engine", which talks about how to go about reducing the draw calls. What I can't seem to understand is how it actually saves draw call counts, on the basis of the logic being something like the following:

// Without chunks:

foreach voxel in myvoxels
  DrawIfVisible()

// With chunks:

foreach chunk in mychunks
    DrawIfVisible()

    // which then does ...
foreach voxel in myvoxels
    DrawIfVisible()

Surely, you save nothing by doing this; you still make a draw call for each visible voxel, and a visible voxel needs a draw call in either scenario. The only real saving I can see is that the logic that evaluates a chunk will be able to determine if a large number of voxels are visible or not, effectively, saving a bit of "is this chunk visible" CPU time. It's the draw calls that interest me; the fewer of those, the faster the application.

In case it makes any difference, I will probably be using XNA with DirectX for my engine, so don't consider my choice of example in the link above as my choice of technology. However, this question is such that I doubt it would matter.

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:
MultiSwipe in Libgdx I have some trouble with my GestureListener class i think. I'm just trying to detect swipe on two half screen. I'm creating two InputListener but I can't add them to InputMultiplexer. Actually, I added with no trouble but it is not working as how I wanted. How can I detect two swipe(fling or pan whatever) events simultaneously ?

Maybe this picture will help you that you understand it.

EDIT : It's from my Player1 class and the other class' contents are the same. (Player2)

private void listenInputs() {

    inputProcessor = new InputProcessor() {

        @Override
        public boolean keyDown(int keycode) {
            return false;
        }

        @Override
        public boolean keyUp(int keycode) {
            return false;
        }

        @Override
        public boolean keyTyped(char character) {
            return false;
        }

        @Override
        public boolean touchDown(int screenX, int screenY, int pointer, int button) {
            if (canMove) {
                lastTouch.set(screenX, screenY);
                firstD = screenX;
            }
            return true;
        }

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

        @Override
        public boolean touchDragged(int screenX, int screenY, int pointer) {

            Vector2 newTouch = new Vector2(screenX, screenY);
            distance = screenX - firstD;

            if (firstD < CarcleGame.HALF_SCREEN) {
                if (Math.abs(distance) > 20) {
                    if (canMove) {
                        canMove = false;
                        Vector2 delta = newTouch.cpy().sub(lastTouch);
                        if (delta.x > 0.7f)
                            move(true); // if it's true then go to the direction right, else go left
                        else if (delta.x < -0.7f)
                            move(false);

                        lastTouch = newTouch;
                    }
                }
            }
            return true;
        }

sentences:
Unity 'Collider.bounds.Intersects'. Does it handle rotation? You will probably laugh at my code here (and I would love to hear some completely different approaches to this problem if possible), but I've written this myself using the only logic I could come up with alone.
Basically I want to make a slope randomly covered with trees. The slope is a quad with a mesh collider (I've also tried Box), and the tree is a prefab with just a model and a collider.  I iterate through every possible tree location and give it a 0.25 chance of spawning a tree. This all works ok, but since the quad is not lying flat to any axis, I couldn't think how best to assign the Y-position value to my trees.
My idea was to simply drop the trees all from above and have them land in the quads collider. If I lay the quad flat my code will work fine, but as soon as I tilt the slope the collision is still detected. It seems as if its reading the top of the quads highest point and making a box around it all the way to the bottom.
This is the code:
        for (int i = 0; i < trees.Count; i++)
        {
            if (!trees[i].GetComponent<Collider>().bounds.Intersects(ski_slope.GetComponent<Collider>().bounds))
            {
                Debug.Log("moving tree");
                trees[i].transform.Translate(0, -0.2f, 0);

            }
        }

So really I think my use of the 'Intersects' function must be wrong.
I hope my description of the problem makes sense. Otherwise I can take some screenshots to try show it.
Thank you for any help.

sentences:
Find the co-ordinates of collided objects in Python I have a group containing my aliens and another containing the bullets I have fired. When I detect their collisions, I want to pull the alien's x-y co-ordinates during it's deletion so I can put an explosion animation in that location. How do I achieve this? My attempts so far give an error saying group items cannot be indexed.

This is my first real coding project - so still new. I'm using Pygame to make the game.

Current collision detection code:

def check_bullet_alien_collisions(ai_settings,screen,stats,sb,ship,aliens,bullets,bombs):
"""Respond to bullet-alien collisions"""

collisions = pygame.sprite.groupcollide(bullets,aliens,True,True)

#Collect X-Y co-ordinates here

if collisions:
    for aliens in collisions.values():
        stats.score += ai_settings.alien_points * len(aliens)
        sb.prep_score()
        stats.aliens_hit += 1
        stats.calc_accuracy()
        sb.accuracy()
    check_high_score(stats,sb)

sentences:
Tetris : Effective rotation I rotate each piece by rotation formula. More detail, because rotation angle is 90 so :

xNew = y;

yNew = -x;

But my method has met two problems :

1) Out of box : each type of pieces is fit in square 4x4. (0,0 at under left) But by this rotation, at some case they will out of this box. For example, there is a point with coordinate (5,6) So, please help me how to fit these coordinate into 4x4 box again, or give me another formula for this.

2) at I case : (4 squares at same row or same column), just has two rotations case. but in method above,  they still has 4 pieces. So, how to prevent this.

Thanks :)

sentences:
Are there any issues with not drawing to all render targets when using MRT? Lets say I set 2 render targets:

device.SetRenderTargets(color, depth);

And then half my draw code only outputs color and not depth. This works fine on the PC and produces the expected results however I feel like this might be an issue on the Xbox.

Are there any issues I should be aware of when using MRT while only outputing to one render target?

sentences:
How can I shoot when I touch the Box Collider I want to change the Computer Input to Mobile Touch Input, if I press Space Button it shoots but how do I change this [Code] to Touch Input ?

I want it to have it into void OnTouchDown() but what do I have to put into the if(...) in the ShootingScript if I want to have it for Mobile to work ?

Here is my Shooting Script and my Player Controller Script

ShootingScript:

public GameObject shootingBullets;

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown (KeyCode.Space))
    {
        Instantiate(shootingBullets, transform.position, Quaternion.identity);
    }
}

PlayerControllerScript:

public float jumpHeight;

void OnTouchDown()
{
    if (GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody2D>().velocity.y < 0.001f && GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody2D>().velocity.y > -0.001f)
    {
        GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody2D>().AddForce(Vector2.up * jumpHeight);
    }

}

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown (KeyCode.UpArrow) && GetComponent<Rigidbody2D>().velocity.y < 0.001f && GetComponent<Rigidbody2D>().velocity.y > -0.001f)
    {
        GetComponent<Rigidbody2D>().AddForce(Vector2.up * jumpHeight);
    }

    if (Input.GetKeyDown (KeyCode.DownArrow))
    {
        GetComponent<Rigidbody2D>().AddForce(-Vector2.up * jumpHeight);
    }

}

sentences:
How to rotate a sprite on touch/drag done on the screen wih Andengine? when I look at the andengine examples I saw an example about rotate a sprite with joystick. Here is the code;

    final float y2 = (this.mPlaceOnScreenControlsAtDifferentVerticalLocations) ? 0 : y1;
    final float x2 = CAMERA_WIDTH - this.mOnScreenControlBaseTextureRegion.getWidth();
    final float x1 = 0;
    final float y1 = CAMERA_HEIGHT - this.mOnScreenControlBaseTextureRegion.getHeight();
    final AnalogOnScreenControl rotationOnScreenControl = new AnalogOnScreenControl(x2, y2, this.mCamera, this.mOnScreenControlBaseTextureRegion, this.mOnScreenControlKnobTextureRegion, 0.1f, this.getVertexBufferObjectManager(), new IAnalogOnScreenControlListener() {
        @Override
        public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl, final float pValueX, final float pValueY) {
            if(pValueX == x1 && pValueY == x1) {
                face.setRotation(x1);
            } else {
                face.setRotation(MathUtils.radToDeg((float)Math.atan2(pValueX, -pValueY)));
            }
        }

        @Override
        public void onControlClick(final AnalogOnScreenControl pAnalogOnScreenControl) {
            /* Nothing. */
        }
    });

That is okay for joystick BUT I want to implement this without joystick.. I mean when user drag/slip the screen with finger than sprite will also rotate according to finger movement. By the way I only want to rotate NOT move.. And here is code that I try to;

mScene.setOnAreaTouchListener(new IOnAreaTouchListener() {

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                ITouchArea pTouchArea,final float pTouchAreaLocalX,
                final float pTouchAreaLocalY) {
            if(pTouchAreaLocalX == x1 && pTouchAreaLocalY == x1) {
                face.setRotation(x1);
            } else {
                face.setRotation(MathUtils.radToDeg((float)Math.atan2(pSceneTouchEvent.getX(), -pSceneTouchEvent.getY())));
            }
            return false;
        }
    });

and my code didn't work.. Is there any suggestion ? Thanks...

sentences:
How can make an object orbit a sphere in a random direction? How can I move an object on a random orbital path around a sphere?

I've created some objects at an initial position that is essentially a random point on the sphere offset by some distance (say, 10.0).

Now I want to choose a random direction and have the object orbit the sphere in that direction. How can I accomplish that?

sentences:
When two moving objects collide, which one sends the message, and which one recieves it? I am writing a platform game using an entity-component system. Entity-World collisions are robust and work very well, and I'm now working on collisions between entities.

Just to be clear, in my code an Entity is a collection of Attributes (data) and a collection of pointers to Components (logic).

My Entity class has a sendMessage(messageType type, char* messageData) member function, which adds the messageType and messageData to a queue which is then used by the component interested in that message type. So in this example CollisionMessage is used by CollisionComponent and processed at the end of the tick with other messages (after normal collision checks).

My problem is that with every collision, I have two messages sent per collision, from each Entity to the other. This means that either I need to halve the forces I apply since it applies to each entity twice or I need to set up some Entities to only send collision messages and some to only receive collision messages.

So far things work fine when a player collides with an item, as it just gets picked up and removed from the world, but collisions between players and enemies are proving troublesome.

Is there a better way, or is there anything fundamental I've missed?

Thanks.

sentences:
Making object move in an angle I have a game with a beat-em-up perspective (think Final Fight, Streets of Rage) where movement is in X and Z. My movement logic consists of checking controller input of X-axis for X movement and Y-axis for Z movement. I use this logic to move enemy as well, using this method:

internal bool MoveTowardsPosition(Vector3 targetPosition)
{
    bool reachedPosition = false;
    bool reachedX = false;
    bool reachedZ = false;

    // Determine x direction
    if (Mathf.Round(Mathf.Abs(targetPosition.x - _enemy.transform.position.x)) > 0)
    {
        if (targetPosition.x < _enemy.transform.position.x)
            Input.HorizontalMove = -1;
        else
            Input.HorizontalMove = 1;
    }
    else
        reachedX = true;

    // Determine z direction
    if (Mathf.Round(Mathf.Abs(targetPosition.z - _enemy.transform.position.z)) > 0)
    {
        if (targetPosition.z < _enemy.transform.position.z)
            Input.DepthMove = -1;
        else
            Input.DepthMove = 1;
    }
    else
        reachedZ = true;

    if (reachedX && reachedZ)
        reachedPosition = true;

    return reachedPosition;
}

So what happens here is that given a target position, I add to the HorizontalMove (X) and DepthMove (Z) until the enemy reaches the destination (these X and Z additions will be read on Update to do a transform.translate()). The enemy does move to the destination but in a unnatural path. So when Z is larger, it will reach the destination X first then traverse Z. So for example, X=2 and Z=5, it'll traverse with a path like this:

What I'm trying to do is for it to traverse a path like this:

I figured instead of adding fixed 1/-1, I need to determine X and Z based on that angle but I'm lost on how to compute/do it. Can you guys lend me a hand, please?

sentences:
Find format of data from Steam API using Python I have some user data downloaded using the Steam API (I am following the approach described here) and I need to find the format for each entry of the CSV file I generated (available here).
Using Python, the solution I came up with is the following:
import pandas as pd
import sys

df1 = pd.read_csv("./data/csgo_cheater_data_01_14_21_full.csv")
for ii in range(189):
    print(df1.columns[ii], type(df1[df1.columns[ii]].values[0]))

Running this snipped, the result is that most variables are float64, plus a few int64. Does it make sense? Is this the real format of the data or are they somehow converted when retrieved using the API?

sentences:
Aspect ratio of drawn quad messed up after rotating When I draw a quad that is rotating the aspect ratio of the quad gets messed up and the size changes.

Gif of what is happening

I am confident it has something to do with the way I calculate the size because that is relative to the width and height of the screen, I just don't know why the aspect ratio would change since the aspect ratio of the screen doesn't change.

Code of transformationMatrix creation:

        Matrix4f matrix = Maths.createTransformationMatrix(
                new Vector2f(
                        gui.getPosition().getX() / Display.getWidth() * 2 - 1 + gui.getSize().getX() / Display.getWidth(),
                        -gui.getPosition().getY() / Display.getHeight() * 2 + 1 - gui.getSize().getY() / Display.getHeight()
                ), gui.getRotation()
                ,new Vector2f(
                        gui.getSize().getX() / Display.getWidth(),
                        gui.getSize().getY() / Display.getHeight()
                )
        );
        shader.loadTransformation(matrix);

The x size, y size, x position and y position are in pixels, if you put in 1600 pixels for x position and the screen is 1600 pixels wide it will fill the whole screen. The calculation that is done here will translate those sizes to a value that the shaders will display on the screen.

I had tried calculating the sizes in a different way:

gui.getSize().getX() / (float) (Display.getWidth() * Math.abs(Math.cos((Math.toRadians(gui.getRotation())))) + Display.getHeight() * Math.abs(Math.sin((Math.toRadians(gui.getRotation()))))),

but this does not work at all, my thought process was that if it is sideways it should use Display.getHeight to calculate the x size and if it is vertical it should use Display.getWidth. This does work for 0, 90, 180 and 270 degrees rotation, but in between it gets smaller and weird. Of course I've also done this for the x position but then cos and sin switched around.

video of this method

And this is the createTransformationMatrix method:

public static Matrix4f createTransformationMatrix(Vector2f translation, float rotation, Vector2f scale) {
    Matrix4f matrix = new Matrix4f();
    matrix.setIdentity();
    Matrix4f.translate(translation, matrix, matrix);
    Matrix4f.rotate((float) Math.toRadians(rotation), new Vector3f(0, 0, 1), matrix, matrix);
    Matrix4f.scale(new Vector3f(scale.x, scale.y, 1f), matrix, matrix);
    return matrix;
}

sentences:
How to Find Collision Reflection Vector on a Sphere I have a game I'm building in Unity with some objects orbiting a sphere via rotating around a pivot point (0,0,0) at a radius of 10 units on the z-axis. The orbiting objects all have the same velocity. This all works great, but now I need to add a bouncing effect when they run into each other so they start orbiting in a new direction when colliding.

I am currently detecting a collision between two orbiting objects, and trying to determine the resulting reflection vector of the collision. The orbiting objects all have sphere colliders on them.

Here is a relevant code example for how I am orbiting the objects:

var velocity = 15f;
var directionVector = new Vector2(Random.Range(-1f, 1f) * velocity, Random.Range(-1f, 1f) * velocity);
transform.Rotate(directionVector.y * Time.deltaTime, -directionVector.x * Time.deltaTime, 0.0f);

Here is how I am currently trying to reflect the collision on the directionVector:

var bounceVector = Vector3.Reflect(transform.forward, collider.gameObject.transform.forward).normalized;
directionVector.x = bounceVector.x * velocity;
directionVector.y = bounceVector.y * velocity;

This does cause the objects to "bounce" off of each other, but the bounce direction doesn't seem right, so I have something screwed up. I also feel like this probably doesn't even matter that it's on a sphere because all I need to do is take two direction vectors and find their resulting reflection vector on a collision. Any thoughts?

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:
Looking for a market price algorithm for a turn based game I am new at game development and am now facing the problem for a market price algorithm in a turn based game.
What I try to achieve:

the market starts with fixed bidding and asking prices for one piece of goods. To keep it simple the minimum value is 1, the maximum 20
if the user buys/sells the same goods in too large quantities in a certain amount of turns, the prices should rise/drop; simple supply and demand logic. The maximum amount of a goods per transaction is 100
if the user doesn't trade that good for a few turns, it should adjust the price in the other direction
there are certain type of goods that can be "easily" produced by the player and are thus sold and some that are harder to get by and are usually bought.
the market can sell each good infinitely and would also buy everything, so it has no stock to take into account.

What I tried and didn't work:

if the accumulated quantity of bought/sold good reaches 500 (I use negative values for buying) the price rises or drops by 1 respectively
to factor the turns into it, I thought I just reduce the accumulated value by 10 each turn and then adjust the price if it reaches 0 again. This has one big flaw, as you can easily cheat by just selling a small amount, wait a few turns and the price will rise; repeat until the price reaches the maximum of 20.

Any simple ideas on how to fix this?
ps. I hope this is an appropriate question to ask here

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:
Unity Application.LoadLevel freezes the game on Android device I'm developing a game using Unity. The game has a single level and after the player wins/loses, I simply want to reload the same scene. Here's the code I'm using:

private void OnLevelFailed()
{
    IsGameStarted = false;
    Debug.Log("LEVEL FAILED");
    Invoke("RestartLevel",5);
}

void RestartLevel()
{
    Application.LoadLevel(Application.loadedLevelName);
}

When running this code on the editor, everything seems fine and the scene reloads as intended. However, when I build the game for Android and run it on a device (an LG G3), the game simply freezes. I used adb logcat to see the logs of any exceptions or errors if there were any but to no luck. I also suspected if the Invoke call was causing the problem and replaced it with simply the method call, but that didn't solve the problem either.

Anyone have any idea why this might happen?

sentences:
Physics2D raycasting with a perspective camera and tilted sprites So i ran into this problem today. I want to have a perspective camera and sprites that are rotated by lets say 1.5 on the X axis. The problem is that the 2D raycast does not work correctly, it returns the wrong colliders. Here is the implementation:

Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(mousePos, Vector2.up);
            if(hit.collider)
            {
                Debug.Log(hit.collider.gameObject.name);
            }

Now if my  camera is orthographic everything works great. How can I make it work with a perspective camera? Should I use 3d colliders and raycasts ?

sentences:
Respawn not working properly upon scene reload. Why is this? So I made a respawn function and what is supposed to happen is the script it supposed to load a saved checkpoint. However I need to reset the scene (and again this worked just fine last night which was odd...).

Essentially the checkpoint waits for a player and then when the player enters the current checkpoint is written to a .txt file. Upon reload or death the scene is restarted, the .txt file is read and grabs the checkpoint. Everything works fine without Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); //Reload scene. but I need that in order to "refresh" the scene.

CheckPoint Code:

using UnityEngine;
using System.Collections;

public class Checkpoint : MonoBehaviour {

    public LevelManager levelManager; //Empty level manager.

    // Use this for initialization
    void Start()
    {
       //levelManager = FindObjectOfType<LevelManager>(); //Unnneeded
    }

    void OnTriggerEnter(Collider coll)
    {
        if (coll.tag == "Player")
        {
            //levelManager.currentCheckPoint = gameObject; //<-DISABLE WHEN ES2 is fixed!!!
            Debug.Log("Activated Checkpoint " + transform.position);
            ES2.Save(gameObject.name, "myFile.txt?tag=checkpoint"); //Saves checkpoint to file.
        }
    }
}

LevelManger Code:

using UnityEngine;
    using System.Collections;
    using UnityEngine.SceneManagement;

    public class LevelManager : MonoBehaviour {

        [Tooltip("Note this will also serve as the spawnpoint for the player!")]
        public GameObject currentCheckPoint;
        private GameObject player;
        private int PHP;
        public int RespawnHP; //Amount of health to give player upon respawn.

        void Awake ()
        {

        }

        // Use this for initialization
        void Start ()
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }

        // Update is called once per frame
        void Update ()
        {
            PHP = GameObject.Find("InventoryManager").GetComponent<InventoryManager>().PlayerHealth;

            if (PHP <= 0)
            {
                Debug.Log("Player HP has been depleted. Respawning.");
                RespawnPlayer();
            }

            if (Input.GetKeyDown("r"))
            {
                Debug.Log("Restarting level!");
                RespawnPlayer();
            }
        }

        public void RespawnPlayer()
        {
            Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); //Reload scene.
            currentCheckPoint = GameObject.Find(ES2.Load<string>("myFile.txt?tag=checkpoint")); //Load saved checkpoint.
            Debug.Log("Player Respawning...");
            player.transform.position = currentCheckPoint.transform.position;
            GameObject.Find("InventoryManager").GetComponent<InventoryManager>().PlayerHealth = RespawnHP;
        }

        void RestartLevel()
        {
            //ToDo: Restart level, and reload last check point.

        }

        public static void SaveLevel() //Saves the current level to file.
        {
            //ES2.Save(SceneManager.GetActiveScene().name, "myFile.txt?tag=levelName"); //Saves level to file.
            //ES2.Save("none", "myFile.txt?tag=checkpoint"); //Overwrite checkpoint?
        }
    }

Does anyone have a clue what is wrong? Like I said earlier the problem seems to arise on scene reloading.

Response to comment(s):

  What behaviour are you observing at the moment? - Jack

Currently what happens is the player enters a checkpoint, the checkpoint is saved to a file, and upon respawn the checkpoint is loaded. After this I get spawned to the checkpoint that was saved but then immediately the level reloads itself and the player is not respawnd at the checkpoint. Here is a video to better demonstrate the issue (it will take a minute or two to finish up processing here as I've just pasted the link).

sentences: Why is there grey haze that appears when game is simulated in viewport, and how do I fix it? For some reason when the game runs in the regular viewport (not it's own) a grey haze slowly appears. This never used to happen. The level architecture (code) changed recently and then this started happening. However, none of the assets or visual build configurations were changed. This problem does not occur when the game is running in a separate viewport, but the fact is it wasn't an issue in the default viewport before. Does anyone know what is causing this and how to fix/prevent it?

sentences:
How do I enfroce efficiency concerning thread granularity? Lately, I've been thinking of ways to use multi-threading to improve the speed of different parts of a game engine. What confuses me is the appropriate granularity of threads, especially when dealing with single-instruction-multiple-data (SIMD) tasks.

Let's use line-of-sight detection as an example.  Each AI actor must be able to detect objects of interest around them and mark them.  There are three basic ways to go about this with multithreading:

Don't use threading at all.
Create a thread for each actor.
Create a thread for each actor-object combination.

Option 1 is obviously going to be the least efficient method.  However, choosing between the next two options is more difficult.  Only using one thread per actor is still running through every object in series instead of in parallel.  However, are CPU's able to create and join threads in the granularity posed in Option 3 efficiently?  It seems like that many calls to the OS could be really slow, and varying enormously between different hardware.

sentences:
Animations with individual images in Phaser.js So I have this game that I made a while back and I want to port it using Phaser.

The game is made using individual PNG files for all the animation frames, and there are over 100 of them.

From reading through the docs, it seems Phaser only supports spritesheets for animations.

I would like to do something like this :

player.sprite.animations.add('idle', ['images/s_snailIdle_0.png', 'images/s_snailIdle_1.png'], 60, true, false);
player.sprite.animations.play('idle');

Is there a way to add individual images to a sprite's animation?
If not, Is there a way to change the image of a sprite so that I can implement my own animation system?

sentences:
Rotate can I rotate an object to a target angle using Euler Angles? How do I rotate an object from its current angle to the desired angle in increments on 1 axis? The problem is the wraparound at 360 degrees
What I have so far (Note: pseudocode):

double MaxSpeed = 5;

double CurrentAngle = -170;
double DesiredAngle = 40;

double Distance = DesiredAngle - CurrentAngle; //How do I calculate this value considering angle wraparound?

CurrentAngle += Mathd.clamp(Distance, -MaxSpeed, MaxSpeed); //Caps the rotation speed

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

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

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

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

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

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

sentences: Is it possible to use mipmaps with dynamic textures in Dirext 11? I was trying create a texture with D3D11_USAGE_DYNAMIC and MipLevels equal to 0 (to create all the mip levels).  However, the texture failed to be created.  Is it possible to use mipmaps with dynamic textures?

sentences:
Transforming quaternion between coordinate systems Working in DirectX (with DirectXMath objects): If I have the rotation of an object relative to some coordinate space as quaternion Q, and I have a transformation matrix tx from that coordinate space to world space, how do I find the rotation of my object in world space?

My thinking, which has proven inaccurate, was:
Use XMMatrixDecompose on tx to get the orientation that is the rotation difference between world space and my local coordinate space (qLocalToWorld), invert it to get the rotation of the local coordinate system relative to the world (qWorldToLocal) and combine it with my local rotation Q.

XMVECTOR scale, qLocalToWorld, translation;
XMMatrixDecompose(&scale, &qLocalToWorld, &translation, tx);
auto qWorldToLocal = XMQuaternionInverse(qLocalToWorld);
auto worldOrientation = q * qWorldToLocal;

I figured for e.g. that if the local coordinate system was rotated 90 degrees with respect to the world, and my object was 5 degrees with respect to local, this would yield the 90 + 5 = 95 in world space. But I was wrong :(

I'd appreciate help in understanding the right way to do this. Thanks in advance!

sentences:
WWW request does not connect using webgl platform I use request like code below:

string url = "http://localhost:51820/Home/login/" + end+"/";
        WWW www2 = new WWW(url);
        StartCoroutine(waitForLogin(www2));

It works fine in the editor but the html build shows a connection problem. message of www error is only "unknown error"

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:
Defensive statistic mechanics There are many systems where attack statistics are opposed by defense statistics:

Strict: HP -= (damage - defense)
Threshold: HP -= (damage>defense? damage : 0)
Reciprocal: HP -= (damage / defense)

Just to name a few, and there are variations on those as well:

Reciprocal threshold: HP -= damage>defense ? (damage/defense) : 0

Note that this is by no means an exhaustive list, since many games use multiple stats to arrive at a final "defensive" result (agility, current speed, movement relative to attacker, flanking) that's applied to any potential damage.

What drives the selection of one relationship over another?

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:
Phong shading blows out things close to white [OpenGL]; is there a way around this? I'm doing per-pixel lighting using the Phong shading model.

In pseudo code this looks like:

vec4 ambientColor = light.ambientIntensity * material.diffuse;
vec4 diffuseColor = light.diffuseIntensity * material.diffuse;
vec4 specularColor = light.specularIntensity * material.specular;
finalColor = (ambientColor + diffuseColor + specularColor);

And you can add in a shadow map or light attenuation easily. Even color the light via the light.xIntensity values.

My problem is that I have a cloud texture that's all white values with varying levels of alpha. This is textured on a sphere. When rendering, what happens is that at the very appex of the light, i.e. the point closest to the light source the following seems to be happening:

When my light.ambientIntensity is at 0.2,0.2,0.2,0.2 I get an ambientColor on the whitest parts of the texture is say 0.2,0.2,0.2,0.2 and on the darkest parts of the texture could be 0.2,0.2,0.2,0.0.
With a light.diffuseIntensity of 1,1,1,1 I will get diffuseColor ranging from 0,0,0,0 (when we're nowhere near the light, i.e. the other side of the sphere) through to 1,1,1,1 when we're on the tip closest to the light and the diffuse color of the material is also full white.
I can skip specular here. Because the end result is now 1.2,1.2,1.2,1.2. The problem is that I'm now losing some detail because any values that should have been 0.8,0.8,0.8,0.8 are now full opaque white.

I understand that this would be desirable under some situations, like using HDR, but in this particular case it's not the result I want.

I'm using OpenGL 4.4 but I assume this problem and a solution is API agnostic.

sentences:
Game Research Points Possible Duplicate:
  Any interesting thesis topic?

I just wanna know what are the points of research in nowadays games. As I am Teacher Assistant and I must make a master thesis and I wanted to make the Thesis about games and contribution to game society the problem that all my faculty stuff are from old era where word games mean to them cards and chess boards only so they are useless to help me in finding a research point in gaming field

also I know most of research may be in GPU stuffs (Graphics) or in AI stuffs

But when I think I don't know from where to start and how to get a good research point to work on.

So if anyone can help I will be appreciated :)

sentences:
Shared Texture2D in XNA I am trying to define texture2d objects as shared. The reason of why I am trying to do is, I made an xna user control and my project loads unlimited (as much as the user wants) my XNA User Control. And all of the textures are same. I don't want to load textures for everyone of them (think how much ram size it will use if I do it)

The real problem is:

cmMaps = New ContentManager(Services, "Maps")

As you see, ContentManager news ServiceProvider for initialization. When I look at the codes where Services variant modified, I see this lines:

GraphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height)
m_services.AddService(Of IGraphicsDeviceService)(GraphicsDeviceService)

Why I can't define global Texture2D objects. Why is it specific for the window or control that the XNA tries to draw on?

Is it possible to define em as shared variant and able to use it in every XNA UserControl?

Note: I took UserControl source codes from this page:
http://xbox.create.msdn.com/en-US/education/catalog/sample/winforms_series_1

sentences:
Generic multiple containers derived classes for Entity System I am working on an entity system for a game. I have read that cache is very important with the common operation of iterating over entities and their components.

Currently I have a class World that contains the list of entities, and a list of each component.

class World {
  vector<Entity> entities;
  vector<PositionComponent> position_components;
  vector<SpeedComponent> speed_components;
  ...
};

The idea of this, is to have entities and components contiguous in memory to be cache-friendly.

The problem is that you have to write specific code for each different component, as it is hardcoded in the source code. One solution could be to have a matrix of Component*, where the i-th row of the matrix are all PositionComponents, and so on. The problem with this, is that with the pointers you don't have the memory continuous and break with the cache-friendly.

What would the best way to write generic code and still have cache-friendly data?

sentences:
How can I achieve smooth animation of sprites between discrete tiles? I'm currently learning game development with C# and XNA and my current assignment is to create a Pac-Man clone.

The game is partially tile based, which means that the level itself is built out of an array of tiles, but Pac-Man and the ghost just have a position to be drawn at.
I've got the basic functionality down, such as building the level with a string and drawing Pac-Man and the ghost on the screen.

Pac-Man is currently represented by two positions: one is where he is in relation to the array of tiles (a Point, for example 9, 11), and one where the sprite is drawn (which is a Vector2).
However, when trying to make the player be able to move Pac-Man (and Pac-Man is supposed to "glide" between tiles, not jump between them) it seems that his graphical position can not keep up with his tile position. It sort of lags behind.

This is hard to describe but here's some code to look over:

public PacMan(): base()
    {
        texture = Game1.pacManTexture;
        tilePosition = new Point(9, 11);
        position = new Vector2(tilePosition.X * spriteSize.X, tilePosition.Y * spriteSize.Y);

That is the constructor for Pac-Man.

else if (tileManager.playArea[tilePosition.X, tilePosition.Y - 1] is Tile) // if the  tile above Pac-Man is of the type Tile...
                {
                    tilePosition.Y -= 1; // decrement tilePosition by 1
                }

That is what happens if the player presses the Up key.

Vector2 tilePos = new Vector2(tilePosition.X * spriteSize.X, tilePosition.Y * spriteSize.Y);
        Vector2 direction = tilePos - position;
        if (direction.Length() != 0)
            direction.Normalize();
        position += direction;

And that is where the faulty magic happens. The graphical position of Pac-Man (the sprite) is being updated.

Rectangle pacManRectangle = new Rectangle((int)position.X, (int)position.Y, spriteSize.X, spriteSize.Y);
        Game1.spriteBatch.Draw(texture, pacManRectangle, new Rectangle(currentFrame.X * spriteSize.X, currentFrame.Y * spriteSize.Y, spriteSize.X, spriteSize.Y), Color.White);

And lastly, that happens in the Draw method.

If you need more information, just say so.

sentences:
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:
What is the difference between the two circles in the rotation tool in Unity? What is the difference between the two circles in the rotation tool in Unity?
In 2D rotation tool there are two circles which allow to rotate an object. And I can not conceive a difference between them. Could someone explain me what is the purpose of having both of them? It seems they both do the same.

sentences:
Unity3D Raycasting in Start behaves uncorrectly, but works correctly in Update? I have this method, which just raycasts at a position downwards, and checks what tile is there, if there is one:

    public static Tile RaycastTile(Vector3 position)
    {
        Debug.Log("raycastTile at pos: " + position);
        var layerMask = 1 << LayerMask.NameToLayer("Floor");
        RaycastHit hit;
        Debug.DrawRay(position, new Vector3(0, -10, 0), Color.red, 50);
        if (Physics.Raycast(position, new Vector3(0, -1, 0), out hit, 10, layerMask))
        {
            var tile = hit.collider.gameObject.transform;
            Debug.LogWarning(tile.name + " - " + tile.parent.name + " - at pos: " + tile.position);
            var coordinates = new Vector2Int(Mathf.RoundToInt(tile.position.x) / 2, Mathf.RoundToInt(tile.position.z) / 2);
            return map.GetTile(coordinates);
        }
        else
        {
            Debug.LogError("Tile not found under position: " + position);
            Debug.Break();
            return null;
        }
    }

Currently it is called for the player

at Start() ("starting at: < player's absolute position >")
and at Update() ("update at pos: < player's absolute position >")
And the map is being generated (tiles created, destroyed, etc) in Awake().

and for some reason this is the output:

And the map generation works like this:

Creates a room at (0, 0) with tiles and all, then it searches for a connection point on the existing map, whom the new room could be connected to. (with some rotation, if it's needed)
(Every tile is 2x2 meters, and they are on a strict grid)

So for some reason calling this method at Start() (with the same position) hits a totally different tile. While in Update() it works correctly.

At first I thought that it's because of Destroy(), because the objects are only destroyed at the end of the frame. But I tried DestroyImmediate() and it didn't help. (And after thinking, I realised that destroying objects at the end of the frame wouldn't cause issues. Or is it?)

Then I had the idea, that maybe Start doesn't wait for Awake because it compute heavy. And the raycast in the Start hits a (yet) non translated newly generated room. So I edited the code so every room is initially created at very far away, which is relatively "infinite far away" from the player: at (9999, 9999). But the issue remained.

EDIT: With (9999, 9999) Sometimes (maybe half of the time?) now it is correctly raycasted even at start, while before it was never correct in start.

EDIT2: With (0, 0) it hits correctly at start as well, but very very rarely.

Do you have any idea what could cause this issue?

Sorry if there isn't enough info, feel free to ask. :)

sentences:
How to draw lines round selected objects and lights? I need two things to draw in Modern OpenGL.

Please see the image:

Draw lines to represent light's position and direction
Draw xyz axises at the origin of a selected objects

How do I draw these? should I use fragment shader or what?

sentences:
How can I change InvokeRepeating time in unity? I have a slider in the pause menu which will have a min value of 1 and max of 5.
When I change it, the InvokeRepeating function maintains the same speed, but Debug.Log shows current slider value.

How can I change the InvokeRepeating rate?

Player.m1 is a float; when I give 5f or something like that to InvokeRepeating it works fine.

    using UnityEngine;

    public class Gen1 : MonoBehaviour
    {
        public GameObject rocks;

        int scr = 0;
        public int m=0;
        float n11=Player.m1;
        float sp;

        // Use this for initialization
        void Start()
        {
            //if (Player.m1 == 5 || Player.m1==4) {
            InvokeRepeating ("CreateObstacle", Player.m1,5f);//Here speed handels
            //} else {
                //InvokeRepeating ("CreateObstacle", 4f, 5f);//Here speed handels
            //}
            Debug.Log ("current speed is afad"+Player.m1);
        }

        void Update()
        {
            //InvokeRepeating ("CreateObstacle", 4f, Player.m1); //Here speed handels
            //Debug.Log ("current speed is afad"+Player.m1);
        }

        void OnGui()
        {
            GUI.color = Color.black;
            GUILayout.Label ("Score is" + scr.ToString ());
        }

        void CreateObstacle()
        {
            Instantiate(rocks);
            Player.score += 1;
            Debug.Log ("current speed is "+sp);

        }

        void OnBecameInvisible() {
            // Destroy the bullet
            Destroy(this.rocks);
        }
    }
```

sentences:
Unity - Loss of detailed shadows and shading marks on texture seams appearing after lightmap baking I'm attempting to lightmap bake my scene and am running into the following problem -

With the lights set to realtime, the shadows have a nice amount of detail in them and the lighting on the models looks correct. However after a bake, all I end up with is a dull blob shadow underneath everything and nasty shading marks on my meshes, these shading marks are mostly appearing where the seams are on the UVs. The models are .blend files from Blender and 'Generate Lightmap UVs' is checked on the model Inspector panel.

All lights are set to static and 'Baked'

Lights are 3 x spotlights 1 x directional light

All models are set to static

Unity 5.3.3

PC standalone

Materials are using the standard shader with a diffuse and normal map on each.

I have attached screenshots of the problem and all my settings.

This is my first proper attempt at lightmapping, so I'm hoping it's just a simple oversight in my settings that someone more experienced can point out.

If anyone can suggest the cause of the problem, it would be much appreciated.

Thanks in advance

sentences:
2D helicopter game, how to create corridor walls? I'm looking into adapting the classic "helicopter" game (i.e. http://www.addictinggames.com/helicopter.html), but I haven't yet figured out how to create the walls-generation engine.

Any pointers into the pseudocode? I'm not so interested in the objects in the middle- only the methodology for generating the sides in a way which increases with difficulty (closes in more, has more unexpected curves) as the game progresses.

sentences:
XNA 2D game fullscreen issue I am creating a 2D farming game using XNA - just today I have tried applying full screen to it, and I realized I failed badly with something. It cuts off a bit of the lower part [item hotbar and a piece of character status area]

I have just started learning C# and XNA, I just totally rewrote the engine and changing everything with rendering all over again is not an option - honestly I have no idea myself how does it all work anymore [I'm using some crazy camera class thing with an array of rectangles for displaying tiles / moving them around when the player moves etc] :-P

In the previous version of the engine I used the default XNA window size and the full screen worked just fine, this time I changed it to something more ... comfortable, and it does not work anymore. Changing the preferred buffer width does nothing at all in full screen, it's still cut off, and still the same height. I have no idea what matrices or viewports are, and everything I seem to find on google refers to them and some crazy complicated stuff

The screen size I am using is 800 x 640

My screen is very long sideways [whatever the name for such screens was :|]

Is there a way to fix that without rewritting everything?

sentences:
Bounding box should rotate - Skews instead I have a method to rotate a sprite's bounding box around the center of the sprite (the sprite rotates and I need the bounding box to rotate with it. The sprite is rectangular).

Instead of being rotated, the bounding box is skewing wierdly. When the angle is 0 - the bounding box is a perfect rectangle. But when the angle changes, the bounding box is getting gradually skewed.

All of this happens in the object's move() method. This method is called every cycle of the game-loop. What I'm trying to do is this:

Move the sprite in the direction the user chose. (x += dx, y += dy).
Get the coordinates of the new center of the sprite.
Get coordinates for the four vertices of the not-rotated-version
of the sprite.
Manipulate these coordinates, so they are now the vertices of the
rotated sprite.

The coordinates that step 4 gives me, are used to create the bounding box (and temporarily draw it on the screen so I can see).

Somewhere, this fails. As I said, the bounding box doens't rotate. Instead, it skews (and maybe also rotates, not sure).

What could be the problem?

Code:

public void move(){

// Advance sprite.
x += dx;
y += dy;

// Get the new center point of the sprite.
centerx = x + width/2;
centery = y + height/2;

// Get the 4 vertices of the non-rotated version of the sprite.
xcoo[0] = (int) x;
xcoo[1] = (int) (x + width);
xcoo[2] = (int) (x + width);
xcoo[3] = (int) x;

ycoo[0] = (int) y;
ycoo[1] = (int) y;
ycoo[2] = (int) (y + height);
ycoo[3] = (int) (y + height);

// Manipulate each vertex, so it fits the rotated sprite.
for(int z=0;z<4;++z){

    xcoo[z] -= centerx;
    ycoo[z] -= centery;

    xcoo[z] = (xcoo[z] * Math.cos(Math.toRadians(angle)) - ycoo[z] * Math.sin(Math.toRadians(angle)));
    ycoo[z] = (xcoo[z] * Math.sin(Math.toRadians(angle)) + ycoo[z] * Math.cos(Math.toRadians(angle)));

    xcoo[z] += centerx;
    ycoo[z] += centery;

}

}

Help would be very appreciated. Thank you

sentences:
Map color collision problem Hello i'm doing a game in WPF, 2D version (top view)

I have the map and i'm trying to check for color collision in pixel each time the timer is activated

Well...with 1 object it works fine but with more objects at same time it just slow down the process

This is my code every time the dispatchertimer activates and i loop to check for collision on every object

CroppedBitmap cb = new CroppedBitmap(source, new Int32Rect(x, y, 1, 1));
int px = 1 * (source.Format.BitsPerPixel / 8);
byte[] pixels = new byte[px * 1];
cb.CopyPixels(pixels, px, 0);
Color c = Color.FromArgb(pixels[3], pixels[2], pixels[1], pixels[0]);
if (c.R == 255 && c.B == 255 && c.G == 255) {
   pixels = null;
   return true;
}

Any help to simplify the process? I really want to do it in WPF

PS: The map is 1018x731

sentences: 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:
How to proper manage a world composed by multiple scenes? I have a UI-only scene for my game that have only Unity UI elements (those that need a Canvas), separate from the world scene.
In the UI scene I have a MonoBehaviour that manage all the effective actions and all the interactions between different UI elements, and In the world scene I have another manager responsible for controlling all the other things in the game scene.
This design worked pretty well until I faced the following situation: in a specific moment the player need to click in BoxColliders that are in the world scene but it is actually a UI-related action. This action of clicking in these BoxColliders are essentially the player clicking in buttons that in this case happen to be 3d objects that need to be composed in the environment, thus need to be in the world scene.
In the situation described above the clicks on those BoxColliders should be managed by the UI Manager, that is alive in the UI scene.
So the problem is: how should I approach this whole situation without breaking a lot of clean code rules? What is tipically done when developing in Unity to solve this kind of problem when you need a reference for an object that lives in another scene without keeping a hard reference for this object (or just calling GameObject.Find in the scene startup)?

sentences: Plot HDR tonemap curves I am using a tonemapper in our project and a friend of mine asked if I could provide him with a plot of the tonemapper used (different functions are implemented). I tried in MATLAB to copy the tone-mapper function and use luma values from -5 to 5.0 to feed to the function, but the resulting plot is nothing like a classic tonemap function plot as I happen to see around. The function is totally correct, but am I missing something stupid that must be taken into account when trying to plot them?

sentences:
How to create bullet hole decals in Godot engine? How can you create decals such as bullet holes in Godot?
Godot doesn't seem to have any native method of creating decals.
I am trying to create decals so that bullet holes will be displayed properly on curved and angled surfaces and corners.
I have tried a few plugins, but none of them worked, they all either had a texture stretching issue or they didn't work at all.
For example, when I tried using the Screen Space Decals plugin (https://godotengine.org/asset-library/asset/241), it did draw decals when a texture wasn't provided (a simple black rectangle by default), but when I assigned the bullet hole texture to the decal property the bullet holes became invisible.
What would be an ideal method of creating decals in Godot?

sentences:
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:
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:
*Python* Class - self.x = self - What does it mean to set it to self? I have this class for my game that is a scene manager. I followed a tutorial and I am confused on why the self.scene.manager is equal to self

class SceneManager(object):
    def __init__(self):
        self.go_to(TitleScene())

    def go_to(self, scene):
        self.scene = scene
        self.scene.manager = self #<--

In the main game scene I also have a similar thing happening

class GameScene(Scene):
    def __init__(self, levelno):
        super(GameScene, self).__init__()
        self.player = Player(5, 40)
        self.player.scene = self

What is the purpose of setting it to self?

Another Question:
I have been using classes and for most of them I create a class and I include this within the class

Class myClass():
   super(myClass, self).__init__() #<----- This line here

Does this have something to do with my original question?
What is the purpose of doing this?

sentences:
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:
How can I export a .FBX file from Unity3D at runtime? I want to export an object as a .fbx at runtime in Unity3D.

I've made a C# script to export a mesh filter or skinned mesh renderer to a .obj file at runtime, but I want the animation and skin support that only .fbx supports.

After some research, using the Autodesk FBX SDK or some other external .dll seems like my best option. How do I call Autodesk's FBX SDK at runtime? Is there another external .dlls I could use for this?

Another option could possibly be to write the mesh information as a text file, then convert to .fbx to export.

sentences:
Popupwindow size and position [Unity] I am working through the popwindow sample code provided in the documentation here. So far my code opens up an instance of PopupExample when user clicks on a sprite. But I am unable to understand how PopupExample's position and size is being determined. The line below from the sample code, is setting the activator rect of PopupExample to buttonRect. And buttonRect is initialized to default values, which should be x=0f; y=0f; width=0f; height=0f.

PopupWindow.Show(buttonRect, popup);

When I run the code and click on the sprite, the popupwindow shows up on the upper-left corner of the IDE(screenshot below). I was expecting it show up somewhere within the scene itself. Why is it not contained within the scene? Also how can a widow with width and height initialized to 0f be visible at all?

sentences:
Defining and selecting an area from an image I want to create a game, where the world is loaded from an image file, much like Paradox Interactive does it for their games. If I have this image:

Then the red, green, blue, cyan, magenta, white, black and grey should be different provinces. I know how to loop through them, and check if it's a new province, the problem is that I don't know how to define the region of the province for selection: I don't know how I can load in data, to make sure you can click anywhere on that province, and make sure it gets selected.

sentences:
Moving sprites using the accelerometer (Android) In my previous game, I was moving my sprite like so:

float time = 10f;  //Number of seconds to pass a pre-defined area (using the screen width in this example)
float velocity = 1f/time; //work out velocity based on above time
float realX-=velocity*dt; //Move the sprite to the left (where dt is previously defined delta)
x = realX*screenWidth //convert to screen coordinates so it can be rendered

sprite.draw(x, y); //Working out the y position in the same way

This all works great when using touch controls.  In the above example, the sprite will cross the screen in precisely 10 seconds regardless of the device on which it is running.

However, the game I'm currently developing uses the accelerometer to move the sprite.  (I'm only moving the sprite left/right).  Currently, what I'm doing is this:

@Override
public void onSensorChanged(SensorEvent event){
    tilt = event.values(axis);
}

Once I have the value, I apply it to my sprite movement like this:

float time = 10f;  //Number of seconds to pass a pre-defined area (using the screen width in this example)
float velocity = 1f/time; //work out velocity based on above time
float realX-=(tilt * velocity)*dt; //Move the sprite to the left **Now using the tilt value*
x = realX*screenWidth //convert to screen coordinates so it can be rendered

Although this does work - it gives nice fluid movement of the sprite, when I run it on an old Galaxy Ace, the sprite accelerates way too fast.  This changes the feel of the game - note I'm talking only about acceleration here, so if I tilt the phone from left to right repeatedly, the sprite is extremely (too) responsive on the Ace, but 'just right' on my 10" tablet).

I've tried a couple of other available games and they seem to run pretty consistently across devices.

I'm wondering if my code is correct and if so, what can I do to get all devices running more consistently with regards to the accelerometer?

Edit

Just to clarify what it is I'm asking.  I have a sprite in the middle of the screen sitting on a horizontal platform.  When the device is tilted to the left, the sprite moves to the left.  The rate of movement should be linked to the angle the device is tilted. So, if the device is vertical there should be no movement. If the device is tilted slowly to the left, further and further the sprite should increase in speed also (up to a limit) ie, accelerate.

The other (real world) way to think of it is sitting a ball bearing inside a vertical box (the box representing the device) and then simply tilting the box to the left and right.  The ball accelerates towards to lowest corner.  The sprite should act like a real ball.  If it's accelerating towards to left corner, and the box is tilted in the opposite direction, then the sprite should start to decelerate to a stop, and then srart accelerating in the opposite direction. Just as the real-world ball bearing would.

My Original code achieves this, however, on some devices it's simply too responsive, it will decelerate and accelerate too quickly. And therefore change the 'feel' of the game - making it too easy for one thing.

So basically when I say the sprite movement feels 'natural' I'm referring to how the ball bearing would act/feel in the real-world.

This is exactly what I'm looking for - hope this helps!

sentences:
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:
How do I determine how far to move an object in the client when using client-prediction? I have a game server which, for testing purposes, is updating once per second, or 1hz so I can correctly implement client-side prediction. Everything is running locally at the moment so there is no lag issues to deal with, but this setup replicates potential packet loss, or if the server somehow is behind on processing.

I am using Unity for the client. I have a tunnel where the position is updated on the server and then broadcast to each client each tick (once per second). The client simply then lerps between its current position, and the new position received from the server, and this seems to work nicely.

However, as I have set the tick to 1hz, there are unexpected results where the position seems to pulse, rather than smoothly transition. An example can be seen below.

It can perhaps be seen more clearly without lerping

I have tried constantly increasing the tunnel's position in the client, but if it's moved too far in the client, once the server's position is received, it is snapped back to that position which creates some weird rubber-banding like effects even though there is no lag.

How can I determine how much to move the tunnel in the client to create some seamless movement, even when the tick rate is so low? Baring in mind this movement is variable, so it can move faster/slower at times so the movement in the client cannot be a fixed number.

Yes, I can just increase the tick rate which gives smooth movement, however, there is no lag to account for as it's all local so I am just preparing for when I move the server to actual hosting.

Instead of lerping between the current position and the received position, should I be trying to lerp between the current position and the next received position?

Lerp:

        Vector3 currentPosition = transform.position;
        Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, tunnelPositionZ);

        transform.position = Vector3.Lerp(currentPosition, newPosition, Time.deltaTime);

DMGregory's solution attempt:

If I decrease the 1.0f for the blend variable, the tunnel will move very slowly and then jolt forward when a snapshot is received. Decreasing the 1.0f to around 0.1f seems to align the speeds but there is still a noticeable jolt.

I'm using the same velocity for the currentPosition and newPosition because the velocity never changes.

    float dT = Time.time - latestSnapshot.arrivalTime;
    float blend = Mathf.Clamp01(dT / 1.0f);

    Vector3 currentPosition = transform.position;
    Vector3 currentVelocity = rigidbody.velocity;

    Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, latestSnapshot.tunnelPositionZ);
    Vector3 newVelocity = new Vector3(currentVelocity.x, currentVelocity.y, latestSnapshot.tunnelVelocityZ);

    Vector3 velocity = Vector3.Lerp(currentVelocity, newVelocity, blend);

    Vector3 position = Vector3.Lerp(
               currentPosition + velocity * dT,
               newPosition + velocity * dT,
               blend);

    transform.position = position;

sentences:
Creating smooth lighting transitions using tiles in HTML5/JavaScript game I am trying to implement a lighting effect in an HTML5/JavaScript game using tile replacement. What I have now is kind of working, but the transitions do not look smooth/natural enough as the light source moves around. Here's where I am now:

Right now I have a background map that has a light/shadow spectrum PNG tilesheet applied to it - going from darkest tile to completely transparent. By default the darkest tile is drawn across the entire level on launch, covering all other layers etc.

I am using my predetermined tile sizes (40 x 40px) to calculate the position of each tile and store its x and y coordinates in an array.

I am then spawning a transparent 40 x 40px "grid block" entity at each position in the array

The engine I'm using (ImpactJS) then allows me to calculate the distance from my light source entity to every instance of this grid block entity.

I can then replace the tile underneath each of those grid block tiles with a tile of the appropriate transparency.

Currently I'm doing the calculation like this in each instance of the grid block entity that is spawned on the map:

var dist = this.distanceTo( ig.game.player );
var percentage = 100 * dist / 960;

if (percentage < 2) {
    // Spawns tile 64 of the shadow spectrum tilesheet at the specified position
    ig.game.backgroundMaps[2].setTile( this.pos.x, this.pos.y, 64 );
}
else if (percentage < 4) {
    ig.game.backgroundMaps[2].setTile( this.pos.x, this.pos.y, 63 );
}
else if (percentage < 6) {
    ig.game.backgroundMaps[2].setTile( this.pos.x, this.pos.y, 62 );
}
// etc...

The problem is that like I said, this type of calculation does not make the light source look very natural. Tile switching looks too sharp whereas ideally they would fade in and out smoothly using the spectrum tilesheet (I copied the tilesheet from another game that manages to do this, so I know it's not a problem with the tile shades. I'm just not sure how the other game is doing it). I'm thinking that perhaps my method of using percentages to switch out tiles could be replaced with a better/more dynamic proximity forumla of some sort that would allow for smoother transitions? Might anyone have any ideas for what I can do to improve the visuals here, or a better way of calculating proximity with the information I'm collecting about each tile?

(PS: I'm reposting this from Stack Overflow at someone's suggestion, sorry about the duplicate!)

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:
Creating an isometric map with hexagonal tiles for iPad I'm new to game development, so I need a little help.

I have to write down a little game which has a floor with hexagonal tiles, but it must be seen in an isometric view like The Sims.

Ignoring the UIKit way, I used CoreGraphics method and I managed to draw a hexagonal map and to get it working but this only in the orthogonal view.

Hoping that Cocos2D could help me, I've studied a little, but I only see that the hexagonal maps are supported only in orthogonal mode. In the stackoverflow community, someone who understand about that much more than me, told me that I simply cannot draw it with Cocos2D tiles, so, thinking at this image:

http://www.issamtp.org/gnfGr.jpg

I guessed that there must be another way, which I hope is not to calculate the "skew" manually.

The nearest results I managed to obtain were with CAAffineTransform which doesn't give the depth effect seen in the image above (at least I didn't managed to give it) or with CATransform3D without perspective.

Can someone tell me if I'm in the right way, and if so, how should I set the parameters of the Transform matrix to get the desired effect?

EDIT:

Here's the code I used

sfondo = [[Sfondo alloc] initWithFrame:CGRectMake(sfondoX, sfondoY, sfondoWidth, sfondoHeight)];
/*sfondo = [[Sfondo alloc] initWithFrame:CGRectMake(200, 200, 300, 300)];*/
[sfondo setBackgroundColor:[UIColor clearColor]];
[sfondo setDelegate:self];

CGAffineTransform transform = CGAffineTransformIdentity;
transform.b = 0.5;
transform.a = 1;
sfondo.transform = transform;

sentences:
How do I implement a retro-style password-based "savegame" system? How would I make a password system for a single-player game like the ones used in older console games?

For example, Mega Man X saves work by giving you a series of numbers that you can enter later to load your save.

sentences:
Creating a voxel world with 3D arrays using threads I am making a voxel game (a bit like Minecraft) in C++(11), and I've come across an issue with creating a world efficiently.

In my program, I have a World class, which holds a 3D array of Region class pointers. When I initialize the world, I give it a width, height, and depth so it knows how large of a world to create. Each Region is split up into a 32x32x32 area of blocks, so as you may guess, it takes a while to initialize the world once the world gets to be above 8x4x8 Regions. In order to alleviate this issue, I thought that using threads to generate different levels of the world concurrently would make it go faster.

Having not used threads much before this, and being still relatively new to C++, I'm not entirely sure how to go about implementing one thread per level (level being a xz plane with a height of 1), when there is a variable number of levels.

I tried this:

for(int i = 0; i < height; i++)
{
    std::thread th(std::bind(&World::load, this, width, height, depth));
    th.join();
}

Where load() just loads all Regions at height "height". But that executes the threads one at a time (which makes sense, looking back), and that of course takes as long as generating all Regions in one loop.

I then tried:

std::thread t1(std::bind(&World::load, this, w, h1, h2 - 1, d));
std::thread t2(std::bind(&World::load, this, w, h2, h3 - 1, d));
std::thread t3(std::bind(&World::load, this, w, h3, h4 - 1, d));
std::thread t4(std::bind(&World::load, this, w, h4, h - 1, d));

t1.join();
t2.join();
t3.join();
t4.join();

This works in that the world loads about 3-3.5 times faster, but this forces the height to be a multiple of 4, and it also gives the same exact VAO object to every single Region, which need individual VAOs in order to render properly. The VAO of each Region is set in the constructor, so I'm assuming that somehow the VAO number is not thread safe or something (again, unfamiliar with threads).

So basically, my question is two one-part:

How to I implement a variable number of threads that all execute at the same time, and force the main thread to wait for them using join() without stopping the other threads?
How do I make the VAO objects thread safe, so when a bunch of Regions are being created at the same time across multiple threads, they don't all get the exact same VAO? Turns out it has to do with GL contexts not working across multiple threads. I moved the VAO/VBO creation back to the main thread. Fixed!

Here is the code for block.h/.cpp, region.h/.cpp, and CVBObject.h/.cpp which controls VBOs and VAOs, in case you need it.

If you need to see anything else just ask.

EDIT: Also, I'd prefer not to have answers that are like "you should have used boost". I'm trying to do this without boost to get used to threads before moving onto other libraries.

sentences:
Creating an Array of 1s and 0s (with all 1s touching) I am a novice programmer trying to add an unnecessary and complicated element to a text adventure!  ...and I've run into a question I am not sure how to research further (I suspect due to lack knowledge of the proper terminology).

I am working on a small text adventure that uses an 11x11 array. Player is capable of moving into spaces with a 1 and incapable of moving to a 0. I need to a) retain the outer boundary 0s, b) randomize the content inside the border, and c) ensure that there is a linked path of 1s that will eventually connect to a 2 (the exit):

0 0 0 0 0 0 0 0 0 0 0
0 1 1 0 0 0 0 1 0 0 0
0 0 1 1 1 1 1 1 1 1 0
0 0 1 0 0 0 0 0 0 1 0
0 0 1 1 1 1 1 1 1 1 0
0 1 1 0 1 0 1 0 0 0 0
0 1 0 0 1 0 1 0 0 0 0
0 1 1 1 1 0 1 1 1 2 0
0 0 0 1 0 0 1 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 0

I'd appreciate any pointers here - not sure what direction I should be looking in. Thinking of scrapping this feature so if it's not viable I don't mind hearing that :) Thanks for reading.

sentences:
Is Frustum Culling by itself enough for Consoles and Mobiles? Software occlusion culling is often expensive, especially for smaller and older devices.

Is frustum culling alone adequate on systems that can optimally display 10k triangles at most?

If not, are there any relatively fast techniques for determining which objects (both moving and static) occlude others?

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:
"Unclutter" units in RTS game For intentional reasons, certain units in the game I'm currently programming don't have any collision detection and response among each other.

This enables them to clutter right on top of each other. This is a wanted behavior, since there will be situations in the game when the player does want them to stack like that.

However, I want to make the process of uncluttering them easy for the player, so that they just have to press a hotkey or click some button on the screen and have the units disperse just enough so it's easy to select a group of them with the mouse (if they stand on top of each other one mouseclick selects all units).

How could I do this without running a brute force N^2 nearest neighbor search on all units?

sentences:
GL_EXT_shadow_samplers killing my shader I have the following fragment shader for my scene

#extension GL_EXT_shadow_samplers : require
...
vec4 color = texture2D(uTextureUnit0, varTexCoord0);

if (colorTransformEnabled != 0) {
    vec3 transformedColor = colorTransform * color.rgb;
    color = vec4(transformedColor, color.a);
}
gl_FragColor = color;

this works like expected.

Now I add this line:

float shadow = shadow2DProjEXT(uShadowTexture, varShadowCoord);

and boom my shader does not produce any output at all.
GL_COMPILE_STATUS and GL_LINK_STATUS do not return any error messages. Any idea where to go from here to debug this?

Edit:

I'm on iOS and GL_EXT_shadow_samplers is supported.

Edit:

I forgot to check for error at some point. Now I get a GL_INVALID_OPERATION on glDrawElements. Any idea what could cause this problem? Since I do not get the error when I don't use the shadow2D functions.

Edit:

The following state change overview might help some more:

Where GL_TEXTURE0+1 is the depth texture and GL_TEXTURE0 is the objects texturea

Edit:

I found out that it produces the error as soon as the shader contains a call to shadow2DProj the invalid operation error is thrown. Although the shadow2DProj function is never called in the shader. And it still throws the error if shadow2DProj is called.

sentences:
Raise/Lower Object Height Based on Distance, with Easing I'm trying to make an indicator object appear higher up in the sky the farther away a player is, up to a certain distance.

Basically, if the player is < 5 distance away, the object's height should be 1.
If the player is > 60 distance away, the object's height should be 50.
If the player's distance is between 5 and 60, the height of the object should be calculated based on the given scale, with an easing function applied so that it moves gradually to it's top and bottom locations.

This can be best illustrated with the attached graph that I created. The graph may not be perfect, but it should be close enough to get the general idea of what I'm hoping to achieve.

That said, I'd assume you'd need at least 5 variables... groundHeight, maxHeight, minHeight, maxDistance, and minDistance, but how would I use this information to calculate the expected height for a given distance?

This isn't related to a specific game engine and language isn't important. I happen to be working with Lua on my current project, but JavaScript, C#, or even pseudo-code solutions would help me understand how this is achieved.

sentences: Is ruby a suitable language for game development? I want to move into some game development, but the only language I know really well is Ruby. Most of what I have read seems to point towards lower level languages like C++ for game development, or languages for specific frameworks like C# for using XNA. Does anyone have any experience using a language like ruby for game development? If so, would you advise for or against it?

sentences: Using a smaller off-screen buffer for rendering I am seeing this in most of the game codes I read and tutorial videos I watch. When using double buffering in rendering, they use a smaller sized off-screen buffer, then just scale it up when drawing onto the screen. Why is this so? Is there any advantages and/or disadvantages when using this technique?

sentences:
After rotated by Z-axis, X/Y axis still rotating just like z is 0 I'm making aerial vehicle controller, which can rotate 3 axis: X(Pitch), Y(Yaw), Z(Roll).

Rotating x(pitch) and y(yaw) axis works fine, however after I rotated z(Roll) axis, x/y rotation gave me weird result, it seems like it still rotating just like z axis didn't rotated(0).

First I thought that it was some kind of gimbal lock problem, but it wasn't, it still happens using quaternion.

Here's the video I demonstrate:
https://www.youtube.com/watch?v=8cdBSxcmiWE&feature=youtu.be

Note that I tried all these and had same results:

# Using Euler
rotation.x += pitch

# Using Euler II
rotate_x(pitch)

# Using Quaternion
var qRot = Quat(transform.basis)
var r_euler = qRot.get_euler()
var new_rot = Vector3(r_euler.x + pitch, r_euler.y, r_euler.z)
qRot.set_euler(new_rot)
var new_basis = Basis(qRot)
var new_transform = Transform(new_basis.x.normalized(), new_basis.y.normalized(), new_basis.z.normalized(), transform.origin)
set_transform(new_transform)

Is there a something that I missed? Any advice will very appreciate it.

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:
Image Buttons Have Low Resolution Quality I'm using Synfig Animator to draw my animations for my android game
I'm also using Android Studio to write the code for it, However.
On testing, the images that i'm using looks very bad and unfocused even though i made them on a high resolution,
I've tried to change the resolution of it but it didn't work!
and when i change the size it just get bigger and stay the same..
How can i fix this problem? i need to have perfect animations for my game.

sentences:
How can I remove scores or ban users from Google Play leaderboards? I have included Google Play game services in my Android game. I see lot of users posting fake scores.

Can I ban them or can I delete these scores somehow?

sentences:
C++ class hierarchy issue I am taking the step of moving on from Java over to c++, I have been working on my own custom game engine in java for a while so have a good understanding of polymophism, inheritance etc.

Now to the issue:

Currently I am working on a basic level format trying to get entities to render to the screen, this all goes well if i change the code to what i don't want it to be below is the code:

#include <SFML/Graphics.hpp>
#include "../Entities/Player.h"

#include "Layer.h"

class TileMap: public sf::Drawable, public sf::Transformable {
private:
    std::vector<Player> entities;
public:

    Player* addEntity(Player player) {
        entities.push_back(player);
        return &entities[entities.size() - 1];
    }

    void update() {
        for (unsigned int i = 0; i < entities.size(); i++) {
            entities[i].update();
        }
    }

    virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const {
        for (unsigned int i = 0; i < entities.size(); i++) {
            target.draw(entities[i]);
        }
    }

};

The player that is returned in the function is then stored in a DrawableEntiity* player; variable. & this works fine everything updates

As I want a generalized list of entities and not a list for each entity i add to the game i want to be able to change this from

std::vector<Player> entities;

and change it too (obviously including the include for it too)

std::vector<DrawableEntity> entities;

The issue is everytime i store it this way the draw and update functions of the lower level Entity class isn't called and instead the default function inside of the DrawableEntity is called.

This is probably a easy mistake on something I've overlooked but i can't find anything online anywhere that fixes the issue. a full code listing of the Entity classes can be found at http://pastebin.com/3rRuzZHs

Thanks for taking your time to read this
Jordan

P.S: If you need any more information let me know.

sentences:
How can I easily render Box2D polygons with ShapeRenderer in LibGDX? In the PolygonShape object, there is the method setAsBox() which allows for creating rectangles easily, but there is no getAsBox() for cases where you know the polygon is a box. I know Box2D comes with it's own renderer, but I need to make custom renders.

Also, PolygonShape objects have a getVertex() method, but it has no return, and it takes a second argument of a vector2, for some reason. I don't know how I'm supposed to get a vertex from that. Why isn't there just a method that returns an array of Vector2 objects?

How can I easily render Box2D polygons with ShapeRenderer in LibGDX?

sentences:
I'm making a board game: who should manage the player move if the board has specific locations for the players? I know this is very specific question but imagine I have a board with spaces (like Monopoly) and a player that must go from one space to another after the dice are thrown.

So my workflow:

Player roll dice
After the player rolled dice

(from player class) space = board.getNextSpaceFromPlayer(player)
Move the player each step until it reach the destination

board.movePlayerToNextSpace(player);
OR
player.moveToSpace(space);

But how exactly do I move the player?

The board must move the player or the player move itself?

I'm trying hard to reflect how the things are in the real world but I find very hard to do so in this context.

Thanks for your help.

sentences:
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:
Best memory allocation strategy for iOS? I'm debating myself about memory allocation on iOS. I write most of my code in C++ and I really like using ObjectPools, FreeLists, etc. In order to pre-allocate a lot of the stuff that I'll be constantly "alloc/dealloc" during the course of my game, ( like particles, game entities, etc ).

Still on iOS, it's not like we are developing for a console like PSP, where I can know for fact that I'll get a fixed amount of memory. iOS , will issue "memory warnings" when the system needs memory.

Does anyone have some suggestions about this ? Is it too serious since the new iPod touch/iPhone 4 are carrying more RAM ? or it's still a big concern?

sentences:
Unity3d getting terrain height I am making an RTS game in unity like Total War games. As for rendering I am using Graphics draw mesh instanced method and after culling a I can easily render massive amount of soldiers on battlefield also they are animating with shader. I am not using unity gameobjects or unity physic engine(Also they are costly) as only data I am providing is Matrix4*4 to DrawInstancedIndirect method and rendering.Problem is I want to get height of terrain at specific position(to place unit on terrain) So I can pass Y value to Matrix4*4 for rendering. After seraching documentation I found that there are few ways to get height.

Terrain.SampleHeight :
It is easy to get height with this method just need to pass vector position but
costly As When there comes 10,000s of units on battlefield 10k calls for sample height kills performance.

TerrainData GetHeights : Can get heightvalue from it in 2d array but height I get is only for int value i.e [10,500] so there is not any option to get value sayif specific unit is at position[10.52,234.8]

TerrainData.GetInterpolatedHeight : I can get height for float values but I am getting inconsistant result with it.

One option for me is to make flat terrain but it kills immersion. I ran out of ideas here Is there any way I can get of terrain by either terrain texture or by shader ?
Sample Image

EDIT: GetinterpolatedCode

         for (int i = 0; i < position.Length; i++)
        {//position is array contains info of all vectors
         //t is terrainData
            q = t.GetInterpolatedHeight(position[i].x, position[i].z);
            position[i] = new Vector3(position[i].x,q, position[i].z);
            print(position[i]+"//"+ t.GetInterpolatedHeight(position[i].x, position[i].z));
        }

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:
Native crashes on UE4 android game only in distribution build As I build my game for development mode and install it directly from apk file to my device, it runs without errors and doesn't crash, there are in-game ads and it is able to get variables from game-saves.

But once I build with Shipping and Distribution tags and upload it to Google Play I get errors on all devices that it is tested. (Installing directly through apk also crashes it.)

Here are backtraces-

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'motorola/harpia/harpia:6.0.1/MPI24.241-2.35-1/1:user/release-keys'
Revision: 'p1b0'
ABI: 'arm'
pid: 14791, tid: 14855, name: Thread-932  >>> com.MadElectron.FarmPlanet <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    r0 00000000  r1 00000000  r2 00000001  r3 00000000
    r4 000084fa  r5 95bd3280  r6 00000000  r7 00002888
    r8 9dbb5fd4  r9 980edb20  sl 96d7f100  fp 9dbb5f88
    ip a274d504  sp 9dbb5f60  lr 9fd0eed4  pc a162ad24  cpsr 20070010
backtrace:
    #00 pc 0344dd24  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN22FSessionServicesModule13StartupModuleEv+72)
    #01 pc 01b32058  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN14FModuleManager27LoadModuleWithFailureReasonE5FNameR17EModuleLoadResultb+432)
    #02 pc 01b31e98  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN14FModuleManager10LoadModuleE5FNameb+76)
    #03 pc 0196bee8  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_ZN11FEngineLoop4InitEv+1752)
    #04 pc 0196aa10  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (_Z11AndroidMainP11android_app+2568)
    #05 pc 0196e618  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so (android_main+108)
    #06 pc 01981bc8  /data/app/com.MadElectron.FarmPlanet-1/lib/arm/libUE4.so
    #07 pc 00041acb  /system/lib/libc.so (_ZL15__pthread_startPv+30)
    #08 pc 00019355  /system/lib/libc.so (__start_thread+6)

sentences:
Partially colorizing a sprite in XNA I'm looking for a clean way of making sprites that look like the following glowing circle, except in any arbitrary colour.

Originally we thought we could start with a gray-scale version of the above image (shown below) and then use the tint parameter in spriteBatch.Draw to change the colour of the glow.

The problem is that because spriteBatch.Draw uses multiplicative blending to blend the tint and the colour the white parts don't stay white, they become the colour of the tint. The next image shows (approximately) what this looks like.

The other solution we thought of is to have two separate sprites, a white interior and a grayscale glow, and then we apply the tint to the glow and draw that on top of the white interior. This produces the desired effect (to a degree) but is annoying on our part since it requires is to double all the sprites we want to draw this way.

Is there any other cleaner solution that produces the desired effect for an arbitrary colour?

sentences:
How can I render cloud patterns like in these examples? I have a quick question.

I see in many games, usually in the menu, some moving "clouds" in the background, apparently additive blended into each other, which does a really nice job immersing the player, in my opinion.

A couple of examples that jump to mind right now are the Far Cry 3 main menu background: https://www.youtube.com/watch?v=B5XcMx3GjPA

and the Plague Inc main menu background: https://www.youtube.com/watch?v=RQv60ywrLxU (the first seconds show it)

These cloudy patterns seem like some kind of noise to me, like Perlin or other. So, how would you proceed to achieve that kind of blurred cloud effect with vivid colors?

More specifically, would you pre-generate sets of clouds and include them in the game package? Or generate them on-the-fly? On the CPU as a regular texture or on-draw in the GPU shader program?

I am interested in mastering this kind of visual effect, and as such any help would be appreciated pointing me in the right way. Thanks.

sentences:
Storing Users Character in MySQL Database Just asking a quick question about storing Characters in a database.

I am currently implementing a MySQL Database to store character data, using this current structure

Character Table:

playerUsername: VARCHAR(255)
characterName: VARCHAR(255)
idCharacter: INT(11)

Which is working fine to get all the characters that a certain person has.

While implementing this I was wondering how I would go about storing the character model data, like in WoW or other MMO's. Do they store all the models you create locally? or is that somehow stored in the database.

I have found a few structures online but they mainly contain character names and id not how the individual models are stored.

Any help on this would be greatly appreciated

sentences:
OpenGL - white edges on cubes In a minecraft-like game I'm making, I get white edges on my cubes:

It is much more noticeable in darker textures. The textures are being setup like this:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

Any help?

sentences:
How to rotate an object so it stands correctly (back always facing the camera) I have the following scene:

And I have two 3D vectors, the camera position, and the focus position. The focus vector is always behind the monster. I know how to rotate the camera around the focus with the help of my mouse, but the monster is always facing the same direction, and I'd like to change that!

I'd like it to work almost as in World of Warcraft; while I'm standing still I can move the camera around freely, but as soon as I move, the monster should change the direction according to the camera.position >>> focus vector. Also, I need to make it move in that direction, I guess I could have a 2D vector called speed, which I should change accordingly (it would look like a rotating radius of a circle I guess).

How do I do this?

For reference, I'm working in Three.js, and this is the code with which I rotate the camera:

onDocumentMouseDown = function(event)
{
    event.preventDefault();

    game.isMouseDown = true;

    game.onMouseDownTheta = game.theta;
    game.onMouseDownPhi = game.phi;
    game.onMouseDownPosition.x = event.clientX;
    game.onMouseDownPosition.y = event.clientY;
}

onDocumentMouseMove = function(event)
{
    event.preventDefault();

    if (game.isMouseDown)
    {
        game.theta = -((event.clientX - game.onMouseDownPosition.x) * 0.5) + game.onMouseDownTheta;
        game.phi = ((event.clientY - game.onMouseDownPosition.y) * 0.5) + game.onMouseDownPhi;
        game.phi = Math.min(160, Math.max(20, game.phi));

        game.cameraBuff.x = game.radious * Math.sin(game.theta * Math.PI / 360 ) * Math.cos( game.phi * Math.PI / 360 );
        game.cameraBuff.y = game.radious * Math.sin(game.phi * Math.PI / 360 );
        game.cameraBuff.z = game.radious * Math.cos(game.theta * Math.PI / 360 ) * Math.cos( game.phi * Math.PI / 360 );
    }
}

And at render time I do this:

self.camera.position.x += self.cameraBuff.x;
self.camera.position.y += self.cameraBuff.y;
self.camera.position.z += self.cameraBuff.z;

self.camera.lookAt(self.focus);
self.renderer.render(self.scene, self.camera);

self.camera.position.x -= self.cameraBuff.x;
self.camera.position.y -= self.cameraBuff.y;
self.camera.position.z -= self.cameraBuff.z;

sentences:
How big can a background file in Unity be? I want to start a new 2D top-down project in Unity and want to figure out how to organize my background (one big file or a lot of files joined together).

So how big can a background file get in Unity?

The target platform is Windows.

sentences:
How can I fix the "fisheye" distortion in my raycast renderer? I've just started making a 'raycast' engine, a pseudo 3D FPS engine similar to Wolfenstein/Doom. I haven't done much reading so my implementation is likely very naive.

My current working prototype has a 'fisheye' distortion [2nd image] which makes sense because the middle of the wall is closer than the far edges, but this is not how Doom looks.

What's the right way to do this? an orthogonal projection seems wrong because you would lose the foreshortening.

sentences:
Pivot not updating programmatically I have a canvas.  It has an empty game object as a child.  That object has a RectTransform component.  The RectTransform pivot value is set to 0.4, 0.5 (x, y).
In some code I wanted to update the pivot value using the following:

Debug.Log(((RectTransform)transform).pivot);  // logs: (0.4, 0.5)
((RectTransform)transform).pivot.Set(0.3f, 0.8f);
Debug.Log(((RectTransform)transform).pivot);  // logs: (0.4, 0.5)

I don't know why the set command is not working.  The tooltip for Set is: "Set x and y components of an existing Vector2"

sentences:
Why aren't the changes to the transform being applied? I don't understand why this doesn't work. The code only acts when I press "Horizontal" buttons.
Here's the code:
using UnityEngine;
using Flycer.Helpers;

namespace Flycer.Controllers
{
    public class MovementNew : BaseController
    {
        #region ========== Variables ========

        [SerializeField] [Tooltip("Forward moving speed")] [Range(0, 1f)] float _forSpeed = 0.5f;
        [SerializeField] [Tooltip("Slide speed")] private float speedSlide = 10;
        [SerializeField] [Tooltip("Max slide distance")] private float maxSlide = 4;

        private Vector3 _curPos;
        float slide = 0;
        int i = 1;

        #endregion ========== Variables ========

        #region ========== Unity-time ========

        private void Start()
        {
            base.On();
            _curPos = transform.position;
        }

        private void Update()
        {
            if (!Enabled)
                return;

            if (Input.GetButton(Controls.Horizontal.ToString()))
                Moving();
        }

        private void FixedUpdate()
        {
            _curPos += new Vector3(0, 0, _forSpeed);
        }

        #endregion ========== Unity-time ========

        #region ========== Methods ========

        void Moving()
        {
            slide = Input.GetAxis("Horizontal") * speedSlide;

            _curPos.x += slide * Time.deltaTime;

            _curPos.x = Mathf.Clamp(_curPos.x, -maxSlide, maxSlide);

            transform.position = _curPos;
        }

        #endregion ========== Methods ========
    }
}

It doesn't move in any condition whether it has a RigidBody or not.

sentences:
Reducing disk space needed to use TextMeshPro in AssetBundles My game uses AssetBundles, and quite often each of those bundles use TextMeshPro. The project is at a stage where it would be unwise to change to Addressables.

Anyway, I noticed that when a bundle has TextMeshPro involved, it easily adds roughly 2mb to the bundle - I assume it's a copy of all the dependencies to make it work.

Ideally all bundles should simply point to one copy which is guaranteed to always be present in the game, which I think Addressables sort of does, but as mentioned we cannot use it for this project for various reasons.

One way is to create/add the TextMeshPro components at runtime (e.g. have some kind of "placeholder/dummy" component that, upon Awake() will add TextMeshPro with various preset attributes).

That would work fine, and I'm willing to do that - but perhaps there are less tedious alternatives (other than Addressables) that I haven't thought of.

The goal is to be able to reduce the disk space required for each bundle just because it is using TextMeshPro components.

sentences:
Is there a difference in these two ways of rendering sprites? I use an OrthogonalTiledMapRenderer:

renderer = new OrthogonalTiledMapRenderer(world.getMap());

and I wonder if there is a differnce between this call:

renderer.getSpriteBatch().draw(sprite, sprite.getX(), sprite.getY());

and this:

sprite.draw(renderer.getSpriteBatch());

If there is a difference, what is it?

sentences:
unsmooth blending with deferred shading and light volumes So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by rendering the back faces of spheres with the radius of the light). To "add" the color of two separate lights i used blending
glCullFace(GL_FRONT);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);

(while in the single light pass i just added the light values to the rgb color)

Else both light calculations are the same.
Yet i get those weird "lines" where one pixel is being lit by more than one light source, whereas the single pass results in a smooth transition.
I guess the problem is the blending equation, but i can't find a solution.
The resulting color of the light volume shader looks like this
//d is the normal/light direction equation
//sp is the specular value
//att is the attenuation
//diff is the material color
color = vec4(diff * light_color * (d + sp) * att, 0.0);

The described values should be right.

sentences:
Finding the contact point with SAT The Separating Axis Theorem (SAT) makes it simple to determine the Minimum Translation Vector, i.e., the shortest vector that can separate two colliding objects. However, what I need is the vector that separates the objects along the vector that the penetrating object is moving (i.e. the contact point).

I drew a picture to help clarify. There is one box, moving from the before to the after position. In its after position, it intersects the grey polygon. SAT can easily return the MTV, which is the red vector. I am looking to calculate the blue vector.

My current solution performs a binary search between the before and after positions until the length of the blue vector is known to a certain threshold. It works but it's a very expensive calculation since the collision between shapes needs to be recalculated every loop.

Is there a simpler and/or more efficient way to find the contact point vector?

sentences:
How can I efficiently change the color of a BufferedImage? I am trying to change the color of a white BufferedImage image.

I do know that you can use .setRGB(x,y,rgb) and simply run some nested for loops and make changes to one pixel at a time. However, the problem arises when it comes to gradually changing the color instead of instantly doing so. This means I would have to run thousands of loops every runtime, completely ruining the frame rate.

My question is, is there a way to just change the color of an image right away?

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 make use of resizable BAR? From what I understand, resizable BAR (aka. Smart Access Memory) makes it possible to access the whole GPU memory from CPU code. But how can a programmer make use of that?
Is there an example or code snippet somewhere, that makes use of that feature? Or is that just an automatic that improves the performance of staging resources?
I'd also be happy if you can recommend further search terms that I can look up.

sentences:
Why don't I see tile-based 3D graphics? As we know, tiles can make it quicker to update large portions of the display at once, as compared with a bitmap. To put, say a letter, on the screen, the Commodore 64 typically does two writes (the screencode and the attribute), but the ZX Spectrum typically does 9 (eight bytes which make up an 8x8 bitmap, plus 1 for the attribute).

Recently, a demo for the SEGA Genesis was released called Red Eyes. My understanding is that the 3D scenes were rendered on a PC, and some kind of program converted these animations to a tileset so that each frame can quickly be written into VRAM.

But, however hard I search I cannot find any contemporaneous games for these retro systems which use a tileset to render (an approximation of) three-dimensional graphics. So is there a technical reason for that?

The nature of this question is such that it could be answered in the following ways:

It wouldn't work because ...
You obviously weren't looking hard enough because here's an example of a game that does that. Here's a disassembly or source code so you can figure out how it worked
It might be possible, but you'd have to watch out for ...

sentences:
Cant find a way to set fps for sf::Time Myclass
{
void run();
sf::Clock m_clock;
float m_time;
float timestep
}
Myclass::run()
{
if (m_time>= timestep)
{
//update
m_time-=timestep;
}
restartCLock();
}
Myclass::restartCLock()
{
m_time+=m_clock.restartAsSeconds();
}

How do i do the same but when m_time is being sf::Time?

sentences:
Testing Unity 2D Physics I am looking to push the 2D physics in Unity to the extent where when so much is going on that there becomes noticeable lag in a game. This is for testing purposes, so that when so much is going on that a button can be pressed to reduce the amount of physics objects on screen then see what affect that has. So in my small 2D demo I have placed alot of barrels on the map, all of which have physics on them, player bumps into them and they move. I have went to the extent of placing alot of them on the map (864 to be exact), bumping into them I still don't see any effect on the gameplay. Other things I have tried, besides adding alot in, is increasing the mass of the barrels, changing their linear and angluar drag and making them bouncy.

Is there anything I can do besides adding alot more in?
Thanks!

sentences:
Timestep schemes for physics simulations The operations used for stepping a physics simulation are most commonly:

Integrate velocity and position
Collision detection and resolution
Contact resolution (in advanced cases)

A while ago I came across this paper from Stanford that proposed an alternative scheme, which is as follows:

Collision detection and resolution
Integrate velocity
Contact resolution
Integrate position

It's intriguing because it allows for robust solutions to the stacking problem.  So it got me wondering...

What, if any, alternative schemes are available, either simple or complex?  What are their benefits, drawbacks, and performance considerations?

sentences:
Problem with box2d at beggining I have problem with simple box2d physics: I have two bodies : 1 - static box , 2 - dynamic box. I only want to this dynamic box fall on this static, and lay. But now it looks like that at end , starting from  . This is code, which bases on box2d HelloWorld:

#include <SFML/Graphics.hpp>
#include <Box2D/Box2D.h>
#include <cstdio>

int main(int argc, char* argv[])
{
    B2_NOT_USED(argc);
 B2_NOT_USED(argv);

 b2Vec2 gravity(0.0f, -10.0f);
 bool doSleep = true;
 b2World world(gravity, doSleep);

 b2BodyDef groundBodyDef;
 groundBodyDef.position.Set(0.0f, -10.0f);
 b2Body* groundBody = world.CreateBody(&groundBodyDef);
 b2PolygonShape groundBox;
 groundBox.SetAsBox(50.0f, 10.0f);
 groundBody->CreateFixture(&groundBox, 0.0f);

 b2BodyDef bodyDef;
 bodyDef.type = b2_dynamicBody;
 bodyDef.position.Set(0.0f, 300.0f);
 bodyDef.active = true;
 b2Body* body = world.CreateBody(&bodyDef);
 b2PolygonShape dynamicBox;
 dynamicBox.SetAsBox(3.5f, 3.5f);

 body->SetTransform(b2Vec2(0,100),30);

 b2FixtureDef fixtureDef;
 fixtureDef.shape = &dynamicBox;
 fixtureDef.density = 1.0f;
 fixtureDef.friction = 0.3;

 body->CreateFixture(&fixtureDef);

 float32 timeStep = 1.0f / 60.0f;
 int32 velocityIterations = 6;
 int32 positionIterations = 2;

    sf::RenderWindow app(sf::VideoMode(800, 600), "BOX/SFML");
 app.UseVerticalSync(true);
 sf::Shape shape = sf::Shape::Rectangle(-3.5f,-3.5f,3.5f,3.5f,sf::Color::Green);
 sf::Shape groundShape = sf::Shape::Rectangle(-50,-10,50,10,sf::Color(100,40,120));

    while (app.IsOpened())
    {

        sf::Event event_;
        while (app.GetEvent(event_))
        {

            if (event_.Type == sf::Event::Closed)
                app.Close();
        }

  world.Step(timeStep, velocityIterations, positionIterations);
        world.ClearForces();

  b2Vec2 position = body->GetPosition();
  float32 angle = body->GetAngle();
  b2MassData m;

  body->GetMassData(&m);
  printf("m %f\n",m);
  printf("%4.2f %4.2f %4.2f\n", position.x, position.y, angle);

  app.Clear();
  shape.SetPosition(position.x+400,-position.y+300);
  shape.SetRotation(angle);
  app.Draw(shape);
  groundShape.SetPosition(0+400,10+300);
  app.Draw(groundShape);

        app.Display();
    }
 world.DestroyBody(groundBody);
 world.DestroyBody(body);
    return EXIT_SUCCESS;
}

I looking for any advice for solve this problem. And another problem, why mass of dynamic shape is 0 ?

sentences: What are names like "net.minecraft.blocks" called? I'm trying to find these types of names for certain Minecraft blocks to add them to a block whitelist for one of my mods. Is there an actual name for these? If not, how would I go about finding a list of or searching for them?

sentences:
Circle physics and collision using vectors This is a problem I've been having, When making a set number of filled circles at random locations on a JPanel and applying a gravity (a negative change in the y), each of the circles collide. I want them to have collision detection and push in the opposite direction using vectors but I don't know how to apply that to my scenario could someone help?

public void drawballs(Graphics g){
    g.setColor (Color.white);

    //displays circles
    for(int i = 0; i<xlocationofcircles.length-1; i++){
    g.fillOval( (int) xlocationofcircles[i],  (int) (ylocationofcircles[i]) ,16 ,16 );
    ylocationofcircles[i]+=.2; //gravity
    if(ylocationofcircles[i] > 550) //stops gravity at bottom of screen
    ylocationofcircles[i]-=.2;

    //Check distance between circles(i think..)
    float distance =(xlocationofcircles[i+1]-xlocationofcircles[i]) + (ylocationofcircles[i+1]-xlocationofcircles[i]);

    if( Math.sqrt(distance) <16)
    ...

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:
OpenGL: Avoid geometry shader for cubemap framebuffer I want to render an environment map into a cubemap framebuffer but I dislike the fact, that I have to use the geometry shader to set gl_Layer because the geometry shader would be a basic passthrough shader. Additionally a geometry shader could stall the pipeline and decrease performance.

I would rather like to use instanced rendering and set gl_Layer in the vertex shader but
unfortunately this is only possible with the AMD_vertex_shader_layer extension.

Is there any other way to set the layer in the shader?

sentences:
How can I continue to rotate a 2D UI Object using OnPointerEnter when object is on its side? (OnPointerExit is triggered) I have been wracking my brain on this for days. I'm trying to create a nice looking hand of cards, when the card is hovered over, it bobs up and down and rotates. This is triggered by OnPointerEnter, however, whenever it turns on its side and out of the mouses path OnPointerExit triggers, I've tried MANY things, including a bool that triggers the hover effect OnPointerEnter but it is just toggled off when it's turned on its side.

Is it possible to use the collider on my card with OnPointerEnter? Because that would probably solve my problem but haven't found anything on this.

Since the card is on UI, I have some placeholder code in there in order the have the inspected card render on top and return to its place.

    void Update()
{
    if (inspect)
    {

        transform.localScale = cardUpscale;

        posOffset = transform.position;

        transform.Rotate(new Vector3(0f, Time.deltaTime * degreesPerSecond, 0f), Space.World);

        // Float up/down with a Sin()
        tempPos = posOffset;
        tempPos.y += Mathf.Sin(Time.fixedTime * Mathf.PI * frequency) * amplitude;

        transform.position = tempPos;
    }
}

public void OnPointerEnter(PointerEventData eventData)
{
    zoomPlaceholder = new GameObject();
    zoomPlaceholder.name = "zoomPlaceholder";
    zoomPlaceholder.transform.SetParent(this.transform.parent); //binds the placeholder to the hand
    zoomPlaceholder.transform.SetSiblingIndex(this.transform.GetSiblingIndex());

    LayoutElement cardProxy1 = zoomPlaceholder.AddComponent<LayoutElement>();
    cardProxy1.preferredHeight = this.GetComponent<LayoutElement>().preferredHeight;
    cardProxy1.preferredWidth = this.GetComponent<LayoutElement>().preferredWidth;
    cardProxy1.flexibleHeight = 0;
    cardProxy1.flexibleWidth = 0;

    zoomPosition = transform.parent;
    transform.SetParent(transform.parent.parent);
    inspect = true;
}

public void OnPointerExit(PointerEventData eventData)
{
    inspect = false;

    this.transform.SetParent(zoomPosition);
    this.transform.SetSiblingIndex(zoomPlaceholder.transform.GetSiblingIndex());

    transform.localScale = cardNormalScale;

    Destroy(zoomPlaceholder);

}

sentences: How can I get Unity to do letterbox/pillarbox to maintain aspect ratio? I'd like my game to have the same aspect ratio at all cost, including keeping all UI elements fixed in the same place. I'm totally ok with losing screen space in the interest of fixing the aspect ratio.

sentences:
Out of screen position to inner screen position I don't know how I could solve this.
I'm trying to accomplish this:

 So if a object is out of my screen I would like to calculate the position it would be inside of the screen. Searched already but did not found any help for this problem. You can see this in games like cod where it shows you from which direction you got hit by a bullet.

Thanks in advance.

sentences:
Directional light causes an FPS drop I have only one object in the scene and it is lit with a directional light. It uses the mobile/diffuse shader. The issue is that on iPhone 4 the FPS drops from ~42FPS to ~11FPS when the directional light is enabled. Rendering is set to forward rendering and there are no other light sources. Shadows are not enabled.

Scene stats give a total of five draw calls, 3k tris and 2.6k verts. Having a single directional light should not have that kind of effect on FPS. What could cause this FPS drop?

sentences:
How to find and manipulate a line on a mesh? In Unity I currently have a script that allows me to "grab" a vertex, move it, and then update the mesh accordingly. How would I grab a line (which is basically grabbing two vertices I think) and move it?

I have read the manual (the scripting reference on Unity's site) but I can't really seem to figure out how to go about doing it. I got a lot of help with the initial script that lets me grab and move a vertex but I, unfortunately, am in need of guidance on how to extend its functionality to do what I described above.

For reference here are how things currently are working. Linked it because it says my gif is too big. Below is the functionality I'd like to add (hover over for text for further explanation).

So how would I go about doing this? Also for the sake of keeping my project stable, I'm using Unity 5.3.2f1 but converting new to old code shouldn't be that big of a deal (or so I hope). Also I'mn doing this all at runtime.

sentences: Artemis Framework - delete all entities with a given type of component In artemis framework how can I list all entities wtih a given type of component and delete them from the world? I couldn't find any examples in the documentation and it seems there's no straightforward way of doing this

sentences:
Security-minded design patterns / paradigm for client/server application I am working on a client/server application and am starting to take it from proof-of-concept to actual implementation.  The client is an Android application and the server is in PHP.  In similar applications, I'd always simply created a PHP class with appropriate MySQL calls to return JSON objects.

This particular application is a game where clients will end up interacting with each other.  My goal is to start with a good basis for security so that I can avoid issues in the future such as duping or other scamming techniques.  Obviously, good separation of client and server is one of the keys.  Normally I would move to an MVC approach, however it has been suggested that a more RESTful design (e.g., here) would be more secure (or at least a better approach), but I don't really see the benefit other than using a different paradigm.

My question then is twofold.  For a client/server application where clients may need to interact/chat/trade, what is a proper paradigm / design pattern to base a server on.  Second, is a RESTful design necessary in this case, or is it a programmer's preference?

Edit: I may have had a misunderstanding of REST, and have done some more reading.  A more precise question for this community, then, would be what should I build into my API at the outset of development to ensure that I don't run into security issues involving user interactions.  For example, say that two users indicate that they wish to trade.  My current approach would be for User1 to send the trade request to the server, which then delivers it to User2.  Each selects the items to be traded, and that information is passed between each client to the server, which then notifies the opposite client as to the details of the trade.  Upon acceptance from each client (either no time limit or a fairly longish time limit...this is not a real-time game), the server then swaps whatever database entries make up the particular inventory selection between the appropriate users.

A second example would simply be a client/server interaction.  Assuming that I am limiting client actions to be Attack MonsterA or Defend or Attack MonsterB (in the form of buttons), do I need to consider much from a security perspective other than validating that the client can in fact perform whichever action has been sent?

sentences:
How to resolve a sphere-mesh collision? I'm making a rolling-ball type game, and I can't seem to get my sphere-mesh collision code working properly.

Currently what I have for the main loop (in regards to collision) is the following:

Calculate player acceleration based on input
Clamp velocity to avoid clipping
Add velocity to position
Add acceleration to velocity
For each solid object:
    Check for collision for this object and resolve (how I do this is below)

If there were any collisions:
    Normalize accumulated normal vector (explained below)
    Slow down ball to account for friction

I tried two main methods for resolving collisions, each with their own problems.

The first method:

For each triangle:
    If there is a collision:
    Correct player velocity along normal based on distance
    Accumulate normal for friction calculations later
    If velocity perpendicular to surface is above threshold:
        Rebound ball off surface with damping factor
    Otherwise, if moving toward surface instead of away:
        Clear perpendicular velocity

The problem with this method is, when I hit a wall, the player will begin to bounce erratically. The collision I'm using to test this looks like this (player to scale):

The second method is similar to the first:

Set collision distance accumulator to arbitrarily high value
Set triangle index to -1 (to denote that there's no collisions)

For each triangle:
    If there is a collision:
        Calculate collision distance
        If this distance is smaller than the accumulator value:
            Set triangle index to current triangle
            Set collision distance accumulator to current distance value

If the index is not -1 (there was a collision):
    Correct player velocity along normal based on distance in accumulator
    Accumulate normal for friction calculations later
    If velocity perpendicular to surface is above threshold:
        Rebound ball off surface with damping factor
    Otherwise, if moving toward surface instead of away:
        Clear perpendicular velocity

This fixes the bounciness issue, but now I can go partially through surfaces which are supposed to be solid.

I have no idea where to turn at this point. Hopefully someone here can provide some insight as to what's going on.

[EDIT] I can add some video if that'd help anyone.

[EDIT 2] Here's a link of a video using the first method:
https://drive.google.com/open?id=1n1MxTYQkzKA2eixTkEOD3E7eOd0Ryl4f

[EDIT 3] I redid the code somewhat, here's some related code snippets:
https://pastebin.com/GQd9bwgB

It still bounces, like so:
https://drive.google.com/open?id=1JPJ4lkIB0wBhjnlT5mawxKwq0dC6DlNr

I think I know the cause, but I don't know how to best fix the issue.

sentences:
Unreal doesn't see Visual Studio 2019 I have Visual Studio 2019 installed, with all of the tools mentioned in the Unreal documentation installed, and when I try to create a C++ project in Unreal Engine, I get "No compiler was found. In order to use a C++ template, you must first install Visual Studio 2017.".

I don't have VS 2017 and would prefer not to get it because I'm using a metered connection. According to the Unreal documentation, VS 2019 is indeed supported but that doesn't seem to be the case here.

Any idea what's wrong?

sentences:
Collision Detection fails with AI cars I am making a car parking game in flash and AS3 wherein I drive my car along with other AI traffic cars moving along a specified path using Guidelines.
I am using CDK for collision detection.
The collision detection works fine with few AI cars, but doesn't seems to be working as required for few AI cars.
When an AI car is moving on a path in a straight line it works fine.... but when the AI Car turns at 90 degress..... my car goes into the AI car (Overlapping) and it hits at the center of that AI car and then collision is Detected....  .....
I made a New path and used a new Sprite for AI car... but still the problem pursues....

I have attached the png of collision.
https://dl.dropbox.com/u/53998590/Collision.png
The AI traffic comes from Top Left corner and moves down towards
bottom right corner.
The problem persist with this kind of movement.
when I change the movement of same AI cars from bottom right corner
and moves up to top left corner then the problem does not exist.
I had used CDK for collision detection.
my code is as follows.
addCollisonItem(mcAICars);

public function addCollisionItem(mc:MovieClip)
    {
        collisionlist.addItem(mc);
    }

var collArray:Array;
collArray = collisionFunction();

if (collArray.length > 0 && isCarCollided==false && game.stopCar ==false)
        {

            trace("Car Collided");

            isCarCollided = true;
            game.stopCar = true;

            if (speed >= 2) {
                speed = 1.5;
            }

            speed = -speed;

            if (accelerate && isCarCollided)
            {
                //reverse = false;
                speed = -1.5;
                //  return;
            }
            else if (reverse && isCarCollided)
            {
                //accelerate = false;
                speed = 2;
                //  return;
            }

            reduceLife();

            setTimeout(startCar, 500);

        }

Regards,
Amit

sentences: How can I maintain a contiguous area when generating a tilemap using Wave Function Collapse? I'm using Wave Function Collapse to generate a tilemap, and I'm trying to come up with a way to maintain a contiguous area during generation. As an example: ensuring all "walkable" tiles are contiguous such that no "walkable" tile is blocked off from another. An acceptable outcome would also be ensuring there is a contiguous path between two (or more) designated tiles. I'm thinking there may be some way to determine how likely any given tile is to bisect a contiguous area and integrate that into the entropy calculation, but I'm not sure how I would determine that.

sentences:
Rotation, further I go from 0:0, the further the object positions around the origin while rotating For some reason I am having the issue where the following code:

 global.spriteBatch.Draw(obj.sprite, obj.getPosition(), null, Color.White, obj.rotation, obj.center, 2f, SpriteEffects.None, 1);

causes the object to rotate around the origin in such a way, as though there is an offset to the position relative to its location. The calculation for the center it correct and this happens even if I set the pivot to be the location of the object. The further I get from 0:0 the larger the radius or rotation. I am not sure what is going on here because given the following tutorial

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Rotation.php

I have done the code setup correctly. Any ideas? Any help is greatly appreciated!!!

sentences:
Getting fastest path on a grid How would I go about finding the fastest path to connect two points on a grid? I'm making a 2D game and the map is based around a grid.

I need to be able to account for any blocked tiles that the path need be able to go through.

Example: http://imgur.com/BbtnR
The blue line being what I need to figure out, and the red tiles being the blocked tiles.

Where should I start? Any advice be would great!

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:
Scrolling and Parallax scrolling in 2D game I'm developing a 2D side-scrolling game.I have a scrollable bitmap for background with size 2400x480.How can i scroll this bitmap?I have searched for algorithms but i can't find any solution.

I know that i can do it with following code:

for(int i=0;i<100;i++)
draw(bitmap,2400*i,480);

So it will scroll bitmap for 240000 pixels.

But i don't want to draw images which stays out of screen(with size 800x480).

How can i render scrolling tile?How can i give velocity to it?(For parallax scrolling after normal scrolling)

sentences:
How to store references to scene objects in prefabs? i am instantiating a few game objects in my scene using prefabs and i would like to attach a script to some of them to do something at a certain time but for that i need to reference to scene objects and its not allowing me. anyone know why? and whats the workaround?

i can pull those prefabs into my scene and use them as game objects but that would destroy the idea of prefabs isn't?

sentences:
player movement variable is not being set to false i have a player with a basic movement. when i press W he just keep on going
this my code
private void fixedupdate
{
    rigid.AddForce(new Vector3(0, 0, 10) * speed, ForceMode.Impulse);

    moveup = false;
}

sentences:
Playing Sounds and removing instances once they have played -- Android I am playing sounds in my application I have the following code

sounds = new HashMap<String, MediaPlayer>();

Then when guys are created on screen they are given a sound.

sounds.put("sounds"+Integer.toString(ncount), MediaPlayer.create(this, R.raw.hit));

I want to remove the MediaPlayer from the hashmap like I do the enemies when they die

sounds.get("sounds"+Integer.toString(ncount)).setOnCompletionListener( new MediaPlayer.OnCompletionListener() {

    public void onCompletion(MediaPlayer mp) {

        sounds.remove("sounds"+Integer.toString(ncount));
    }

});

This errors out... how would I reference the sounds hashmap to remove the associated MediaPlayer when sound is complete?

Thanks!

sentences:
Depth of Field Blur - Weighted sampling? I've been studying Intel's fantastic article titled "An investigation of fast real-time GPU-based image blur algorithms" (here), where-in they state that Gaussian blur would need to be customized for proper use in achieving a depth-of-field effect. The relevant part states:

  They are all generic algorithms that are fully applicable to effects
  like a Bloom HDR filter. However, in a specific scenario, for example
  for use in Depth of Field, they would require additional customization
  (such as weighted sampling to avoid haloing/bleeding) which can impact
  relative performance.

However they don't go into detail about how to compute the weighted sampling? Does anyone know what this means, or know of relevant documentation / example code?

I have been using guassian blur for DoF and have indeed seen the bleeding and other artifacts, so I've been looking for ways to solve these problems.

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:
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:
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: What is a "cue" in the XACT API? I understand that a wave bank is a collection of .wav data files and that a sound bank is a collection of tracks, each having a .wav with properties. But what is a cue?

sentences:
Collision on the first rectangle only - Why? I've made a very simple collision detection, it works fine. However, when I decided to load in all my rectangles into a list and then give each of them collision, it only adds it to the first one. Any ideas? I've tried it with a for loop as well.

Here's the code:

    Rectangle interaction, interaction2, interaction3;

    List<Rectangle> collisionList = new List<Rectangle>();

        public GamePlayScreen()
            {

                interaction = new Rectangle(200, 200, 32, 32);
                interaction2 = new Rectangle(400, 200, 32, 32);
                interaction3 = new Rectangle(200, 400, 32, 32);

                collisionList.Add(interaction);
                collisionList.Add(interaction2);
                collisionList.Add(interaction3);

            }
    // This right here is just to show you guys that it is getting updated.
    // This is not the real update, I refrained from posting that since it might confuse
    // people.
    public override Update(GameTime gameTime)
    {
    CheckCollision();
        }

     float xx;
     float yy;

        private void

CheckCollision()
            {
                foreach (Rectangle rect in collisionList)
                {
                if (player.Sprite.Bounds.Y > rect.Top - 33 && player.Sprite.Bounds.Y < rect.Bottom && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.X > rect.Left - 30)
                {
                    player.Sprite.position.Y = yy;
                }
                if (player.Sprite.Bounds.Y < rect.Bottom && player.Sprite.Bounds.Y > rect.Top && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.X > rect.Left - 30)
                {
                    player.Sprite.position.Y = yy;
                }
                if (player.Sprite.Bounds.X > rect.Left - 30 && player.Sprite.Bounds.X < rect.Right && player.Sprite.Bounds.Y > rect.Top - 30 && player.Sprite.Bounds.Y < rect.Bottom)
                {
                    player.Sprite.position.X = xx;
                }
                else
                {
                    xx = player.Sprite.position.X;
                    yy = player.Sprite.position.Y;
                }
                }

            }

    //The Draw method

    spriteBatch.Draw(scrollDownButtonNormal, interaction, Color.White);
                spriteBatch.Draw(scrollDownButtonNormal, interaction2, Color.White);
                spriteBatch.Draw(scrollDownButtonNormal, interaction3, Color.White);

I will of course continue to work on this, and post a solution if I find one.

~Etarnalazure

UPDATE
Just checked with a boolean if the other boxes react, it changes to true. So it means it works just fine (I put the boolean in between each if loop to check if it registered any collision).

sentences:
Should my game handle collisions in the Player object? I'm making a 2D platform game. Right now I'm just working on making a very generic Player class. I'm wondering if it would be more efficient/better practice to have an ActionListener within the Player class to detect collisions with Enemy objects (also have an ActionListener) or to handle all the collisions in the main world.

Furthermore, I'm thinking ahead about how I will handle collisions with the platforms themselves. I've looked into the double boolean arrays to see which tiles players can go to and which they can't. I don't understand how to use this class and the player class at the same time.

sentences:
Box2d: Is there a way to have collisions but ignore the accompanying forces? To begin, I know that you can use filtering or isSensor to remove physical collisions. However, I would like to retain the ability to, say for example, stop when trying to move past another player. Essentially, I don't want one player to be able to push another dynamic body with the force that normally accompanies a collision. I've tried static and kinematic bodies, but both obviously have their own problems with trying to have collisions.

An example might be a topdown game such as League of Legends of Starcraft, where units can impede on eachother's movements, but don't apply any force upon collision.

sentences:
How do I detect collision between an ellipse and a rhombus? I'm building a game in C/C++ (been alternating between the two), but one of the biggest problems I've run into is collision detection. The game is isometric and exists on a 2x1 grid (e.g. the base tile is 32x16px).

Most creatures in the game use ellipses as collision masks (similarly 2x1 sized, default size is 32x16), whereas static objects use rhombuses for masks (again, 2x1, 32x16 default). How do I detect the collision of these two distinct shapes? Also, how do I detect collisions between two ellipses and/or two rombuses?

I've looked at the Separating Axis Theorem, Voronoi diagrams, and all kinds of other things, but I am having trouble understanding them (which is a pretty essential step for C/C++). Can anyone help me to understand these techniques?

sentences:
Problem with Rotating Third Person Radar UE4 I am doodling on the Flying game template on UE4. I am making a 2D radar on top left. Radar's north direction is the pawn's forward direction. So when it approaches to an object with the dotProduct value of 1, dot representing the enemy object on the map has to approach from direction (0, -1) on the coordinate system. Just like any shooter game.

My problem:

As I know, to calculate the x,y positions on the coordinate system with given angle and distance, the formula is as follows;

x = Cos() * dist, y = sin() * dist

As Unreal Engine's UI classes use top left as the pivot point, if an object is on absolute north of the origin on the screen, it has to come from (0,-1) as I wrote above.

Cos(270), sin(270) has to give 0,-1 and when I multiply with the distance, the dot has to be shown on absolute north of the origin point of the radar.

I declared two UProperties to play with the angles on the editor on runtime. When I enter 270, 270 for cos and sin values, it shows the dot as on the image below;

the closest to the top left is when I enter -90, 90 and it shows like in the image below;

Even if I am entering the incorrect values, I think at least an angle such as 90, 90 has to be perpendicular. Does anyone have any idea?

sentences:
Accessing entity config data without singleton Every entity has some stats which change over time and some which are static for a given type of entity. For example current hp vs max hp: lets say humans have max 100hp, then every human would have an int hp member, but it doesn't make sense to have a const int max_hp=100 for all the humans since it's always the same thing.

That can be solved by using static member variables, but here's the catch: I want to load all the stats such as max_hp from a config file when the app starts, which precludes use of static.

The only way I know how to reconcile these two things is to use a singleton object, which provides entities their stats via something like singleton::instance().model("human").stat("max_hp"). However, every mention of singletons I have ever seen has been in the context of warning against their use. And I wouldn't want to use it anyway, because then my entity update methods lose referential transparency.

So in short:

I want to avoid duplicating data.
I want to load that data from file.
I want to avoid global state.
Update methods must be pure functions.

What strategy can I use to meet these requirements?

I require update methods to be pure because my engine is built around the concept of updating every entity in parallel, and the way to do that is to have entity.update be a pure function which takes an immutable reference to the world and returns a new entity [0]. So every entity starts its update by making a copy of itself, which is then mutated as it goes through the update process, until finally being returned to the world to become the manifestation of that entity in the new generation. Now that would be a lot of copying if only the dynamic data were copied! But to also copy all the (duplicate) static data every frame is just crazy, and I'm looking for the approach which would let me copy only the dynamic stats while still having access to the model data.

[0] https://www.youtube.com/watch?v=Uooh0Y9fC_M

sentences:
Add buttons into List when mouse is HoldDown? I have three buttons in my menu. What I need to do is when I click on first button it becomes the first element in my list. Now, when I keep mouse button down and move it to the second button it becomes the second second element in my list. The same with the third button.
public List<GameObject> UI_Button_List = new List<GameObject>(3);

void Update()
{

    if (Input.GetMouseButtonDown(0))
    {

    if (UI_Button_List[0] == null)
    {
        UI_Button_List[0] = EventSystem.current.currentSelectedGameObject.gameObject;
    }

    if (UI_Button_List[0] != null && UI_Button_List[1] == null)
    {
        UI_Button_List[1] = EventSystem.current.currentSelectedGameObject.gameObject;
    }

    if (UI_Button_List[0] != null && UI_Button_List[1] != null && UI_Button_List[2] == null)
    {
        UI_Button_List[2] = EventSystem.current.currentSelectedGameObject.gameObject;
    }

    } // end if

}

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:
Xna menu navigation with controller I have a menu that you can navigate with the keyboard, but I also want it so you can navigate it with the controller thumb sticks. But my problem is that if you push down or up on the thumb sticks it will just fly through the menu. To fix problem if it was a keyboard you would just do: prevKeyState.IsKeyUp(Keys.Down).
So I was wondering if there anything like this for the controller thumb sticks?

I'm not sure if I'm doing something wrong but it still flies through the menu.

 private enum GamePadStates
    {
        None,
        GoingDown,
        GoingUp
    }

    GamePadStates CurrentGamePad, PreviousGamePad = GamePadStates.None;
     public void Update(GameTime gameTime)
    {
        keyState = Keyboard.GetState();
        gamePadState = GamePad.GetState(PlayerIndex.One);
        PreviousGamePad = CurrentGamePad;

        if (gamePadState.ThumbSticks.Left.Y > 0.1)
            CurrentGamePad = GamePadStates.GoingUp;
        else if (gamePadState.ThumbSticks.Left.Y < -0.1)
            CurrentGamePad = GamePadStates.GoingDown;
        else
            CurrentGamePad = GamePadStates.None;

        if (keyState.IsKeyDown(Keys.Down) && prevKeyState.IsKeyUp(Keys.Down) ||
             CurrentGamePad == GamePadStates.GoingDown && PreviousGamePad != GamePadStates.GoingUp)
        {
            if (selected < (buttonList.Count - 1))
            {
                selected++;
            }
        }

        if (keyState.IsKeyDown(Keys.Up) && prevKeyState.IsKeyUp(Keys.Up) ||
            CurrentGamePad == GamePadStates.GoingUp && PreviousGamePad != GamePadStates.GoingDown)
        {
            if (selected > 0)
            {
                selected--;
            }
        }

sentences:
Problem in blitting a clean, crisp sprite I am having a bit of a tooling problem...and I am unsure of how to solve it.

I am currently using PyGame to try and write a simple Minesweeper clone, except my sprites that I made are hexagon based and therefore have diagonal lines.

I drew up a nice, clean, crisp vector sprite set which looks very nice in Inkscape, however once I export it everything goes to hell.  I'm going to outline what I've done below and hopefully somebody here can set me straight :D

Disclaimer: Unfortunately I'm behind a proxy and cannot provide screenshots at the moment..I'll do my best to describe.

If I attempt to use a color key (0xFF00FF), then when I set the color key in PyGame I get a bunch of jagged pink edges along my sprite.  I believe this could be an anti-aliasing issue with Inkscape, but unfortunately my Googling didn't turn up a way to disable it.

If I import my PNG into Photoshop or the Gimp and delete the background, then I run into an issue where the background appears to be black when running the game.  I have tried to follow the instructions I saw on SO, but to no avail.

I am open to suggestions, but at this point I'm debating importing another library which can handle SVG graphics, in order to keep my clean, crisp diagonal lines.

sentences: Ruby Vs. C# - Better for Game Programming I have seen some games made in C#, such as using the XNA. I saw some games made in Ruby by using the RGSS1-3 API as well. I just can't decide on my own which would be easier to learn and apply for game programming. I want your opinion on which is better to make games with, is it Ruby or C#? What are the advantages and disadvantages of each?

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:
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:
How do 2D physics engines solve the problem of resolving collisions along tiled walls/floors in non-grid-based worlds? I've been working on implementing my SAT algorithm which has been coming along well, but I've found that I'm at a wall when it comes to its actual use. There are plenty of questions regarding this issue on this site, but most of them either have no clear, good answer or have a solution based on checking grid positions.

To restate the problem that I and many others are having, if you have a tiled surface, like a wall or a floor, consisting of several smaller component rectangles, and you traverse along them with another rectangle with force being applied into that structure, there are cases where the object gets caught on a false collision on an edge that faces the inside of the shape.

I have spent a lot of time thinking about how I could possibly solve this without having to resort to a grid-based system, and I realized that physics engines do this properly. What I want to know is how they do this. What do physics engines do beyond basic SAT that allows this kind of proper collision resolution in complex environments? I've been looking through the source code to Box2D trying to find out how they do it but it's not quite as easy as looking at a Collision() method. I think I'm not good enough at physics to know what they're doing mathematically and not good enough at programming to know what they're doing programmatically. This is what I aim to fix.

sentences:
Algorithmic error in tile engine? I'm toying with creating a tile-based 2D java game engine. I can render the "local" area without issues(I.E. deciding which local tiles to render). The problem came when I introduced floating point locations. I want my "camera" location to be a double. My thought was "I'll multiply the double by the tilesize, round it, and get a pixel approximation". That doesn't work, for one reason or another. The code below is the most functional code I've been able to construct. It works almost entirely correctly except around the 0,0 area it skips tiles(?) and it looks hackish and the code's overall hideous. Is there some easier method I'm missing here, is there an example I can examine?

private HashMap<Integer, HashMap<Integer, Tile>> tiles = new HashMap<>(); // Tiles stored here
public double cameraX = 0, cameraY = 0; // Camera location(centered on screen)
private final int TILE_SIZE = 100; // Size of tiles
private final int TILE_BUFFER = 5; // Buffer of tiles to be rendered/loaded around screen
private int screenTileWidth = 0, screenTileHeight = 0; // Tiles that fit onto the screen

@Override
public void render(Graphics g) {
    // Calculate tile width/height of screen
    int screenWidth = this.screenTileWidth + (TILE_BUFFER * 2), screenHeight = this.screenTileHeight
            + (TILE_BUFFER * 2);

            // Supposedly the offsets from the camera's location to be applied to the rest of the tile locations
    int locOffsetX = (int) Math.round((cameraX % 1) * TILE_SIZE);
    int locOffsetY = (int) Math.round((cameraY % 1) * TILE_SIZE);

            // Big mess of "eww" hackish stuff to fix negatives messing with things
    if (cameraX >= 0 && locOffsetX >= 0) {
        locOffsetX *= -1;
    }
    if (cameraX < 0 && locOffsetX < 0) {
        locOffsetX *= -1;
    }
    if (cameraY >= 0 && locOffsetY >= 0) {
        locOffsetY *= -1;
    }
    if (cameraY < 0 && locOffsetY < 0) {
        locOffsetY *= -1;
    }

            // Base offsets to center tile
    int offsetX = ((GameEngine.g.getWidth() / 2) - (screenTileWidth / 2)
            * TILE_SIZE)
            + locOffsetX;
    int offsetY = ((GameEngine.g.getHeight() / 2) - (screenTileHeight / 2)
            * TILE_SIZE)
            + locOffsetY;

    // Loop through loaded tiles(x/y tile coord)
    for (int x = (int) (Math.floor(cameraX) - (screenWidth / 2)); x < Math
            .floor(cameraX) + (screenWidth / 2); x++) {
        for (int y = (int) (Math.floor(cameraY) - (screenHeight / 2)); y < Math
                .floor(cameraY) + (screenHeight / 2); y++) {
                            // The screen-relative tile coord
            int sx = (int) (x - Math.floor(cameraX));
            int sy = (int) (y - Math.floor(cameraY));

                            // Tile pixel location
            int locX = sx * TILE_SIZE + offsetX;
            int locY = sy * TILE_SIZE + offsetY;

            // Draw box/location info
            g.setColor(Color.RED);
            g.drawRect(locX, locY, TILE_SIZE, TILE_SIZE);
            g.drawString(x + ", " + y, locX + 10, locY + 20);
        }
    }
}

sentences:
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 remove floating terrain when generated with 3D Perlin Noise? I'm currently using 3D Perlin Noise to generate random terrain in combination with Marching Cubes.

My issue seems to lie in scaling the noise function to get reasonable heights in my terrain. If only one octave is used, all points in relation to the noise are obviously interpolated which results in fairly smooth data. However, to get overhangs/caves/jagged terrain, I have to use multiple octaves with varying amplitudes and/or scale the resulting values to my 'max' height I want of the map.

I might be missing something, but by using marching cubes with 3D perlin noise, I regularly get floating bits of terrain.

Any ideas on how I could correct this or if there's other noise functions I might use to get results like I'm describing? I'm wanting hills/valleys/mountains/lakes/etc. No need for floating bits segregated from the rest of the map. I believe this is a similar issue to what Minecraft has when it has terrain that just floats around in the sky occasionally upon generation.

Thanks for any assistance,
Mythics

sentences:
How can I display and sort a game server list by latency in a scalable manner? If I have a game that allows players to self-host a multiplayer session which other players can join by browsing a game server browser to select a game I ideally want to be able to sort that list by latency, so that the lowest latency servers are top of the list.
I'm unsure about how to do this in a scalable manner, if for example there are 10,000 servers active at a given time, and 100,000 players looking for a game then it feels like every client receiving all 10,000 servers and pinging all 10,000 servers would generate excessive network traffic with 100,000 clients pinging each server on some regular interval; especially as some players may already be playing on some of these servers. This would mean each server receiving 100,000 ping requests on a regular basis.
I realise that I could reduce the servers sent back to the client from the master server list; it's unlikely any player would ever want to browse all 10,000 servers so I could reduce it to say, 200 servers or so as that is probably sufficient to find a suitable game. The problem here though is that I would still be unable to determine the 200 servers with the best latency without pinging all 10,000 from the client for all 100,000 clients browsing the server list to find that top 200 by latency.
I could register the latency between the host and the master server in the master server list, and return servers to the client whose latency most closely matches the latency between the client and master server list and hope that enough of these servers are close to the client; but the risk here is that a client that's 100ms from the master server and a server that's 100ms from the master server could either be next to each other (0ms apart) or could be opposite sides of the master server geographically so be 200ms apart. I could have regional master servers to mitigate some of the most extreme cases here, but it still feels like a very suboptimal solution.
Finally, there are other issues; if a self-hosted server needs NAT punch through for clients to connect, or a relay server, then any latency check would also require these things; this further complicates the problem; initiating NAT punchthrough just to check the latency to one of, say, 10,000 servers feels excessive.
Does anyone have any advice on how producing a scalable server list sorted by latency for each client can be achieved? This seems to be something a number of games have supported over the years so it must be possible.
Any suggestions, or advice as to how this problem is typically solved, or can be solved, would be greatly appreciated.

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:
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:
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:
Distribute circles evenly on Screen - circle packing I want to evenly distribute a random amount of circles with random diameter on the screen for. This level doesn't scroll so the users screen resolution sets the limits. Further I would like the circles to be as big as possible to fill out the screen.

I have no problem writing the code for collision detection and so on, my problem is the basic theory to solve this kind of problem.

My current approach doesn't work properly because the problem could be the following thing, where (1) is the first circle and (2) is the second circle and | is the "wall" or screen edge.

(1) (2)|
So if 1 and 2 overlap, I would move 1 half of the overlapping distance to the left, 2 with the other half to the right. I then see that 2 is already at the wall and can't be moved, so 1 must move the whole overlapping distance to the left.

How would I correctly approach this situation?

sentences:
How do i prevent my player from walking through mesh collider I have a character being moved using rigidbody.moveposition and I have an floating lowpoly island with a mesh collider. When my player walks into a steep slope or a wall, it passes right through. I assume this is because the mesh collider isn't thick enough but there must be a pretty simple fix. If anyone knows how to fix this it would be much appreciated.

Here's the code for the movement of my character.

private void Movement()
{
    if (AnimController.GetInteger("AnimPar") != 3)
    {
        if (Input.GetKey(KeyCode.LeftShift))
        {
            walkSpeed = initialWalkSpeed * 2;
        }
        else
        {
            walkSpeed = initialWalkSpeed;
        }

        if ((Forward && Right) || (Forward && Left) || (Backward && Right) || (Backward && Left))
        {
            walkSpeed *= .7f;
        }

        if (Forward)
        {
            Delta += transform.forward * walkSpeed * Time.deltaTime;
        }

        if (Backward)
        {
            Delta -= transform.forward * walkSpeed * Time.deltaTime;
        }

        if (Right)
        {
            Delta += transform.right * walkSpeed * Time.deltaTime;
        }

        if (Left)
        {
            Delta -= transform.right * walkSpeed * Time.deltaTime;

        }

        rb.MovePosition(new Vector3(Delta.x, transform.position.y, Delta.z));
    }
}

sentences:
Unity 5: Accessing a C# variable from Javascript I've set up a SQLite database with Unity. Into this I would like to add the current CPU Utilisation. The SQLite scripts are in Javascript and the method for finding the CPU utilisation is in a C# script, I have tried changing the javascript to C# but I am not that skilled. Ive tried several methods, each giving me errors:

(http://www.41post.com/1935/programming/unity3d-js-cs-or-cs-js-access)

private var csScript : ClientValues;

function Awake()
{
csScript = this.GetComponent("ClientValues");
}

using this method gives me the error "The name 'ClientValues' does not denote a valid type ('not found')"

and if I use (http://answers.unity3d.com/questions/272122/can-i-pass-a-value-from-a-c-script-into-a-java-scr.html)

var curValue : int;
var gObject2 : GameObject;

function Update()
{
var cSharpScript = gObject2.GetComponent("Clientvalues");
curValue = cSharpScript.myValue;
}

I get the error: 'myValue' is not a member of 'UnityEngine.Component'

Is this something to do with me using Unity 5?
What can I do to have the Javascript access the C# value?

sentences:
Why does my Window take a few clicks to actually close even though the event fires? I am pretty new to game dev (and libgdx + scene2d specifically), I am creating a dialog system for an rpg game and obviously a dialog window has a close button to close a dialog but for some reason it takes few clicks to close it (see video).

I have added System.out.println(Actor.class) to where the listener executes:

As you can see the events fired as planned!

Here is my listener code:

closeButton.addListener(new ChangeListener() {

  @Override
  public void changed(ChangeEvent event, Actor actor) {
    System.out.println(Actor.class);
    event.getListenerActor().getParent().addAction(Actions.hide());
  }
});

Please send help,  thank you

sentences:
How can I avoid sending the full game state so often? I'm making a real-time 2D MMORPG in Java. Currently data all surrounding NPCs' and players' data is sent so frequently that the client crashes—it can't handle the data quickly enough. I'm sending data so frequently to make sure the game state stays up to date.

Is there an alternative? Should I make it send information only when needed, like when health is lost or something moves, instead of updating the whole object every time? How do I do this?

sentences:
2D Lighting From Sun I have been developing a game for over a year now and I have successfully implemented the basic foundation for lighting, but there are still a few things I'm struggling with. The biggest issue right now is the lighting that should be cast from the "sun". The sun should technically light up any block that doesn't have a lot of blocks above it covering up the light that should be reaching it.

The way the current light system works is through a flood-fill algorithm that goes block to block recursively setting light based on different conditions. The light is recalculated when a light source is placed or a block is broken and the algorithm is very efficient. Currently I have a basic implementation of sun where the highest block has light generated straight down from it until the light "runs out". This works when first generated, but doesn't look natural. One case where there's problems is if there is a single block 10 blocks above the terrain which would cause the terrain to be unlit under that block because it didn't receive any sun.

I have been doing research and trying out different techniques, but nothing has worked well and efficiently. Any suggestions are appreciated.

Here is an image of the game in it's current state. You can see the lighting issue with the tree blocking the light of the ground.

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:
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:
XNA - Accessing primary View, Project, World matrices from a game component In XNA4, I have an EnemyManager class that takes care of all of the enemies.  When it comes time to draw, however, it needs access to the game's main View, Projection, and World matrices.

I could just pass a reference to my DavesGame object down in there, but that seems like bad design.  I could put them in an interface and expose them as a game service.

I'm leaning towards the latter, but I'm wondering what the correct & elegant way to do it is.

Thanks!
Dave

sentences:
Record voice and Comparison prefab audio in unity I am android programmer that i Comparison Entrance voice with ready voice(prefab voice) for example when you say hello >>>>>to analyze>>>>>if your voice == prefab voice >>>>>you listen hello(play hello sound)
i want create game example tom that you can speak by somebody by speak.

i want scan Entrance words and i know about characters.

I want simulate artificial intelligence Robot speaks to you in android
how i can know about entrance words in android.

sentences:
translating canvas for rotating sprites that shoot I am trying to align bullets to my different sprites guns (top down 2D for android). Right now Im using this method to draw my bullets:

public void draw(Canvas canvas){
    update();
    canvas.save();
    canvas.rotate(angle, x + width / 2, y + height / 2);
    canvas.translate(translaterX, translaterY);
    canvas.drawBitmap(bitmap, x, y, null);
    canvas.restore();
}

The problem here is the translater, Im always having to add or substract from it to make the bullets spawn from my gun when my sprites rotate and I cant figure it out, is there any standard value for this, like translaterX = bitmap.getwidth()/2? I dont really understand how the translater works and I feel like Ive tried everything, what am I missing? For the examples sake lets say that my gun is always in the middle of the bitmap.

Or is there even another way to do this that is simpler?

sentences:
Add oceans to an earth model with only continents? I have the following earth model, it only has continents:

I wanted to add water but as you can see, some of the continents are now hidden due to the water sphere being more round than continents:

I tried the following:

downscale water sphere, kinda works but only when it's significantly smaller, overall result is then unconvincing.
change shader and render queue offset, does not do anything actually.

I was hoping that maybe there could be a way to render transparent parts of this earth model as a specific color or eventually another material.

Please do not suggest to use another earth model, I wouldn't have asked the question otherwise :)

sentences:
Unity, Steam and updaters! I am probably asking a question answered here already; but I have yet to find the answer! Can anyone here help me with how updates work for your games? I know that through visual basic you can create batches to make shorter updates and everything like that but overall I am completely confused:/

How to get your game from Unity to Steam and how can you update the version and files efficiently?

sentences:
Distributed Rendering in the UDK and Unity At the moment I'm looking at getting a game engine to run in a CAVE environment. So far, during my research I've seen a lot of people being able to get both Unity and the Unreal engine up and running in a CAVE (someone did get CryEngine to work in one, but there is little research data about it).

As of yet, I have not cemented my final choice of engine for use in the next stage of my project. I've experience in both, so the learning curve will be gentle on both. And both of the engines offer stereoscopic rendering, either already inbuilt with ReadD (Unreal) or by doing it yourself (Unity). Both can also make use of other input devices as well, such as the kinect or other devices. So again, both engines are still on the table.

For the last bit of my preliminary research, I was advised to see if either, or both engines could do distributed rendering.

I was advised this, as the final game we make could go into a variety of differently sized CAVEs. The one I have access to is roughly 2.4m x 3m cubed, and have been duly informed that this one is a "baby" compared to others.

So, finally onto my question:

Can either the Unreal Engine, or Unity Engine make it possible for developers to allow distributed rendering? Either through in built devices, or by creating my own plugin / script?

sentences:
Android : glowing/pulsing line/triangle I would like to create a simple Android app using Opengl ES 2.0 that is showing a simple shape (like line or triangle) that is glowing and pulsing like Nexus X logo in this video : http://youtu.be/jBKVAfZUFqI?t=59s

What should I look for?

So far I googled around for glowing effects and found techniques like "bloom" or "additive blending". Are they relevant here? how I would implement pulsing glow with them?

Any links to relevant works very appreciated
Thanks!

P.S - I am very familiar with Android SDK; just started with OpenGL ES

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 I create this underwater effect with Cocos2D? http://vimeo.com/2461697

Hi everyone, I'm trying to create an effect like this, the underwater effect (water distortion). I've looked around and I've seen references to "water caustics" but I'm not sure how to create this in Cocos2d or if it's done with obj-c only.

Thanks.

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:
Unity3D: Determine vectors parallel to terrain I am trying to determine vectors that relate the height map information from a Terrain built in Unity to vectors that are parallel to the slope of the terrain.

i.e. From the Unity built terrain, whose contour map looks like the one in the Figure below, I want to draw the vector which is along the slope of the terrain, in the direction that is perpendicular to the contour lines.

How would I do this? I've found a question here that includes an answer which supplies code to find the contour lines from a height map.

Does any one know how to find the vectors?

Thanks.

sentences:
Evil Genius styled building system I'm currently playing around with a base builder/manager-esque type of game similar to Evil Genius. To build a room I would like to have the following process:
1. Select room type
2. Click and hold the mouse. Drag to create a rectangle over the area.
3. On release, place entire room.

I have already implemented this, but I find it inefficient and I would like to improve it. As of now the indicator rectangle is simply a sprite that is scaled and moved to fit. I would, however, like to have the indicator rectangle to be "adaptive". Meaning that if I drag a placement rectangle over an invalid area the indicator will be red at that point.

To do this I figured I could go with some sort of loop. I.e. "A change in rectangle size noticed. Update all new indicator tiles with correct colour". I had all the pseudo code figured out, but then I realised instantiating a number of gameobjects would be kinda inefficient. If the player is making a large rectangle in a short amount of time, that would surely slow down the game? Is there any other way to solve my problem, or is this the most efficient solution?

I should note that this build system is grid based. Each tile has a coordinate given by two integers and is saved in a 2D array. You can easily access the array and see what tile is at any given point or find the coordinate of any tile.

sentences:
Newton Game Dynamics: Making an object not affect another object I'm going to be using Newton in my networked action game with Mogre.  There will be two "types" of physics object:  global and local.  Global objects will be kept in sync for everybody; these include the players, projectiles, and other gameplay-related objects.  Local objects are purely for effect, like ragdolls, debris, and particles.

Is there a way to make the global objects affect the local objects without actually getting affected themselves?  I'd like debris to bounce off of a tank, but I don't want the tank to respond in any way.

sentences:
How to add only 1 value in a list in the Update function when a GameObject is active for many frames In my C# script, I get the active gameobjects during play mode. Those gameObjects that are active are:

1- First, I get the ones that the application has selected randomly 2- and then after the first ones get disabled (setActive(false)), I get the selected gameObjects which are those that the user has pressed using their button.

So basically the application is: The user hears a sound being played (here I set active the gameObject that has that sound) and then after some frames, the sound gets disabled and then the user needs to press a button in screen to make a choice depending on the sound (here I set active the gameObject that has the button) and then I disable that game object after some frames.

Now every time one of those gameObjects gets selected, I try to add to my list some sort of value (lets say 1 in this case). But what happens is that I only manage to add the value in the Update() function but in this function I do not get only 1 value added in the list every time I get the first gameObject selected but because it updates every frame, this value gets added for like 125 times in the list until this gameObject gets diselected and the next gameObject (the one that holds the button) get active.

  if (DogSelected.activeSelf && NoCarSelected.activeSelf)
    {
        enable = true;

        if (enable)
        {
            DogLionSelected.Add(0);
            NoCarCarSelected.Add(0);

            enable = false;
        }

        if (DogPressed.activeSelf && NoCarPressed.activeSelf )
        {
            enable = true;

            if (enable)
            {
                string[] data = new string[] { scene.name.ToString(), "0", "0", "0", "0", "1" }; orientationStringWriter.Write(string.Join(delimiter, data) + "\n");
                DogLionPressed.Add(0);
                NoCarCarPressed.Add(0);
                PrimaryCorrectIncorrect.Add(1);

                enable = false;
            }

        }

Ideally, I would want to:

1- Hear the sound (gameObject is active) => add only 1 value in list until the gameObject is deselected. 2- Then do the same thing for the gameObjects that hold the button. So when that gets selected = > add only one value in the other list until this gameObject is deselected. Then do the same process 72 times (because the number of trials in this application is 72).

Can anyone give me any advice how to achieve this?

Thanks

sentences:
My runtime (game) won't reset back to how it was? I increase the scale of the objects when it passes a certain time or in this case, my "difficulty"
    //Spawn Size
float spawnSize = 8;

void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(spawnsMinMax.y, spawnsMinMax.x, Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

        if(Difficulty.GetDifficultyPercent() > 0.7f)
        {
            fallingRockPrefab.transform.localScale = Vector2.one * spawnSize;
        }

Then as expected, the object increases the size after it passed that conditions so i want to revert back to its previous state so i remove:
  if(Difficulty.GetDifficultyPercent() > 0.7f)
    {
        fallingRockPrefab.transform.localScale = Vector2.one * spawnSize;
    }

but when I saved it and go back to unity, the object still in its "increased" size right at the start. What's happening?

sentences:
How to recycle unity scroll list of game objects? In my game, I have a scrollrect which its content have a VerticalLayout component. When I fill that with so many count of GameObjects, the game will fall in problem!

I know that I have to recycle my objects, but I don't know how!

sentences:
What data to exchange in multiplayer real time games? I am a hobbyist programmer and right now I am curious about what data is exchanged in a multiplayer session in real time games like starcraft 2. I did a bunch of searches. I found gafferongames.com offering a very good overview of the issues to consider.

Glenn in his article and comments gives a very strong case for using UDP over TCP, but SC2 obviously uses TCP. To qoute Gleen,

  The problem with using TCP for games is that unlike web browsers, or
  email or most other applications, multiplayer games have a real time
  requirement on packet delivery. For many parts of your game, for
  example player input and character positions, it really doesn’t matter
  what happened a second ago, you only care about the most recent data.

So from his statement, I am guessing that his approach is to send the the full game state of every unit on each frame. If the server does not receive a player input on the current frame, then it's just back luck on that player. For God of War: Acension, in which he is lead network dev, this should work quite well I guess.

For SC2, due to it's replay capability, my gut feeling tells me that the underlying engine is a deterministic fixed timestep "user input playback machine", where the only data exchanged is player inputs. Hence Glenn's statement mybe completely irrelevant for SC2. Player input is important, and input sequence is even more important. I don't think it's feasible for SC2 sending game state of 200 units and more at 30 - 60 FPS.

Question: I could be wrong, but I have attempted to identify 2 possible types of data. What are other techniques? Will be good to qoute the game if you will.

EDIT: found this link about starcraft networking model

sentences:
Render model with meshes with materials and/or textures I'm making a model class that is using Assimp in the background. I want my models' meshes to be able to have a material and an optional texture on top of that.

Right now I'm doing it like this: for each mesh, I store postion, normal, and texCoord for each vertex in that mesh. If the mesh doesn't have a texture, I just add vec2(0.0, 0.0) to the texCoord-array. I needed to add blank values for the meshes that doesn't have textures so the offset for the meshes that has textures would be correct.

At first I thought this would work. To draw the meshes I use the same shader-program for both the meshes without textures and the ones with textures. But since no texture will be bound when I render the ones without textures, it will sample tex-colors from nothing (?), and flickering occurs.

So my question is, what would be a good way to solve this? Is it possible to have two shader-programs and switch between them depending on if the model has a texture?

sentences:
How to put a "mask" in front of the camera in Ogre? Is there any easy way to put kind of a "mask" in front of the camera in an Ogre 3d application, so that parts of the scene are always covered by that mask? The idea is that I want to have an effect as if you would look through a keyhole, or as if you would look through a tube. There should be a black border around the center of the screen, so that the user only sees that center.

Ideally, I would be able to dynamically change the diameter of this circle through which the user looks on the scene. Thus that black border on the sides of the scene would become wider or narrower.

Any ideas how to implement that in Ogre?

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:
Slick2D - Cannot instantiate the type Image I am getting this strange error and I cannot for the life of me figure out why:

    Cannot instantiate the type Image

CODE:

import java.awt.Image;

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 MainMenuState extends BasicGameState {

    int stateID = -1;

    Image background = null;
    Image startGameOption = null;
    Image exitOption = null;

    float startGameScale = 1;
    float exitScale = 1;
    MainMenuState( int stateID )
    {
       this.stateID = stateID;
    }

    public int getID() {
        return stateID;
    }

    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
        try {

        background = new Image("data/menu.jpg");

        Image menuOptions = new Image("data/menuoptions.png");

        startGameOption = menuOptions.getSubImage(0, 0, 377, 71);

        exitOption = menuOptions.getSubImage(0, 71, 377, 71);

        }catch (SlickException e) {
            System.err.print(e);
        }
    }

    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

    }

    public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {

    }

}

Why do I get this error? I've googled endlessly and nobody else has it, this worked fine in my other game. Any ideas?

sentences:
Object in Box2d doesn't sit perfectly on top of other object I have a rectangle in my player class with the following properties

b2BodyDef player;
player.type = b2_dynamicBody;
player.position.Set(x + width, 10.17f - (y + height));

m_PhysicsBody = level->GetPhysicsWorld().CreateBody(&player);

b2PolygonShape shape;
shape.SetAsBox(width, height);

b2FixtureDef fixture;
fixture.shape = &shape;
fixture.density = 1.0f;
fixture.friction = 1.0f;

m_PhysicsFixture = m_PhysicsBody->CreateFixture(&fixture);
m_PhysicsFixture->SetUserData(this);

and another rectangle in my level class with the following properties

b2BodyDef ground;

ground.position.Set(x + width, 10.17 - (y + height));

b2PolygonShape groundBox;
groundBox.SetAsBox(width, height);

b2Body* m_Body = m_PhysicsWorld.CreateBody(&ground);

b2FixtureDef fixture;
fixture.shape = &groundBox;

fixture.friction = 1.0f;

m_PhysicsFixture = m_Body->CreateFixture(&fixture);

m_PhysicsFixture->GetShape()->ComputeAABB(&aabb, m_Body->GetTransform(), 0);

The problem is that unless the player object is a perfect square (the width and the height are exactly the same) it won't sit exactly on top of the ground object I created in the level class. It intersects it a little bit before coming to a rest. I've attached a picture so you guys can see.

The way that I render the shapes is as follows

b2AABB aabb;
m_PhysicsFixture->GetShape()->ComputeAABB(&aabb, m_PhysicsBody->GetTransform(), 0);

DrawRectangle(aabb.lowerBound.x * 100.0f, (m_Window.GetHeight() - (aabb.lowerBound.y * 100.0f)), (aabb.upperBound.x - aabb.lowerBound.x) * 100.0f, (aabb.upperBound.y - aabb.lowerBound.y) * 100.0f);

I multiply the values by 100.0f to make it bigger, and y is the height of the window minus y. This is because I'm using SDL, which sets the upper-left corner as the 0,0 origin. So all the way at the very top, y = 0, and all the way at the bottom, y = the window height.

sentences:
How to make a moving camera in 2d with p5.js I am trying to make a hill climb racing clone. My code: https://editor.p5js.org/saathvik/sketches/-XOFPcukt
When I move the car, I want the camera to follow the player, so he can't go off screen.

sentences:
How to get current Microphone Frequency in Godot Let us say I want to create a singing game similar to SingStar, and for this purpose I want to get the audio pitch the microphone is getting, in real time, or as close as possible.
I know I can get audio input in Godot. Even record the microphone to a file, there is an official demo project that does that (mic_record). I also know there are libraries that can analyze the audio.
How can I get the microphone pitch in real time?

Yes, I'm answering my own question. This question is inspired on a similar one on StackOverflow, which asked for a library to do this, which lead to the question getting closed, and the asker deleted it instead of editing the question… Before I noticed. As it turns out, you don't need libraries to do this. This is a means to answer the question I believe that person should have asked.

sentences:
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:
Why this simple SFML app produce such high CPU usage? I written the following SFML.NET app.
It  draw a single 128x128 sprite on the screen.

RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");
window.SetVerticalSyncEnabled(true);

Texture texture = new Texture("test.jpg");
Sprite sprite = new Sprite(texture);

// Start the game loop
while (window.IsOpen())
{
    window.DispatchEvents();
    window.Clear();
    window.Draw(sprite);
    window.Display();
}

Since VSync is enabled, the number of FPS is capped to 60. I expect the program to use very little CPU, but under task manager it show me that is use about 50%  (two cores fully actually). Also it seems it use about 30% kernel time and the rest is user time.

The exact same application in SDL (just drawing a single sprite) use about 0% (regardless SDL_RENDERER_ACCELERATED is used or not).

EDIT : surprisingly, if I let the app run for a given amount of time (let's say 10-20 seconds, the CPU usage fall down to 0%). I manage to repeat this several times. That is really strange.

sentences:
Characteristics, what's the inverse of (x*(x+1))/2? In my game you can spend points to upgrade characteristics. Each characteristic has a formula like:

A) out = in :
for one point spent, one pont gained (you spend 1 point on Force so your force goes from 5 to 6)

B) out = last level (starting at 1) :
so the first point spent earns you 1 point, the next point spent earns you an additional 2 and so on (+3,+4,+5...)

C) The inverse of B) :
You need to spend 1 point to earn one, then you need to spend 2 to earn another one and so on.

I have already found the formula for calculating the actual level of B when points spent = x :

charac = (x*(x+1))/2

But I'd like to know what the "reverse" version of B) (usable for C) is, ie. if I have spent x points, how many have I earned if 1 spent gives 1, 1+2=3 gives 2, 1+2+3=6 gives 3 and so on.

I know I can just calculate the numbers but I'd like to have the formula because its neater and so that I can stick it in an excel sheet for example...

Thanks!

ps. I think I have nailed it down to something like charac = sqrt( x*m +k) but then I'm stuck doing number guessing for k and m and I feel I might be wrong anyway as I get close but never hits the spot.

sentences:
Libgdx: more efficient way of using Vector 3? I currently use

if(cam.frustum.pointInFrustum(new Vector3((float)posX, (float)posY, 0)))

To check if my sprite is in the camera's view. I have to make a new Vector3 every frame wich is very inefficient.

Is there a better way to do this?

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:
Key combinations on poll-based input So assume you have an input system that is based on polling

void update()
{
    if( Keyboard[ 'A' ] )
        // A is down
}

Say you want to be able to recognize 3 to 8 length key combinations (like down, down-forward, forward, A for hado-ken)

How would you best create a generic (easily modifiable/programmable) key combination input system on polled input?

sentences:
How to render texture into box2d objects from Tile Map? Libgdx I have a problem, when i try to render textures. I read positions of gameObjects, for example coin and create box2d objects circle shape. I have wrote game logic and began make a graphic. But for some reason, textures drawing not in box2d objects, but they shifted to the right and up as mini-map in games.

Code

  batcher.begin();

  sprite = new Sprite(AssetsLoader.coin);

  sprite.setPosition((body.getPosition().x - sprite.getWidth()/2), ((body.getPosition().y - sprite.getHeight()/2)));

  sprite.draw(batcher);
  batcher.end();

This is what happened

As you can see above, sprite position like body position. And something else: when i move my mainHero all rendered coins moving with him. On the screen they save their position, but in world they are moving. So how i can render coin texture exactly into box2d body.

May be something wrang with camera?

cam = new OrthographicCamera();

cam.setToOrtho(false, 400, 600);

or with Batcher?

batcher = new SpriteBatch();

batcher.setProjectionMatrix(world.getCamera().combined);

I will not give all my code, because it is big and no one will try to understand it.I need an idea or just an advice or a hint. Sorry for my English, hello everyone from Belarus :) Where do I look and what a start? Thank you.

sentences:
Interactions between camera and procedural terrain QUESTION REWORKED

I need to update every frame camera position along a surface with hills and drops.
In this picture you can see a particle of the surface terrain (just one triangle) and a sphere representing the camera. It is set in a certain point of the surface and has a velocity in the XZ plane.

What I want to do is check the plane sloping and modify the velocity in order to move smoothly on the surface without "entering" in it like if it was a ladder

How should I proceed? I can easily ccess informations like vertex coordinates, surface normale (in that particular triangle) and I think whatever you thinkcould be of help but since I have difficulties in painting on a paper what should I expect I don't know how to approach this problem.

Can someone help me?

sentences:
Text not being rendered until I recreate the text class in SDL I made a Text class, it is as shown below:

Text::Text(const int score, const float &x, const float &y, const float &w, const float &h, SDL_Renderer *rend)
{
    font = TTF_OpenFont("font/Subway.ttf", 50);
    if (font == NULL)
    {
        std::cout << "Something went wrong\n%s\n" << TTF_GetError();
    }

    rect = { x, y, w, h };
    color = { 100, 100, 100 };

    tempSurface = TTF_RenderGlyph_Blended(font, *std::to_string(score).c_str(), color);
    tex = SDL_CreateTextureFromSurface(rend, tempSurface);

    SDL_FreeSurface(tempSurface);
}

void Text::draw(SDL_Renderer *rend)
{
    SDL_RenderCopy(rend, tex, NULL, &rect);
}

Text::~Text()
{
    //Clean up stuff
    font = nullptr;
    tempSurface = nullptr;
    SDL_DestroyTexture(tex);
    tex = nullptr;
}

I created two of these class objects to hold the image that is created from the players score variables. Issue is that the first time these objects are created, they are not shown on the screen. It's only when the objects are created again that they are shown.

In gameloops constructor class:

GameLoop::GameLoop()
{
    window = new Window("Pong Test", 640, 480, SDL_WINDOW_SHOWN);
    player1 = new Paddle(50, 50, 10, 60);
    player2 = new Paddle(580,50,10,60);

    player1ScoreText = new Text(player1Score, SCREEN_WIDTH * .25 - 50 / 2, SCREEN_HEIGHT * .25, 50, 75, r);
    player2ScoreText = new Text(player2Score, SCREEN_WIDTH * .75 - 50 / 2, SCREEN_HEIGHT * .25, 50, 75, r);

    ren = new Renderer((*window).GetWindow(), -1, SDL_RENDERER_ACCELERATED);

    r = (*ren).getRenderer();

    ball = new Ball("ball.bmp", r);
}

It's created then its rendered here:

void GameLoop::Render()
{
    ren->setColor(0, 0, 0, 0);
    ren->clear();
    player1->Draw(r,255,255,255,255);
    player2->Draw(r,255,255,255,255);
    player1ScoreText->draw(r);
    player2ScoreText->draw(r);
    ball->draw(r,255,255,255);

    ren->present();
}

It's not showing.. not until this happens:

void GameLoop::Score()
{
    delete ball;

    player1ScoreText = new Text(player1Score, SCREEN_WIDTH * .25 - 50 / 2, SCREEN_HEIGHT * .25, 50, 75, r);
    player2ScoreText = new Text(player2Score, SCREEN_WIDTH * .75 - 50 / 2, SCREEN_HEIGHT * .25, 50, 75, r);

    ball = new Ball("ball.bmp", r);
}

From what I can see it doesn't matter where you recreate the classes, it will work. Is this due to how the classes are being initialised?

My first thought is that it would be this line:

tempSurface = TTF_RenderGlyph_Blended(font, *std::to_string(score).c_str(), color);

due to the fact I pass in a pointer to converted integer. However if I don't pass in a pointer I get this error:

error C2664: 'SDL_Surface *TTF_RenderGlyph_Blended(TTF_Font *,Uint16,SDL_Color)' : cannot convert argument 2 from 'const char *' to 'Uint16'

Any help would be greatly appreciated.

sentences:
Should I have one asset manager and unload and load with different gamestates? Or should I have one for each gamestate? I am working on a LibGDX game and I would like to find out the best way to manage assets. Should I have one AssetManager that is passed through to my GameState init() method to load from each level, then unload all of those resources in the dispose() method of the gamestate.

Or, should I have a separate AssetManager in each gamestate which is passed to each of the entities and components within the gamestate and clear + dispose the entire AssetManager in the dispose() method of the gamestate.

sentences:
How are components properly instantiated and used in XNA 4.0? I am creating a simple input component to hold on to actions and key states, and a short history of the last ten or so states. The idea is that everything that is interested in input will ask this component for the latest input, and I am wondering where I should create it.

I am also wondering how I should create components that are specific to my game objects - I envision them as variables, but then how do their Update/Draw methods get called?

What I'm trying to ask is, what are the best practices for adding components to the proper collections? Right now I've added my input component in the main Game class that XNA creates when everything is first initialized, saying something along the lines of this.Components.Add(new InputComponent(this)), which looks a little odd to me, and I'd still want to hang onto that reference so I can ask it things.

An answer to my input component's dilemma is great, but also I'm guessing there is a right way to do this in general in XNA.

sentences:
Cocos2d-x v3.1 for WinPhone 8 auto change texture after resumed from background I have some sprites in my game (for Windows Phone 8). These are my steps to reproduce the problem:

Open game
Play (this is an optional step)
Press Windows button to send game to background
Press Back button to resume game

The problem is: After the game has resumed, some sprites exchange textures, some sprites go black (like there is no texture being bound).

I'm using cocos2dx version 3.1. Can someone help me to solve this problem?

sentences:
Can I develop Linux + Windows games using C#, .NET and OpenGL? I want to learn to develop 3D and 2D graphics with either OpenGL or DirectX. I chose OpenGL as it's being used in webGL and works cross-platform.

I already know .NET well, and the C# language just fits my style very well and I feel secure with it.

However, I want to develop a game that works on Windows and Linux. Is this possible to do with the combination of C#, .NET and OpenGL. I know that OpenGL will not be a problem.

sentences:
Is there a fully featured OBB class for Ogre3D? Is there a fully featured OBB (Oriented Bounding Box) class for Ogre3D?

I don't think there is one by default but I am looking for an alternative which has all the features of the AxisAlignedBox class.

sentences:
How do I efficiently choose the terrain chunks to render based on the player position? Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered.

The problem is that if I add all the terrains of the array to the list (let's call it toRenderList), my computer explodes because of the number of terrains.

What I've tried to achieve it's to add to the list ONLY the terrains that are into a certain range. This is what I've done:

private static Terrain[][] terrains;
private List<Terrain> toRenderList;
private static final int NUMBER_CHUNKS = 3; //Number of terrains that are added to the list.

public void update(Player player){
    if(player.hasChangedTerrainPosition()){
        toRenderList.clear();
        for(int x = player.getTerrainPosition()[0]-NUMBER_CHUNKS;
            x == player.getTerrainPosition()[0]+NUMBER_CHUNKS; x++){
            for(int y = player.getTerrainPosition()[1]-NUMBER_CHUNKS;
                y == player.getTerrainPosition()[1]+NUMBER_CHUNKS; y++){
                terrainList.add(terrains[x][y]);
                System.out.println("Terrain "+x+","+y+" added!");
            }
        }
    }
}

Just to clarify, the method player.getTerrainPosition returns a int[] with the current terrain coords in where the player is standing. The method player.hasChangedTerrainPosition returns true if the player has changed of  terrain.

The problem of this method is that for example if the player is in the position [0,0] it pops an error of ArrayIndexOutOfBounds because of a negative number.

I don't know if I've been specific. This is more basic Java than GamePrograming, but any help will be appreciated. Thanks!

sentences:
Merging multiple image with DirectX D3DImage best approach? I'm currently rendering up to 6 images (7440 x 7440) together via a series of colorizing shaders (one each image) and then merging shaders (5 to merge colorizer result). I'm not getting the performance I would expect. I'm using D3DImage to render into a WPF application. The rendering is appearing to be very slow. However, the shaders are rendering in .005 secs each. This is currently rendered on one quad...

Is it better to flush between image and merge or send on flush at the end?

Are C# for loop slowing it do? The benchmarks are not showing that but...

Also I use the colorize shader to change color in near real time the UI locks up...

Windows 7 I know is limited to 1 device. Windows 10 I know support multiple instances of devices... is there a way to use that capability? is it worth it?

Here is the kicker I will need to eventually do this on 20 quads.

Thank you in advance!

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:
Images out of "sync" I've been creating a game in Java as a bit of a fun side project over the last few months and I've come across a really peculiar problem, take a look at this image:

The game is made up of various entities and elements that are all rendered onto the screen in one big for loop:

for(int i = 0 ; i < level.entityList.size(); i++){
    if(level.entityList.get(i) != null){
        level.entityList.get(i).render(renderer);
    }
}

Now the render function within the entities allow them to render onto a buffered image which is then drawn onto the main canvas using BufferStrategy.getGrapghics().  The problem is sometimes some elements will get rendered out of "Sync" from the rest of the elements. For example, sometimes the "Multiplier x1" and the top left of the screen will shift up a bit or down a bit even though everything is getting rendered onto one plane before being rendered onto the screen.

Can anyone explain why this is happening? (Sorry if this is confusing, I don't really know what to say)

Preview of glitch:
http://www.youtube.com/watch?feature=player_detailpage&v=u9yDlhJV_6I#t=69s

sentences:
How to make progress vertical bar increase instead of decrease I have a script for a vertical progress bar using filled image but the image decreases (basically you can see the full image when the game starts and then it goes down, like a health bar) but since it's a progress bar I need it to increase (at the end I should see the complete image, not at first).
This is the code:

public class ProgressBar : MonoBehaviour {

public Image Bar;
public float max_progress = 100f;
public static float cur_progress = 0f;

void Start () {
    cur_progress = max_progress;
}

void Update () {
    Bar.fillAmount = cur_progress / max_progress;
}

And I have ProgressBar.cur_progress -= 0.4f; in the bullet script because it should increase everytime you kill an enemy.
I tried writing += instead of -= but it doesn't work (the image is filled and it doesn't increase or decrease), and i think that is not incorrect so I don't know what the problem is. Thanks in advance.

sentences:
Why do the order of uniforms gets changed by the compiler? I have the following shader, everything works fine when setting the value of one of the matrices but I've discovered that getting a value back is incorrect for View and Projection, they are in reverse order.

#version 430

precision highp float;

layout (location = 0) uniform mat4 Model;
layout (location = 1) uniform mat4 View;
layout (location = 2) uniform mat4 Projection;

layout (location = 0) in vec3 in_position;
layout (location = 1) in vec4 in_color;
out vec4 out_color;

void main(void)
{
    gl_Position = Projection * View * Model * vec4(in_position, 1.0);
    out_color = in_color;
}

When querying their location they are effectively reversed, I did a small test by renaming View to Piew which  puts it before Projection if sorted alphabetically and the order is correct.

Now if I do remove layout (location = ...) from the uniforms, the problem disappears !?

I am starting to think that this is a driver bug as explained in the wiki.

Do you know why the order of the uniforms is changed whenever the shader is compiled ?

(using an AMD HD7850)

sentences: How does someone go about selling a game or making a royalties deal with Nintendo(or Pokemon Company)? It seems like Niantic did just that. If someone were to create their own game(Pokemon, hypothetically), how would they, if at all possible, sell that game to Nintendo or at least make a royalties deal? Or any other game, for that matter?

sentences:
The collision log is displayed only for the original obstacle and not for the duplicates This is my first game attempt and I'm trying to create a game where my player (a box) stops whenever it collides with an obstacle. However, the log for the collision is only displayed when the player collides with the original obstacle, while no message is displayed for colliding with any other obstacles.
Here's my code:

public class PlayerCollision : MonoBehaviour
{
    public PlayerMovement movement; //Reference to player movement script

    //This function will run when collision occurs, the info collision is stored in collisionInfo
    void OnCollisionEnter(Collision collisionInfo)
    {
        if (collisionInfo.gameObject.name == "Obstacle")
        {
            movement.enabled = false; //Stop the player from moving
            FindObjectOfType<GameManager>().EndGame();
        }
    }
}

sentences: How do games like Minecraft generate entire worlds from a seed number? I want to generate a completely unique world with biomes (like what Minecraft and similar games do). I don't understand how they generate these entire worlds from a single "seed" number. Can someone provide a basic overview of the technique?

sentences:
Rotation matrix to look at point p Assume a left-handed coordinate system where x is right, y is up, and z is into the screen. You have a unit vector pointing up along the y-axis. What's the rotation matrix for pointing the unit vector along the y-axis to an arbitrary point p?
I was asked this question during a phone screen. The interviewer implied there's an easy way to get this rotation matrix by "dropping in" a few values. I'm reading a 3D math book hoping to find this easy way but no luck yet. The ways to get this matrix in the book all seem too long to recite over the phone during an interview.
I think I can see part of the solution. The rows of the matrix are the post-transformation basis vectors. So the middle row of the matrix is just the point p possibly normalized (since that's where the y-axis will be post-rotation).
Any help with this easy "drop in" way of getting the rotation matrix is much appreciated!
Edit: If it seems like the problem statement is missing information please call it out. I feel like I remember the interview clearly but I could have left something out (or the interviewer could have).

sentences: Interactive ways to answer a yes or no question in a VR game? Currently, I am creating a VR game with a simple AI that at certain points ask for yes or no answers. Considering the player is free to walk around, I need a sort of spawn in and out kind of solution. I would really like this to be interactive and engaging. So far, I'm thinking to animate a "terminal" from the floor with a green and a red button on it and the user simple pushes down on one with their hand. I don't really want to use a 2D UI or a controller button press for this. Are there any other potential ways to handle this situation while keeping the interactivity there?

sentences:
2D physics performance on iPhone/Android using Unity 3D? I've been looking into making 2D games with Unity. One thing which concerns me is the performance of the physics engine. Since Unity is a 3D game engine I'm going to have to assume it uses a 3D physics engine. Obviously I can turn this 3D engine into a 2D one by locking off various axis such that objects only move physically in 2D space.

However this worries me, for example Box2D being a specialized 2D physics engine is optimized for 2D. Would the physics in Unity3D be fast enough to say, duplicate the sorts of physics we see in games like Angry Birds on a handheld device?

sentences:
Calculating Per Vertex Normal in Geometry Shader I am able to calculate normals per face in my Geometry Shader but i want to calculate per vertex normal for smooth shading. My Geometry shader is

#version 430 core
layout ( triangles ) in;
layout ( triangle_strip, max_vertices = 3 ) out;

out vec3 normal_out;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

uniform mat4 modelTranslationMatrix;
uniform mat4 modelRotationXMatrix;
uniform mat4 modelRotationYMatrix;
uniform mat4 modelRotationZMatrix;
uniform mat4 modelScaleMatrix;

void main(void)
{
    // Please ignore my modelMatrix and NormalMatrix calculation here
    mat4 modelMatrix = modelTranslationMatrix * modelScaleMatrix * modelRotationXMatrix * modelRotationYMatrix * modelRotationZMatrix;
    mat4 modelViewMatrix = viewMatrix * modelMatrix;
    mat4 mvp = projectionMatrix * modelViewMatrix;
    vec3 A = gl_in[2].gl_Position.xyz - gl_in[0].gl_Position.xyz;
    vec3 B = gl_in[1].gl_Position.xyz - gl_in[0].gl_Position.xyz;
    mat4 normalMatrix = transpose(inverse(modelViewMatrix));
    normal_out = mat3(normalMatrix) * normalize(cross(A,B));
    gl_Position = mvp * gl_in[0].gl_Position;
    EmitVertex();
    gl_Position = mvp * gl_in[1].gl_Position;
    EmitVertex();
    gl_Position = mvp * gl_in[2].gl_Position;
    EmitVertex();
    EndPrimitive();
}

Since i don't have access to adjacent faces here, i cannot calculate per vertex normals.
How can i calculate per vertex normals in my Geometry Shader?

sentences:
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:
Deserialize only some fields from a JSON file I'm trying to parse a very large JSON string in Unity. I do not need all the fields and I can't create a class with all the members.
It appears that all examples I have found, including the official docs, always deserialize and map every field to class members, which I cannot do for my application.
I tried creating a class that is similar to the JSON string, meaning that it has some members of the target JSON, just not all of them. But it's not working as desired: all members of my class are always undefined after deserializing.
Here's part of the string:
{
    "Robots":[{"CanReset":false,
    "CycleTime":123.875,
    "Info":null,
    "LevelInfo":null,
    "Name":"FTF_10033",
    "State":0,"
    ...
    }, ...
}

So I tried creating these classes:
[Serializable]
public class jsonData
{
    public Robot[] robots;
}

[Serializable]
public class Robot
{
    public string Name = "Unknown AGV";
}

And printing the results:
var jsonString = www.downloadHandler.text;
jsonData jsonData_ = JsonUtility.FromJson<jsonData>(jsonString);
Debug.Log("Json data: " + jsonData_);
Debug.Log("Robots: " + jsonData_.robots);

jsonData_ prints Json data: jsonData_, and jsonData_.robots prints nothing (just Robots:).
Is there any way to parse just these particular fields out of the JSON string?
I would be content with something like jsonString["robots"][0]["name"] or something.

sentences:
How do I make a progress bar with letters that get "filled in"? I want to make a progress bar made of text! I have two images: One with the text in gray, the other coloured:

As my game is loading, I want the letters to "fill up" with color:

They would start out gray, then fill in.

I was thinking of overlaying a transparent rectangle over the gray image, then stretching the transparent rectangle to match the progress. But then the background will be coloured too. I want only the letters to be coloured!

How can I do this?

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:
Sprite not being destroyed after being walked on (Phaser 2.4.6) I've been developing a game for not long in the Phaser framework so I may be a little nooby so be warned.
I have a timer that runs whenever an update is called and it would set the sprite I walked on to a tanish-brown and then destroy it after half a second (500), give me one point and close the loop:

//This is where it calls the collision handler in the update() function. First line of it too.:
game.physics.arcade.collide(player, layer, testgame.prototype.collisionHandler, null, this);
//move player and stuff
//This is where the timer starts in the update() function
var st = game.time.create(false);
var stc = 0;
obj2.frame = 4;
st.loop(Phaser.Timer.SECOND / 8, function() {
  obj2.destroy();
  setScore(score += 1);
  st.stop();
  return;
}, this);
st.start();

But it would just give me a point and (not)close the loop.
I'm using arcade physics and each sprite is 32x32 while the player is 64x64.
I'm also using tilemaps, not just creating the level from code.
Thanks in advance.

sentences:
In Unity, Is it possible to get gameobjects from non-open Scene? Sorry for my english mistakes,I treid my best to make myself easy to be understood.

On Unity 2017.1 + C#.

I am trying to make UnitTest to check the potential errors in the scenes.
and when I want to get the gameObjects from the two deifferent scenes,
I can only get the scene which is open currently in the editor.

How to solve this problem?
Or This is impossible to be done in Unity mechanism?

Two Secens I have:

Scene1 hierarchy:

Scene2 hierarchy:

Code:

Result: Only get the open scene's infomation

My Final Solution

Thanks for the help, you guys help me make progress.

This is the feedback of my work.
When I tried to solve my problems with the instruction,
I ran into some obstacle.

So, I followed the suggestion of the error message.

And the result is pleasant.

The possible reason I can not get the same result at the begining,
It may be because the different test mode(playMode/EditMode)

I will let myself take a break now and not dig deeper at this moment.

Thanks for your help and wish my dicovery can help someone too.

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:
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:
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:
Java application chokes - when using MySQL If I use localhost - XAMPP, my application runs without problems.
Once I try to use real MySQL databases: db4free.net, freedb.tech.
Applications begins to choke and freezing, resulting it is nearly impossible to use.
If I choose to use paid MySQL database, will it solve problem?
public static void scanningPlayers ()
{
    updatePlayers.setNode( GameGroups.finalRoot); // does'nt matter node.
    updatePlayers.setDuration(Duration.millis(1000));
    updatePlayers.play();
    updatePlayers.setOnFinished(evt ->
    {
        GameGroups.rootPlayers.getChildren().clear();

        try
        {
            Statement stmt      = Credentials.conn.createStatement();
            ResultSet users     = stmt.executeQuery("select id, name, avatar, Xpos, Ypos from users");

            while ( users.next() )
            {
                Label playerName            = Default.Label17Light  ( "" + users.getString("name"), users.getInt("Xpos"), users.getInt("Ypos") - 25 );
                ImageView hero;

                hero            = Default.ImageView( Dir.adventure + users.getString("avatar") + ".png", users.getInt("Xpos"), users.getInt("Ypos") );

                GameGroups.rootPlayers.getChildren().addAll ( playerName, hero );

                if ( users.getInt("id") == Variables.id )
                { //identify mysel, used for centering n door.
                    Variables.Xpos = users.getInt("Xpos");
                    Variables.Ypos = users.getInt("Ypos");
                    Variables.myAvatar = hero;

                    GameGroups.rootUniverse.setTranslateX ( -Variables.Xpos  + 550);
                    GameGroups.rootUniverse.setTranslateY ( -Variables.Ypos  + 362);
                }
            }
        } catch (SQLException e) {e.printStackTrace(); }

        updatePlayers.play();
    });
}

sentences:
Unity won't Instantiate() outside of Start(), even though code is the same I am trying to add a gameobject to my game using a socket connection. I have a SocketHandler class, which simply connects to my NodeJS socket server, which can also call a method on another class, which will add a new gameobject to the game. Here is how it basically works:

void Start () {
    GameObject car = Instantiate(CarGameObject);
    car.transform.parent = this.transform;
    car.GetComponent<TestCar>().text.text = "Volkswagen";
}

This works fine and it adds the gameobject to the game upon starting. However, if I do something like this in my SocketHandler, it doesn't work:

var addCar = new AddCar();
socketio.On("addCar", (data) => {
    string str = data.ToString();
    Car data2 = JsonConvert.DeserializeObject<Car>(str);
    addCar.AddNewCar(data2);
});

and then inside my AddCar class, I have the AddNewCar() method:

public void AddNewCar(Car input) {
    GameObject car = Instantiate(CarGameObject);
    car.transform.parent = this.transform;
    car.GetComponent<TestCar>().text.text = input.name;
}

it does not work. If I do a Debug.Log(input.name) inside the AddNewCar() method, it does log the name the server sends. It should do the exact same thing, but the AddNewCar() doesn't get added to the game. It simply does nothing.

What could be wrong?

sentences:
why is my (from example) shader appearing as black? I have the following (very simple) shader:

#pragma kernel CSMain
RWTexture2D<float4> Result;

[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
    Result[id.xy] = float4(1,0,0,1);
}

Here is the dispatcher code:

using UnityEngine;
using System.Collections;

public class SkyShaderDispatcher : MonoBehaviour {

    public ComputeShader shader;
    public RenderTexture output;
    void Start(){
//      RenderTexture output = new RenderTexture(256,256,24);
//      output.enableRandomWrite = true;
//      output.Create();

    }
    void Update(){
        RunShader();
    }
    void RunShader()
    {
        int kernelHandle = shader.FindKernel("CSMain");
        shader.SetTexture(kernelHandle, "Result", output);
        shader.Dispatch(kernelHandle, 256/8, 256/8, 1);
    }
}

which is the default red shader (it makes the texture red).
However, when I put the texture in a material and give that to an object, then that results in the object being black. Anyone seeing what I'm doing wrong?

As the shader is the default example right now it should work suggesting that maybe something is wrong with the texture?

Edit:
Trying to fit the same code on a skybox also fails. I have changed the dispatcher code into:

using UnityEngine;
using System.Collections;

public class launchClouds : MonoBehaviour {

    public ComputeShader shader;
    private RenderTexture output;
    void Start(){

    }
    void Update(){
        RunShader();
    }

    void RunShader()
    {
        int kernelHandle = shader.FindKernel("CSMain");
        RenderTexture output = new RenderTexture(256,256,24);
        output.enableRandomWrite = true;
        output.Create();
        Material mat = gameObject.GetComponent<Skybox>().material;
        mat.SetTexture("_FrontTex",output);
        mat.SetTexture("_BackTex",output);
        mat.SetTexture("_LeftTex",output);
        mat.SetTexture("_RightTex",output);
        mat.SetTexture("_UpTex",output);
        mat.SetTexture("_DownTex",output);
        shader.SetTexture(kernelHandle,
                          "Result", output);
        shader.Dispatch(kernelHandle, 256/8, 256/8, 1);
    }
}

but that turns the sky black rather then making the sky red. This is using unity 5 32 bits with DirectX11.

sentences:
Calculating the shadow cast by triangle onto the YZ plane So, one of the exercises for my computer graphics class is as follows:

Calculate the shadow cast by triangle T onto the YZ plane P.

given:

Triangle T coordinates: A=(30,10,16) B=(32,11,18) C=(31,12,24)
Light source L=(40,10,18)

The scene described above is as follows: there is a light source emitting light onto a triangle, the triangle is in front of a plane, due to the light there will be a shadow cast formed onto the plane.

In other exercises where we had to calculate whether or not a point was inside the shadow cast we made use of a line/plane equation. But this time it is not clear for me how calculate the points of the shadow cast.

sentences:
creating a process to run in c++ // i need to run a process in c++ Hey I don't know why that when I compile this code that the fear.exe process is not running I am using visual studio for my coding ide choice the project is a win32 project // application method, that I am using..

I should say that I added a new item a c++ file called main.c++ and should I use the code file that Defines the entry point for the application. or does it matter.

#include "iostream"
#include "Windows.h"
#include "OVR_CAPI_D3D.h"
#include "Win32_DirectXAppUtil.h"
#include "stdio.h"
#include "string.h"
#include "Shlobj.h"
#include "Shlwapi.h"

using namespace std;

int WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR, int)
{
    STARTUPINFO startinfo = { 0 };

    PROCESS_INFORMATION processinfo = { 0 };

    BOOL bsuccess = CreateProcess(TEXT("E:\SteamLibrary\steamapps\common\FEAR Ultimate Shooter Edition\FEAR.exe"), NULL, NULL, NULL, FALSE, NULL, NULL,
        NULL, &startinfo, &processinfo);

    if (bsuccess)
    {
        cout << "Process Injected" << endl
            << "Process ID:\t" << processinfo.dwProcessId << endl;

    }
    else
    {
            cout << "Error to start the injected process" << GetLastError() << endl;
        }
        cin.get();
        return(0);
    }

sentences:
Casting Civilization V based Hex Grid on Unity Terrain and Select Certain Areas of Grid I am looking for approach for casting hex based grid on terrain which is for now pre-made but eventually it will be procedural for my exploration game where you can scan planet and elements will be highlighted/hex grid selected. What could be the approach towards making this kind of hex grid as my terrain will be un-even.

I have seen approaches like mesh creation, using tile-map, unity projectors but eventually I feel like this should be something using shaders but what about selection?

Can someone please guide me in a right direction.

sentences:
Algorithm for creating spheres? Does anyone have an algorithm for creating a sphere proceduraly with la amount of latitude lines, lo amount of longitude lines, and a radius of r? I need it to work with Unity, so the vertex positions need to be defined and then, the triangles defined via indexes (more info).

EDIT

I managed to get the code working in unity. But I think I might have done something wrong. When I turn up the detailLevel, All it does is add more vertices and polygons without moving them around. Did I forget something?

EDIT 2

I tried scaling the mesh along its normals. This is what I got. I think I'm missing something. Am I supposed to only scale certain normals?

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:
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: Unable to select MonoDevelop to open XML file from Unity project I am developing games in Unity but I have encountered a problem. After updating Unity I can no longer find MonoDevelop for editing XML files like my Android Manifest:

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:
Weird rendering issue when applying lightmap through HLSL I have a weird issue when trying to render the lightmaps in my game.

Please see the following screenshots.

Note how the scene looks up close with the lightmaps enabled.

Note how that same part of the scene is now completely blacked out (as well as its surroundings) - this happens gradually as you zoom out.

When I completely disable the lightmap, nothing is blacked out, making me believe its related to the way I apply it with HLSL.

Here's how I my Pixel Shader code looks like:

float4 PS1(VSO input) : COLOR
{
    float4 albedo = (HasAlbedo) ? tex2D(AlbedoSampler, input.UV) * input.Color : input.Color;
    float4 lightmap = (HasLightMap) ? tex2D(LightMapSampler, input.LightMapUV) : float4(1, 1, 1, 1);

    float4 finalColor = float4(albedo.xyz * lightmap.xyz, 1.0f);

    return (HasFog) ? input.FogFactor * finalColor + (1.0 - input.FogFactor) * FogColor : finalColor;
}

Am I doing something wrong in my HLSL? Or is it most likely something else?

For some additional information:

I use SharpDX in combination with C#.
The assets in the screenshots come from the game "Medal of Honor Allied Assault", so my sincere apologies for the Swastika signs if it offends anyone. This scene just happened to show the issue perfectly.

sentences:
How can I limit the y-rotation of a cinemachine POV camera based on the player's direction? I'm using Unity (2019.4.11.f1, HDRP).
My goal is to create a first-person POV camera.
To this purpose, I tied a Cinemachine (2.7.3) Virtual Camera to the head of a third person player character (one from the Basic Locomotion demo of this asset).
The Body of the camera is set to 'Hard Lock to Target', Aim to 'POV', and Recenter Target to 'Follow Target Forward'. This works fine.
The camera has a Horizontal Axis Value Range (-# to #), that limits the rotation of the camera, but I cannot figure out how to tie this to the rotation of the Follow component (the head of the avatar).
When I walk my character around, the camera can only rotate within the set Value Range angle that has it's 0-point in one absolute direction (let's say north), independent of the player's orientation.
It seems to use World Orientation, but I don't know and wasn't able to find out where to change that.
Does anyone know how I can change this behaviour?

sentences: SDL surface inside another GUI component? Is there a way to host an SDL surface inside another GUI component so that SDL is not at the top-level? For instance, could I put an SDL surface inside a Java JPanel or other widget?

sentences:
Elliptical orbit modeling I'm playing with orbits in a simple 2-d game where a ship flies around in space and is attracted to massive things. The ship's velocity is stored in a vector and acceleration is applied to it every frame as appropriate given Newton's law of universal gravitation. The point masses don't move (there's only 1 right now) so I would expect an elliptical orbit.

Instead, I see this:

I've tried with nearly circular orbits, and I've tried making the masses vastly different (a factor of a million) but I always get this rotated orbit.

Here's some (D) code, for context:

void accelerate(Vector delta)
{
    velocity = velocity + delta; // Velocity is a member of the ship class.
}

// This function is called every frame with the fixed mass. It's a
// method of the ship's.
void fall(Well well)
{
    // f=(m1 * m2)/(r**2)
    // a=f/m
    // Ship mass is 1, so a = f.
    float mass = 1;
    Vector delta = well.position - loc;
    float rSquared = delta.magSquared;
    float force = well.mass/rSquared;
    accelerate(delta * force * mass);
}

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:
Coordinates different between Tiled editor and my game So I have been using Tiled map editor to create my map for my game. I'm using Libgdx to load and draw the map.

The problem is that the coordinate from objects placed in tiled do not seem to be the same when they are using in my game. It seems to be just the y value, as I have tried a few different positions and the x value seems to be okay.

I think it may be because Libgdx coordinate systems starts in the bottom left instead of the top left, but I'm not sure. And I'm not sure how to get around it.

In Tiled:

In game:

The black square is being drawn at the x and y values grabbed from the object.

I get the values from this function once the map loads:

    public Vector2 getStartingPosition()
{
    for (TiledObjectGroup group : map.objectGroups) {
        for (TiledObject object : group.objects) {
            if ("playerSpawn".equals(object.name))
                return new Vector2(object.x, object.y);
        }
    }

    //Was not found, return default spawn
    return new Vector2(0,0);
}

sentences:
OpenGL application, not working on AMD. Recently,

I moved an app I am building from a computer with Intel & Nvidia to a computer with AMD CPU & GPU.

The problem is, that glDrawElements gives me bad access location and I can't figure out why.

The render function is the following:

template<class PositionData> void drawTexturedMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color, GLuint text)
{
  // draw mesh
  const unsigned int *faces = mesh.getFaces().data();
  const unsigned int nFaces = mesh.numFaces();
  const Vector3r *vertexNormals = mesh.getVertexNormals().data();
  const Vector2r *uvs = mesh.getUVs().data();

  // Update our buffer data passed to GPU
  glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(double) * 3 * pd.size(), &pd.getPosition(0)[0]);
  glBindBuffer(GL_ARRAY_BUFFER, 0);

  glBindBuffer(GL_ARRAY_BUFFER, vbo[1]);
  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(double) * 2 * mesh.getUVs().size(), &uvs[0][0]);
  glBindBuffer(GL_ARRAY_BUFFER, 0);

  glBindBuffer(GL_ARRAY_BUFFER, vbo[2]);
  glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(double) * 3 * mesh.getVertexNormals().size(), &vertexNormals[0][0]);
  glBindBuffer(GL_ARRAY_BUFFER, 0);

  // Binding element array and drawing. numFaces * 3 triangles per face.
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
  glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(unsigned int) * mesh.getFaces().size(), mesh.getFaces().data());

  glDrawElements(GL_TRIANGLES, 3 * nFaces, GL_UNSIGNED_INT, BUFFER_OFFSET(0));

  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}

Math, vectors and matrices are from Eigen.
Any ideas or any other code part you would like to see?
Bare in mind that this exact code works fine with nVidia.

Thanks.

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:
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: 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:
Persistent variable for all list members inside a loop called every frame I'm trying to add a sort of manager to handle all objects in a list and increase a float value that each individual member of the list has given a condition every single frame. I'm having some trouble wrapping my head around the actual code I need though.

So say I've got an OverlapCircleAll or trigger checking for tagged objects in a certain radius. These objects are then added to a List (foo).

Then, I go through foo with a for loop and declare a float value x for each object.

What I need is for each object's x to increase when the object is also on another list, bar.

So something like this:

for (int i = 0; i < foo.Count; i++)
{
     float x;
     //or float x = 0;?

     if (bar.Contains(foo[i]))
     {
          x += 1f;
     }
}

The problem is, I can't figure out how to make the value of x persist each loop. This function is called in Update() so the idea is that the longer an object is in both foo and bar, the higher its value of x is. I don't know how to save the value of x for the next loop though. Ideally something like:

for (int i = 0; i < foo.Count; i++)
{
     float x;

     if (lastX != null)
     {
          x = lastX;
     }
     else
     {
          x = 0;
     }

     if (bar.Contains(foo[i]))
     {
          x += 1f;
     }

     float lastX = x;
}

But I don't know a) how to save lastX for each object in the list and b) set x to lastX (because for each loop it creates a lastX).

I thought about storing each x in an array of floats and calling the corresponding array[i] to foo[i] to get x, but if I remove something from the list then the array will become desynchronised with the list and all the x values will get muddled up.

What is the correct way to go about this?

sentences:
Where does Unity save the editor window layouts? In every project there are the CurrentLayout.dwlt and CurrentMaximizeLayout.dwlt files, but those, as the name implies, are just the current layouts.

I've been unable to find the general files where it saves all your layouts, in order to copy it to another computer.

Where is it?

sentences:
How to read a custom map format I am trying to create a custom map format for my own little 2D RPG, so my question is rather how do I manage reading and creating a custom map format properly and flexible. First off, I am writing my code in Java. The idea was to have a class called 'TileMap'. This class defines a 2-dimensional integer - array where all my entities are stored ( I'm using an entity-system to realize my game ). I also want to save and parse some information about the size of the map before the actual reading process happens. The map file should look much like this:

#This is a test map
width=4
height=3
layercount=1
tilesize=32

[1;0;0;0]
[23;1;0;0]
[5;0;1;0]

where layercount is the number of layers the z-dimension offers. and tilesize is the size of every tile in pixels. Entities are defined in between the brackets. The pattern goes: [entity_id;x_pos;y_pos;z_pos]. I already wrote the code to parse a file like this but its not very flexible because you just have to put one tiny whitespace in front of the square brackets and the map can't load up.
I just need some few helpful tips to do this in a flexible way. Can anybody help me out?

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:
Unity Json utility does not serialize DateTime Like the title said the unity json utility does not seem to allow me to serialize the DateTime structure. Just to clarify the problem is that I'm serializing this class:

[Serializable]
public class SaveData {

public Vector3 playerPosition;
public Quaternion playerRot;
public List<Item> inventory;

public DateTime saveTime;

public int playerHealth;

public int strength;
public int attack;
public int defense;
public int agility;

}

When I actually write to the json file I get everything but the DateTime and no errors. This is the result:

{
"playerPosition": {
    "x": -142.27000427246095,
    "y": -7.000000476837158,
    "z": -112.80999755859375
},
"playerRot": {
    "x": 0.0,
    "y": 0.0,
    "z": 0.0,
    "w": 1.0
},
"inventory": [],
"playerHealth": 100,
"strength": 0,
"attack": 0,
"defense": 0,
"agility": 0
}

Is there a way around this?

A little update to this question so that I can show another way I've worked around this problem if the answer below isn't for you.

I was recently working on a similar problem and solved it by doing the follow:

I created a new class called "NewDateTime":

[System.Serializable]
public class NewDateTime {
public int second;
public int minute;
public int hour;

public int day;
public int month;
public int year;

public NewDateTime CreateNewDateTime(DateTime dateTime) {
    NewDateTime newDateTime = new NewDateTime();
    newDateTime.second = dateTime.Second;
    newDateTime.minute = dateTime.Minute;
    newDateTime.hour = dateTime.Hour;
    newDateTime.day = dateTime.Day;
    newDateTime.month = dateTime.Month;
    newDateTime.year = dateTime.Year;

    return newDateTime;
}

public override string ToString() {
    return day + "/" + month + "/" + year + " at " + hour + ":" + minute + ":" + second;
}}

and then for example when I want to save the date to json I would do something like the following:

saveDateTime = newDateTime.CreateNewDateTime(DateTime.Now)

it's a rather simple workaround but I thought it might help.

sentences:
Programming Paradigm for Games Which programming paradigm resembles or best suits the Game design or game engine programming?
by paradigm I mean the Imperative, Object oriented, Functional, etc. I came to know that functional programming is more modular than object oriented and is concurrent. is it??

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:
Framerate independent realtime input I am currently working on a fighting game (with 3d graphics, gameplay like a 2d fighter) and encountered a pretty big hurdle I currently don't know how to deal with. For fighting games, input consistency is an absolute must, for example reading and processing the user input 60 times per second with fixed intervals between the input processing steps.

I started my game with Unity and right now, Unity's input is tied to the Update() function which means that during one Update() the input is consistent. the problem is that this would mean that input is framerate dependent and it would be pretty bad if the game has lag spikes or some machines cannot run the game at full 60 fps. I read that Unity is working on a new input system that allows for framerate independent input, but it is uncertain when the input system is finished or when it will be implemented in a public build:

https://forum.unity.com/threads/welcome-new-input-system-resources-and-info-please-read.397153/

I searched a little in the Unreal Engine 4 forums but couldn't find an answer to my specific question whether the engine does process the input really frame rate independent.

The goal is the following: Have the game logic separate from the main thread which handles rendering in another thread. Read the user input at fixed time steps, for example 16,6 milliseconds, provide this input information to the game logic thread, calculate the game logic for the input (which of course must take less long than 16,6 milliseconds) and only use the main thread for rendering the world state. For example by taking the world state data from the logic thread from the previous frame and the current frame and interpolate the data, then render the visuals with the provided interpolation.

My question is:

Is my approach the correct one when the goal is to have framerate independent input for games?

sentences:
How to rotate "stacked sprites" in XNA? I'm working on a simple Sinistar-style shooter in XNA, and I'm constantly running into trouble with transformations.  I feel like I'll get it eventually, but this problem is really bending my mind.

My little ship has two states: idle and engines-firing.  Idle is a single frame, and engines is a few frames that animate. Got all that.  Part 1 of the issue: Instead of using rotated images, I just use XNA's rotation to orient the ship.  Seems to work ok, but I think my origin point is off because it seems to rotate at a point just below the vertical axis of the ship (default orientation is ship's nose pointing up), instead of in the dead center of the ship.  Likewise, when I switch to engines, the sprites are different heights (due to the flames) so the origin of rotation doesn't seem like it would be constant.  Do I need to specify all my frames the same size so as to preserve the origin point?

Second bit: The gun turret sits on top of the ship, as a separate sprite.  With a bit of trial-and-error and calculation, I can get the gun to align on top where I want it.  But then when the ship rotates, it rotates out from under the gun!  Would fixing the first problem adequately cover this one, or is there some trick to getting the gun's position to translate properly?

So:

Do I need to have all my sprite's frame-rectangles be the same dimensions?
Is there a standard technique in XNA for stacking multiple sprites so they act as one unit, including for rotations?

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: Quarter turn sprite sheets? I'm having trouble finding sprite sheets that have the characters turn in 8th movements, so that you can see back, front, left, right, and in between.  What would be a good term to search for when trying to find these kind of sprite sheets?

sentences:
The purpose of using invert and transpose In openGl ES and the World of 3D - why use the invers matrix?

The thing is that I dont have any intuition to, why it is used, therefore please correct me:

As fare as I understand, it is used in shaders - and can help you to figure out the opposite direction of the normals?

Invers in ordinary numbers is like; The product of a number and its multiplicative inverse is 1. Observe that 3/5 * 5/3 = 1. In a matrix this will give you the Identity Matrix, which is the base coordinate system or the orion of the World space - right. But the invers is - some other coordinate system?

You can use the transpose(Row-major order to Column-major order) of a square matrix to find the inverted matrix, as calculating the invers is process heavy - and the transpose is giving you the inverted matrix as a bi product?

Again, I am looking for getting some intuition of this - and therefore be able to use it as intended. Thank you for any reply that will guide me in the right direction.

Regards

sentences:
Updates for IOS AppStore Multiplayer Game I am developing a multiplayer game for the web, android and ios. For the web and android i can instantly push out new versions of my game because they support executing remotly loaded code. But with IOS i need to wait for an Apple approval taking about 10 days. I want to push updates more then weekly.

What if my server code changes so the client MUST update? Run an old version of the server code just for IOS? How do other multiplayer devs handle this ?

sentences:
Is there any scroll algorithm for OpenGL ES? I was working on J2ME games in the past, when draw a large backgroud, I always use the Carmack 2d scroll algorithm, keep a image buffer a little larger than device screen, draw the changed small tiles to this buffer, then draw the buffer to device screen. This can reduce the number of times to call drawImage().

Now we need to prepare for opengles 2D games for iphone and android. I am new about opengl, but i have try to read some engine code and keep learning opengl. There isn't much problem about 2d graphic system, except the tile buffer, there is no image buffer any more, so what size of the tile should i use? The screen size maybe 800*480, if i keep the 32*32 tile, i need to draw about 400 tiles per frame, will this be ok?

sentences:
How to tune steering behaviours to pick the best target around obstacles? I want to chase an enemy, but there are obstacles in the world. Imagine there's an obstacle stopping me reaching the closest enemy, but in another, unobstructed, direction is another enemy but at a further distance:

***************
E ** P        E
***************

* - obstacle
E - enemy
P - player

My enemy-chasing behaviour returns a vector pointing towards the left-most enemy, and my obstacle avoidance behaviour returns a vector pointing to the right, away from the obstacles. At some point they balance out and I have stalemate!

This could all be avoided if there was an elegant way of choosing the other enemy at the beginning.

Is this a common problem in steering behaviours? How is it regularly solved? I may have a lot of enemies, so pathfinding to each first may be inefficient.

sentences: Can i use art from another videogame as base for my art? For example: if I take the 3d models and textures from GTA: San Andreas and I modify them making better models and textures, can i use this new art to make a game with a different gameplay and sell it without infringing the game's copyright?

sentences:
Local to World coordinates in 2D and back I'm getting back into hobby game programming after a long 4-year hiatus from college and I find that my understanding of coordinate systems is somewhat lacking.

I'm trying my skills at creating a simple skeletal animation system but I'm having a hard time wrapping my head around converting local coordinates (of say, a joint) to world coordinates, particularly when it comes to rotated sprites.

I'm trying to create a test app in XNA and accomplish this using their built-in matrix class.  Can anyone assist me in either linking a resource or helping me understand the operations I'd need to do to convert any point that is Scaled/Rotated/Translated from a local to a world coordinate and back?

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:
switching from third person view to first person view I have done a scene in opengl where I'm using a third person camera (that I can control with the mouse). Then, inside it, it has the camera of the first view (that I called thirdpersonCamera, see the code above), drawing the camera, the frustum etc..

It looks like this picture:

and I've done with this code:

void GLView::drawSubThirdpersoncamera()
{
    // set perspective viewing frustum in the 3rd person camera
    thirdpersonCamera.setFrustum(FOV_Y, (float)(W)/(H), NEAR, FAR);

    // use 3rd person camera projection matrix (the frustum, the perspective etcetera)
    // as the opengl camera
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(thirdpersonCamera.projectionMatrix.getTranspose());
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glPushMatrix();
    {
        // First, transform the camera (viewing matrix) from world space to eye space
        glLoadMatrixf(thirdpersonCamera.viewMatrix.getTranspose());

        // translate and rotate the mouse control
        // (keeping the camera fixed because
        // we want only the scene to rotate/translate)
        // for thinking about modern opengl: should be a matrix..
        glTranslatef(mousePosition[0], mousePosition[1], mousePosition[2]);
        glRotatef(mouseAngle[0], 1, 0, 0); // pitch
        glRotatef(mouseAngle[1], 0, 1, 0); // heading
        glRotatef(mouseAngle[2], 0, 0, 1); // roll

        // now the draw the scene
        drawScene();

        // draw the first person camera
        glPushMatrix();
        {
            glMultMatrixf(physicalCamera.viewMatrix.getTranspose());

            drawAxis(4);
            drawCamera();
            drawFrustum(physicalCamera.fovy, physicalCamera.aspectRatio, physicalCamera.near, physicalCamera.far);
        }
        glPopMatrix();

    }
    glPopMatrix();
}

Now I want to switch to the eye of the camera I've drawn, with this code:

void GLView::drawSubPhysicalCamera()
{
    // use physical camera projection matrix (the frustum, the perspective etcetera)
    // as the opengl camera
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(physicalCamera.projectionMatrix.getTranspose());
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glPushMatrix();
    {
        // the view matrix: how the camera is positioned in the world space
        glLoadMatrixf(physicalCamera.viewMatrix.getTranspose());

        drawScene();
    }
    glPopMatrix();

}

I think it should go because I'm using the same matrix once for translate the object in the screen, once for translate the camera but.. in the second view I don't see anything.. I don't find any error because the transformation in the space is the same but.. it doen't work..

Where am I wrong?

sentences:
Is using sprite sheets and drawing specific part the way to go? I'm programming in Java.

I have more than 200 MB of images used in my games, something like 100000 40x40ish images. I initially wanted to load them all during app initialization but it took like 2 minutes to do so.

Since I do not need them all at the same time I may load the ones I need before entering a new game state (quick loading screen), but there is still a delta time that I can't afford, so I was wondering if it wouldn't be better to gather them into larger images (sprite sheets) to reduce the cost of I/O. But here I am : if I do so, what is the best approach for rendering : splitting these big images back into smaller ones, or keeping the sprite sheets in memory and rendering the needed parts of these sheets directly using Graphics#drawImage?

I will test a simple game loop using the second option to see what happens performance-wise, and come back to compare with what you advice me to do.

I hope I was clear, don't hesitate to ask me to reword an incomprehensible of mine.

EDIT: I just tested loading using sprite sheets and I was able to do load my 200 MB in less than 10 seconds, which means that if rendering little parts of an image can be done at high rate my problem is solved.

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:
Materials and Mesh association I'm trying to implement a Material system in a small engine for training and I've got  questions about materials.

Currently I've got that:

Material: A Material with array of Technique
Technique: Stock an array of Pass
Pass: Content RenderState (blend to apply, draw mode, face culling, …), Shader/Program and an array of Parameter
Geometry: Buffers, Indices, Vertices, ….
Parameter: A parameter is use to stock and share values with program (color, texture,…)

Now I'm not sure about that:

A Material is something shared by Meshes or each Mesh have his own Material?
In my scene, I've got 5 trees: two red trees and 3 blue shiny red trees (same Geometry). Each tree have is own Material or each tree have a reference to the same Material?
The Material own by a Mesh is a copy of a Material or a reference to the original Material?
In my Material I have texture offset and scale, it's useful for drawing a part of the Texture only, but how can I manage offset and scale if my Material is shared and each owner didn't use the same values? (In the case where all my objects are in the same texture atlas)
If each mesh have his own Material instance (a copy of an original Material) how can I know if each Mesh have the same Material? (An ID per Material may be?)

Thanks a lot!

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:
Should I write my own game engine, and if so what are the main features? Possible Duplicate:
  When to roll your own game engine?

I've been interested in writting games for a while, and now that I have acquired a bit of experience in programming, I feel like I could step up to making a little more complicated things. I've had some fun with SFML but since now I only had the basic classes I needed for my game objects, and a big run() method of my Game object to "run them all".

I've only written gameplay tests so far, but I feel like a complete game in the same style of programming would be a gigantic headhache source. I am now facing a problem/question : should I be considering creating my own little "game engine", learning through it, adding features as I need them ?
I think it could be a really good experience, but it would certainly take time as I'm no professional, and I don't have a clear view of "how-to" yet.

I am using SFML with C++.

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:
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:
Creating a full-screen window in Windows API I've got a Windows API Window. I've managed to make it windowed, and "fullscreen windowed". But I can't seem to make the window just full-screen- for example, even if I specify WS_POPUP, I can still freely move the cursor to my second screen. However, if I launch full-screen games, they don't permit it, and exist only exclusively or minimized. How can I make a window that behaves this way?

Edit: Excuse me. Limiting the mouse movement was just one example of how a full-screen window behaves differently to a non-fullscreen window, I'm not looking for how to limit the mouse movement.

Or is this set in the D3DPRESENT_PARAMETERS, rather than just communicated?

sentences: Directional, Triangular Collision Detection in Pygame I am trying to create a game in Pygame, with Python 3, and am trying to figure out an algorithm that will tell me which direction a rectangle is colliding with a rectangle, so that I can push it back the correct direction. I know I can detect rect-to-rect, and I could (possibly?) use pixel-to-pixel collision, but I was wondering if there was a better way. My collision algorithm currently loops through all of the "entity" objects in a Pygame sprite.Group(), and testing for collision using the colliderect() method, then I test which direction the rect is coming from by testing which sides overlap. Is there something similar that I could do with a collision between a triangle and a rectangle, too? Pseudocode would be nice.

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:
Difference between terrain and plane I'm going to make an environment with trees, walls, rocks, mountains and bushes in Unity 3D 5.1 . I don't know what game object suitable for the ground. I have used both terrain and plane in earlier simple projects.

My question is,

  What is the difference  between terrain and plane?

  Which game object is suitable for my requirement?

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:
Black screen when switching from fullscreen to windowed mode with libgdx I have just started working with libgdx, and have run into my first problem. I have a simple program that switches a desktop application from windowed mode to fullscreen and back again. If I start the program in windowed mode, it initially displays fine. When I toggle to full screen it is also OK.

However, when I toggle back to windowed mode the screen goes completely black. The application remains responsive though, and if I toggle again it will go back to fullscreen and display correctly.

I am using 64-bit Windows 7 with the IntelliJ IDEA IDE.

Any help with working out why it is doing this would be greatly appreciated.

A minimal example that displays the issue is shown below:

public class MyGdxGame extends ApplicationAdapter {

    @Override
    public void create () {
        fullScreen = false;
    }

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

        if (Gdx.input.isKeyPressed(Input.Keys.TAB)) {
            fullScreen = !fullScreen;
            DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
            Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, fullScreen);
    }
}

private boolean fullScreen;
}

sentences:
Which is better for a beginner, UDK or Unity? I am just getting into game development and I would like to know which engine would be best to learn first.

In terms of my current skills, I know a good deal of javascript, but not much beyond that. This is all a learning experience for me (I am an extremely fast learner).

I am using HTML5 canvas right now as that's mostly what I was hinting at when i said javascript. I probably should have made it a bit more clear.

sentences:
GluUnproject works, but only when the camera is not rotated I am working on a very basic 3D program, my first one using OpenGL.  What I am trying to do is trace a ray from the mouse's location on click which works, but only when the camera is not rotated. When the camera is rotated, the unproject treats it as if it was not.

What am I doing wrong?

The code for unproject:

Coord3<GLdouble> Display::GetOGLPos(uint16_t x, uint16_t y)
{
    GLint viewport[4];
    GLdouble modelview[16];
    GLdouble projection[16];

    Coord2<GLfloat> window_location;
    Coord3<GLdouble> resultant_ray;

    glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
    glGetDoublev(GL_PROJECTION_MATRIX, projection);
    glGetIntegerv(GL_VIEWPORT, viewport);

    window_location.x = (float)x;
    window_location.y = viewport[3] - (float)y;

    gluUnProject(window_location.x , window_location.y, 1.0f, modelview, projection, viewport, &resultant_ray.x, &resultant_ray.y, &resultant_ray.z);

    return resultant_ray;
}

The display code:

void Display::Render()
{
    if(!dirty)
    {
        return;
    }

    glTranslatef(camera.location.x ,camera.location.y, camera.location.z);

    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    glRotatef(camera.angle.y, 1, 0, 0);
    glRotatef(camera.angle.x, 0, 1, 0);

    glCallList(cube);

    glColor3ub(0, 0, 255);

    glBegin(GL_LINES);
    glVertex3f(0,0,0);
    glVertex3f(mouse_click.x, mouse_click.y, mouse_click.z);
    glEnd();

    glLoadIdentity();

    SDL_GL_SwapBuffers();

    dirty = 0;

    SDL_Delay(33);
}

sentences:
Syncing world in a multiplayer I have been working on a client-server architecture for my multiplayer game.

The server is used for communication between Clients. There is no cheat control because I trusting all clients :) I don't want to control any Physics, Cheats in the server.

My game/connection structure is like:

Client 1 (Admin/Host) <---> Server <---> Client 2

Moving Client 1: sending positon every frame - broadcast to Client 2
Moving Client 2: sending positon every frame - broadcast to Client 1

The movements is interpolated and Client 1 can move smooth in Client 2 screen, Client 2 can move smooth in Client 1 screen.

There is 200-300 ms delay in clients but movements working perfectly.

There is no any problem so far. But... How to SYNC World/Level objects?

I should SYNC World / Level objects because world objects (pushing box) is out-of-sync after few movements. But how I can SYNC it?

I tried, send world object positions from Client 1 to Client 2 every frame. Update world objects in Client 2. But not working, objects is unstable and jumping because 200-300 ms delay in Clients.

I searched solution from http://www.gabrielgambetta.com/fpm3.html but I can't figure out it.

sentences:
Best way to get the maximum moveable Area I was thinking about creating a polygonal area, for a given unit, in which it can move with a given range (radius) but with care for obstacles.

Here is a picture to visualize my idea:

My Ideas so far...

The Pathfinding Way

Create a Circle around 'unit' with given 'radius'
Check for intersections with obstacles
If an intersection is found, create a Path from 'unit' to intersectionPoint, but with pathLength == 'radius'
connect all endPoints to get the maximum moveable area
But what if no intersection is found because the obstacle is fully into the circle?

The Ray Way

Cast #Rays into all directions (e.g. 8 Rays for N, NE, E, SE, S, SW, W, NW) from 'unit'
Check for intersections between each Ray and the obstacles
If an intersectionPoint is found, create a Path from 'unit' to rayEndPoint with pathLength == 'radius'
connect all endPoints to get the maximum moveable area
But this needs more than 8 rays to be accurate enough and this will take calculation time

Have you got an idea on how to do this the best way?
Thanks in advance - LuaNoob

Edit #1:

The Flood Fill Way

Read something about flood filling algorithm. I guess this will be the best thing to try.

Example for maximum moveable range = 4

'X' = unit
'#' = wall

# # # # #

3 3 3 3 # 4

2 2 2 # 3 4

1 1 1 2 3 4

1 X 1 # # 4

1 1 1 #

# # #

Edit #2:

Current attempt: Custom Visibility Graph (not tried yet)

I now got i to work to create fast and accurate visible Areas.
What im gonna to do next is:

try to find the first point on the obstacle, that is in a line of sight by 'unit' and the not reachable endPoint of the Visibility-Ray-Cast
create a new Visibility Graph from there but with 'newRadius' = 'radius' - distance(unit, firstPointOnObstacle)
connect the Points
repeat it for every not reachable Point with custom 'newradius'
One Problem left: Holes cant be created, but these are the rarest occuring situations, where i can fit with

sentences:
D3D11 SetShader States I have some questions regarding the XXSetShader and what happens after, for instance I would like to know if when XXSetShader is called the subsequent calls would be bound to that particular shader, like PSSetShaderRsources. Because at load time I am bounding the resource views needed for that particular shader, then the next one and so on, but what I found is that the resources were not bound, I need to set them again every time the XXSetShader is called.

Am I doing something wrong? it's not supposed to work like that, the purpose of this is to have the least change states at runtime.

Thanks.

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:
Activate specific element In Array? In my array there are 6 elements "guns" and I want to activate one element after deactivate all of them. Here is my script

public saveInfo _file; // get gun ID number from save file.
public GameObject Player1_pistol;
public GameObject[] pl1_p; // 6 guns

void Start()
{
    pl1_p = new GameObject[Player1_pistol.transform.childCount];
    for (int p = 0; p < Player1_pistol.transform.childCount; p++)
    {
        pl1_p[p] = Player1_pistol.transform.GetChild(p).gameObject;
        pl1_p[p].SetActive(false);
      // Now I need to activate the third element in my array.
    }
}

sentences: UI Automation for Flash Games has anyone used or heard of a good selenium-like toolset for doing automated UI testing with Flash? I would ideally like to have the ability to record and playback events against my game and integrate this into our build server.

sentences:
Resources to help study of Quake 3 engine Are there good resources ( manuals, tutorials, etc ) to start studying the code of the Quake 3 engine beyond the code itself?

I'm very interested in know how it's structured for educational purposes and maybe to do some modifications.

sentences:
Can we use credit card/prepaid voucher payment systems in Android and iOS? We already have a credit card gateway with a local bank. We also have a prepaid card voucher in the market.

In our game, a user will create an account within our portal. The user will "recharge" his account via credit or prepaid (voucher) cards. Then the user will buy services and subscriptions.

My question is: can I put our credit and prepaid card gateway in our Android and iOS apps in order to recharge a user account that belongs to our portal?

sentences:
How to divide hex grid evenly among n players? I'm making a simple hex grid based game, and I want the map to be divided evenly among the players. The map is created randomly, and I want the players to have about equal amount of cells, with relatively small areas. For example, if there's four players and 80 cells in the map, each of the players would have about 20 cells (it doesn't have to be spot-on accurate). Also, each player should have no more than four adjacent cells. That is to say, when the map is generated, the biggest "chunks" cannot be more than four cells each.

I know this is not always possible for two or three players (as this resembles the "coloring the map" problem), and I'm OK with doing other solutions for those (like creating maps that solve the problem instead). But, for four to eight players, how could I approach this problem?

sentences:
How to share battle execution code between client and server? We're making an online turn-based game. There's some logic that is executed in both client and server side. Here's the pseudocode that shows how we share the code:
// Shared Code
class BattleExecutor {
  constructor(eventHandler)

  void ExecuteTurn(userInputs) {
    ......
    trigger events such as Move, Fire, TakeDamage
    ......
  }
}

// Server
new BattleExecutor(noOperationHandler)

// Client
class ClientEventHandler {
  // play Move, Fire, TakeDamage anime
}

new BattleExecutor(new ClientEventHandler())

In this design, the shared BattleExecutor has the logic of how game is played. Client code is just to play the anime for the events that triggered in BattleExecutor. Server needs the BattleExecutor to determine if user inputs are valid and to determine battle result (who won).
Now our problem is, think of this scenario, in one turn BattleExecutor triggers a Fire and a TakeDamage event within 1 millisecond. But in client side TakeDamage can only be played when Fire anime is done (bullet flying takes time). How to control the playing of events in client side?
The solution we're considering is to add "Id" and "DependOnIds" property to Event class, meaning that BattleExecutor provides the information of "event A should happen after events B, C, D". Client knows when anime of B, C, D is done playing, after which client starts playing anime of A. This solution looks a little messy to us, because BattleExecutor now needs to figure out the dependency of events which server doesn't care about at all.
Is there any more elegant solution that can share battle execution code between client/server and allow client to control the playing of events correctly?

sentences:
Separating lighting for interior & exterior parts of a scene I want outdoor areas connected with indoor areas. I use the default setup in Unity.
But as you see in image, indoor point light affects the outdoor area (through the walls) and the skybox does more environment illumination in the indoor area.

How to fix that?

So, I want a skybox that only affects outdoor areas, and point lights that only affect interior areas.

sentences:
How can I teleport seamlessly, without using interpolation? I've been implementing Bukkit plugin for creating toggleable in-game warping areas that will teleport any catched entity to other similar area.

I was going to implement concept of non-Euclidean maze using this plugin, but, unfortunately, I've discovered that doing Entity.teleport() causes client to interpolate movement while teleporting, so player slides towards target like Enderman and receives screen updates, so for a split second all underground stuff is visible.

While for "just teleport me where I want" usage this is just fine, it ruins whole idea of seamless teleporting, as player can clearly see when transfer happened even without need to look at debug screen.

Is there possibility to somehow disable interpolating while teleporting without modifying client, or maybe prevent client from updating screen while it's being teleported?

sentences:
2D Physics in a networked game (iOS)? I am researching the possibilities for a new iOS game. It's going to be a run-n-gun type platformer, and I'm looking into the possibility of co-op multiplayer.

The game itself wouldn't be very physics intensive, there will most likely be 20-30 physics bodies at any given time. For the multiplayer, I think I would have one player "hosting" and up to 3 other connecting via the Internet.

Here's my first question, are there any 2D physics engines that work over a network(preferably open source)?

My second question, Does anyone have any thoughts on using a non-networked engine (like Box2D or Chipmunk) and adding the networking component? Since there would not be very much information sent, do you think it would cause a lot of lag?

sentences:
Unity Class Inheritance Problems Hi I am trying to create a game where there are different types of zombies. I decided to create a base class for the zombies that includes methods for moving and flipping characters and then I have individual classes for each type of zombie where I will modify things like health and damage.

I made it so the zombie prefab I put in the game has a script that inherits from the Zombie class but when I run the game nothing in the Zombie.cs script is run.

Anyway, here are my classes:

Zombie.cs

public class Zombie : MonoBehaviour {

    //zombie goes after this target
    Transform targetPlayer;

    //Zombie Rigid Body
    Rigidbody2D zombieRB;

    //The speed the zombie will move
    public float moveSpeed;

    //Used for flipping zombie based on which way it is going
    bool facingRight = true;

    // Use this for initialization
    void Start () {

        zombieRB = GetComponent <Rigidbody2D> ();

        //This finds the player object to follow it
        targetPlayer = GameObject.FindGameObjectWithTag ("Player").transform;
    }

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

        //Checks zombies position in comparison to player to see where it should move.
        if (transform.position.x < targetPlayer.position.x) {
            //zombie to the left of target go right

            if (!facingRight) { //Check if needs flipping
                flipZombie ();
            }

            zombieRB.velocity = new Vector2 (moveSpeed, zombieRB.velocity.y);

        } else {
            //zombie to the right of target go left

            if (facingRight) { //Check if needs flipping
                flipZombie ();
            }

            zombieRB.velocity = new Vector2 (moveSpeed * -1, zombieRB.velocity.y);
        }

    }

    /// <summary>
    /// Flips the zombie when moving
    /// </summary>
    void flipZombie() {
        facingRight = !facingRight;
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;
    }
}

And then I have a pulserZombie.cs but there is nothing in it but the inheritance:

public class pulserMovement : Zombie {

Here is my image of the prefab I have:

sentences:
Simple square vertex lifting shader I am trying to rebuild the fur effect in Viva Pinata.

Here each square becomes a pattern of fur

I imagine the process to be like this...

U lift one end of the triangles.

Now I need to achieve "lifting one end of square". I can do either vertex, fragment, geometry shader. However I am clueless when it comes to determining which vertex is "end of square", so that I know which vertex to lift up.

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:
How to detect collisions in Unity ECS? I am creating a game using the new Data-Oriented Tech Stack (DOTS).
I am using Entities with the PhysicsShape and PhysicsBody authoring components of the new Physics package. Some of my PhysicsShape have "Collison Response: Collide Raise Collision Events" set. Unfortunately the documentation of the new Physics system doesn't say anything about how I can detect and handle these collision events, and information on the Internet regarding this is very sparse and disorganized. How can I detect when one PhysicsShape collides with another one sending collision messages and run some code in that case?

sentences:
Speed needed to make a car jump from a ramp I need to make a car jump from a ramp to another, and I need this to be done using AI so I thought it would be enough to set a fixed speed for my car when near the ramp, in order to let it jump correctly.

It works fine if I input the speed manually but I'd like my game to calculate it since the ramps will be generated by user's input.

Unfortunately my physics knowledge lacks, so I need your help.

The problem is summarized in the picture below.

Basically, what I need to compute is the speed (in m/s) that the car has to have on the highest point of the first ramp, given that all the data in red are user's input.

I had some rough ideas on using the projectile range with x=L, y=h-launchRampHeight but the results weren't as I expected them so I gave up.

Do you have any hints on this?

Please note that both ramps have the same length (50m).

EDIT:

Based on @mklingen here's the C# code that I'm using (where Distance = L)

var speed = (Mathf.Sqrt(g)*Mathf.Sqrt(Distance)*Mathf.Sqrt((1/Mathf.Sin(Theta)))* Mathf.Sqrt((1/Mathf.Cos(Theta))))/Mathf.Sqrt(2);

What happens is quite weird though.

For example, with theta = 19, L = 196, h = 46 my code returns 80.54646 which seems to work if I input it to the car. However running the expression in WolframAlpha leads to 55.8 which is wrong.

It may seem that the code is correct but with theta = 35, L = 261, h = 39 my code returns NaN while WolframAlpha shows 52.17 which made the jump happen.

So, tu summarize, I have 2 different cases in which my result is different from WolframAlpha's one and none of them is the correct one both the times.

What's going on?

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:
Collection of Simple Children's Game Mechanics Context:

I've tried Googling / searching on Amazon for books on this, but I end up get all types of resources on "How to Gamify XYZ" rather than the mechanics of simple games.

I'm trying to build a collection of "simple game mecahnics" that often shows up in Children's games. For example:

color in the picture
fill in pieces of a puzzle
memory/matching game

Question:

Is there some gigantic list of these "mechanics of simple games" ? Somewhere?

I don't need actual implementation (I can do that on my own).

I just need english descriptions of what the mechanics are.

Thanks!

sentences:
Rotating a GameObject around its center I'm trying to rotate a GameObject that consists of several cubes around its center of gravity on an axis.

When using transform.Rotate(), it rotates around its pivot point (as shown in picture 1) and not its center of gravity as I want (picture 2). How can I achieve this rotation?

Picture 1:

Picture 2:

sentences:
How to make the minimap inactive? I have created a minimap for my top-down Shooter and it is showed on the top-left corner of the window. The problem is that if I press anywhere upon the minimap, its like pressing somewhere on the normal game as I have used views to make it. Is there any way to make the minimap inactive?

Thanks in advance.

sentences:
Creating a large ground texture for mobile Does anyone has any insight on creating / texturing a large mesh that will be used for a mobile game's level map?

Specifically, I was wondering how games like Vainglory achieve this.

I am familiar with the idea of splat maps, however this is where my knowledge of the subject ends...

Is the use of splats on mobile a good solution? Should the mesh be broken down into small sections which are UV'd and textured separately? Neither of these things?

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:
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:
Moving AutoParallaxBackground's ParallaxEntity in X and Y direction Currently I can move AutoParallaxBackground's "ParallaxEntity" in one axis. Like:

final AutoParallaxBackground autoParallaxBackground = new AutoParallaxBackground(0, 0, 0, 12);
autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(0.0f, new Sprite(0, 0, resourcesManager.gameBackgroundRegion, vbom)));
autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(-3.0f, new Sprite(0, 300, resourcesManager.gameCloudFarRegion, vbom)));

This will make the "gameCloudFarRegion" move left to right.

I want to move something from Top to bottom or bottom to top, I mean Y axis.

How can it be done?

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:
Procedural Breakout level generation I am currently developing a Breakout game for a school project, and I've decided to use it as an opportunity to get started with procedural content generation. I took a quick look at some of the basic procedural stuff, but I wanted to know if there is a known good method to generate levels for this kind of game (block patterns, "power up" distribution, etc).
Any articles or ideas are greatly appreciated.

sentences:
Pathfinding with lock and key? I'm working on a game with maps that resemble lock and key puzzles. The AI needs to navigate to a goal that may be behind a locked red door, but the red key may be behind a locked blue door, and so on...
This puzzle is similar to a Zelda-style dungeon, like this picture:

To get to the Goal, you must defeat the Boss, which requires going over the pit, which requires collecting the Feather, which requires collecting the Key

Zelda dungeons tend to be linear. However, I need to solve the problem in the general case. So:

The goal could require one of a set of keys. So maybe you need to get either the red key or the blue key. Or there could be an unlocked door the long way around!
There could be multiple doors and keys of a kind. E.g. there could be multiple red keys in the map, and collecting one will grant access to all the red doors.
The goal may be inaccessible because the right keys are behind locked doors

How would I perform pathfinding on such a map? What would the search graph look like?
Note: the last point about detecting inaccessible goals is important; A*, for example, is extremely inefficient if the goal is inaccessible. I would like to deal with this efficiently.
Assume that the AI knows where everything is on the map.

sentences:
Creating a path including loops and spirals I have a paper airplane that I would like to take a "random" path towards its destination based on the game layouts size. I want it to include spirals and loops and gliding a little back and forth.

How would I go on about creating those random movements?

sentences:
Get the tile in unity tile map I am trying to get the sprite of a tile in unity from where a raycast hits. Right now it only works in some cases, and always in positive x.

This is my current code.

Vector3Int LocalPos = new Vector3Int((int)hit.point.x, (int)hit.point.y,0);

Sprite spr = tilemap.GetSprite(LocalPos);

From what I can tell it gets the correct sprite.

Edit: I removed pointless code

sentences:
How would you handle different aspect ratios in a 2d platformer? A long time ago, 4:3 was pretty much the only apect ratio you would find on a PC. Today the most common one is 16:10, but most new monitors (especially laptops) are 16:9

I'm writing a 2D platformer, and I can't decide how I should handle all the different ratios.

Here are some ideas:

4:3 gets more content, widescreens are cut on top and bottom
16:9 gets more content, the others are cut left and right
The game is in 16:9 with black horizontal bars for other ARs
The game is in 4:3 with black vertical bars for other ARs

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

out vec2 gTexCoord;

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

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

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

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

        EndPrimitive();
    }
}

Vertex shader
#version 150
#extension GL_ARB_explicit_attrib_location : enable

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

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

sentences:
box2D and libgdx: Attach ParticleEffect to Body Hello I am a newbie with libgdx, my question is: how could I add a Particleeffect to a Body that is moving? I searched about the matter and I didnt find anything related to it.

I have the following code to add my ball:

public Body createThrowedBall(float x, float y) {

    Gdx.app.log("createThrowedBall", "("+x+","+y+")");

    BodyDef ballDef = new BodyDef();
    ballDef.type = BodyType.DynamicBody;
    ballDef.position.set(x,y);

    CircleShape shape = new CircleShape();
    shape.setRadius(5.5f);

    FixtureDef fixtureDef= new FixtureDef();
    fixtureDef.shape = shape;
    fixtureDef.density = 1f;
    fixtureDef.friction = 0f;
    fixtureDef.restitution = 0f;
    fixtureDef.filter.groupIndex = -1;

    Body body = world.createBody(ballDef);
    body.createFixture(fixtureDef);
    shape.dispose();

    // note the massive impulse vector

    body.applyLinearImpulse(new Vector2(0, 5500), new Vector2(x,camera.viewportHeight), false);

    return body;
}

That draws a simple circle shape that is throwed up. I want to add like a fire effect burning during the throw ( I did it with the Particle Editor) but I dont know how to attach it.

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:
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:
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:
What is the best way to store temporary selected characters and their insertion order? I'm developing word game, similar to "Word Mole". I'm having a hard time determining how to store temporarily selected characters, which in turn, will changed into a word.

For example, say, I have the following characters:

      0  1  2  3
   0 O  B O S
   1 S  F  R  H
   2 T  N  E  Z
   3 R  B  D  I

I store all this information in a character array named playCharacter, and I also created a character array named markedCharacter, with the default value of ' ' for each element. Every time I select each cell, say cell[1,0], I set markedCharacter[1,0] = 'b' an so on, until I'm done with current word. How do I store the step information? For example, if I choose to play bored, I'll be marking:

markedCharacter[1,0] = 'b'
markedCharacter[2,0] = 'o'
markedCharacter[2,1] = 'r'
markedCharacter[2,2] = 'e'
markedCharacter[2,3] = 'd'

Do I need another array? if so, what data should I store in it?

In turn, I'll want to use this markedCharacter as a way to check

if certain moves are valid (eg, are they marked within an already marked neighbor cell?)
if stored words are valid or not (this part is already covered)
I don't need to do undo operation

sentences:
How to Access MouseLook In Unity 5 with JavaScript I'm following a tutorial to make a horror game. In the 8th tutorial I got stuck with the Mouselook option, he is using an other version of unity and I'm using Unity 5.

In Unity 4, MouseLook was a script attached to FPController, but in Unity 5, MouseLook has changed to become a part of FPController Script (in C#) as an object.

Now I need to access that, how to do that?

The file I am using is here: http://ryandome.weebly.com/ (named pausemenu.js)

And the error is in line 238 where it's unable to get the FPS controller's Mouselook option:

firstPersonControllerCamera = gameObject.Find("First Person Controller").Find("FirstPersonController");
print(firstPersonControllerCamera);
mainCamera = gameObject.FindWithTag("MainCamera").GetComponent("MouseLook");
firstPersonControllerCamera.enabled = false;
mainCamera.enabled = false;

sentences:
Search app store for similar games on pc I want to search the app store for similar games so I can see how much competition there will be for any apps I am thinking of designing.

Knowing how many clones/similar games there are plus there prices and success rate would go a long way in deciding which ideas to take forward.

Is there anyway to do this easily on a pc (I do not have an iPhone)

sentences:
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:
Shadows in deferred rendering I've read some material about deferred rendering, and I think I get the gist of it. But what I don't understand is how it accomplishes shadows. The G-buffer, as far as I'm aware, does not involve creating a shadowmap for each light, so I'm confused as to how the lighting pass is aware of whether or not each pixel is occluded. After all, a given pixel which is visible from the camera's perspective may not actually be visible from the perspective of any given light- and that occluding geometry may not be visible from the camera's perspective and therefore have nothing written about it into the G-buffer.

If you start rendering shadowmaps, then it seems pretty much the same as forward rendering- you render all the geometry in the scene for every light to render the shadowmaps.

So how does deferred rendering accomplish shadows equivalent to forward rendering?

sentences:
Blender Edge Split Alternative What other options/alternatives are there to "edge split" for smooth shading low poly game models.

As I understand it, edge split does what it say's, its splits the mesh therefore increasing the vert count.  I have considered manually marking the edges as sharp however I would imagine this leaves artifacts on the model(in-game) ?

Cheers.

sentences:
XNA Aquatic Distortion Effect I'm currently developing a 2D, top-down Windows Phone 7 game involving the surface of a pond.  I'm trying to make the surface feel like actual water (as opposed to just a blue background with sprites drawn on top of it), and one of the effects I'm looking into is a sort of aquatic distortion effect.  Basically, something similar to the first few seconds of this: http://youtu.be/1BpRsjF7QTM?t=3m17s

Any idea on how to do this in XNA? I'm sure I could figure out how to apply the answer to my particular application, but if it helps, my game involves a lot of ripples and I'd like to specifically distort the areas around and just behind the expanding sprite-based ripples.

Thanks!

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:
Why am I seeing streak artifacts on the cube map I'm rendering? I'm getting strange streaks on my cube map when rendering to it. He is my code that is being called each frame:

void drawCubeMap(void)
{

int face;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBindFramebuffer(GL_FRAMEBUFFER, fbo);
//glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapTexture);
//glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glViewport(0,0,sizeT, sizeT);

for (face = 0; face < 6; face++) {

   glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, cubeMapTexture, 0);
   drawSpheres();
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glViewport(0,0,900, 900);
}

Any idea what it might be? The streaking occurs when I'm rotating the spheres around the main sphere.

sentences:
Why are clicks not corresponding correctly to XY positions? I'm trying to make custom buttons in LibGDX (I really only wanted to use it for the Android/Desktop portability, not for any of its features, like Scene2D)

The issue I'm having is that the clickable area and the texture don't have a 100% overlap. I can click some places in the texture that don't respond to my isClicked method, and there are places outside the texture that do. I just don't understand what's happening.

Here's my button  class.

public class btn
{
private Texture btnTexture;

private int x;
private int y;

private int width;
private int height;

public btn(String btnTexturePathSet, int xSet , int ySet)
{
    btnTexture = new Texture(btnTexturePathSet);
    x = xSet;
    y = ySet;
    width = btnTexture.getWidth();
    height = btnTexture.getHeight();

}

public void render(SpriteBatch sb)
{
    sb.begin();
    sb.draw(btnTexture, x, y);
    sb.end();
}

public boolean isClicked()
{
    if (Gdx.input.justTouched())
    {
        if (Gdx.input.getY() >= y && Gdx.input.getY() <= y + height && Gdx.input.getX() >= x && Gdx.input.getX() <= x + width)
        {
            return true;
        }

    }
    return false;
}
}

sentences: What is the specific name of this UI component? Is there a specific name for this kind of ui component? Sometimes it only renders a symbol (without text) so using name like TextComponent is imo not very fitting.

sentences:
Projectile code reports wrong number of arguments I'm not certain as to why my code isn't working. The error reports that the instance_create line uses a wrong number of arguments. What am I doing wrong?

if(ammo > 0)
{
    ammo -= 1;

    bullet_id = instance_create(
        x + lengthdir_x(lenx, image_angle) - lengthdir_y(leny, image.angle),
        y + lengthdir_y(lenx, image_angle) + lengthdir_x(leny, image_angle));

    bullet_id.direction = image_angle;
    bullet_id.image_angle = bullet_id.direction

sentences: LibGDX How to take screenshot and use as background for pause screen So I am trying to take a screenshot of the current situation during the PlayState of the game and when the player pauses the game I want the game to take a "screenshot" save it in memory and not as a file and use it as the background for the pause screen. Any ideas because I have no clue.

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:
Loading Data From Lobby Scene to Gameplay Scene with Photon Network As the title suggests, I am currently stuck trying to program a way to load some game mode preferences (ie. what type of game mode/players on each team/ etc...) from a player lobby scene to the actual gameplay scene.
Currently, I have taken the approach of creating a DontDestroyOnLoad prefab that successfully passes the preferences over; however, when mixed with the Photon Networking API, this becomes very annoying as the Prefab becomes unsynced, resulting in players connecting into the game not spawning into there correct positions and teams reading empty, etc...
Is there a more proper and reliable way to approach transferring player game mode data from the lobby scene to the gameplay scene? I've heard that PlayerPrefs could work but am unsure whether or not they should be used when networking is involved.

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:
Scaling window contents in Pyglet? I'm trying to scale a window's contents so that every pixel displays at a multiple of it's normal size.
Basically I want to achieve larger pixels without scaling each and every individual sprite.
This question is very similar to this one, however that only scales a single sprite. How should I go about this?

sentences:
how to bring movement and rotation vectors of object in the current scene in unity editor sometimes in unity i need to zoom to fix the exact position and rotation of an object. but movement and rotation sign of the object always stays on object and i think its pivot of the object.

How can i really bring those movement and rotation signs to simply perform those translations of my object?

thank you for helping.

sentences:
Effect of vertex winding on normals and shading I have implemented a Phong and Gourand shader for a triangle mesh that is being imported from an STL file. It appears to be working fairly allright but some triangles seem to be what I can only describe as upside down due to lack of better wording. This effect is visible in both shading models albeit a bit smoother in Phong. Here is an example:

On something basic like a cube the rendering is perfect. I am no expert but from what I have read, I am lead to suspect that perhaps the winding of the vertices in the mesh might be causing normals that are somewhat incorrect. Could this be possible and if so, how does one correct for that?

The effect of interpolating the normals by either division or by area weight does not really make too much of a difference. I can also confirm that the normals that I am calculating are basically the same as those that come with the STL as calculated by FreeCAD. The manually calculated normals are slightly better though because they are area weighed. They are calculated as follows:

glm::vec3 e1 = vecs[1] - vecs[0];
glm::vec3 e2 = vecs[2] - vecs[0];
faceNorms[i] = glm::cross(e1, e2);

with "vecs" being the 3 points of my vertices. I then sum up all these area-weighed normals for each face that uses a normal and finally normalize that.

PS. FreeCAD renders the mesh in a "flat" fashion and I guess thereby avoids this issue but unfortunately rendering "flat" with GLES 2.0 is a bit of a performance waste from what I have read.

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:
How does one make both movement and animation to sync up and happen simultaneously? I am very new to Unity and game making and would appreciate if you would cope with me.

I have made a very basic prototype of character animation and movement, however trigger that is supposed to fire animation happens after character already moved. I just can't seem to find a way to fix it as SetTrigger is void and not a Task.

See this video for what I mean

The script I am using to fire off animation is the following:

public class Hero : MonoBehaviour {

    public Animator animator;
    public void Down()
    {
        var move = GameObject.Find("Hero").transform.position;
        animator.SetTrigger("moveDown");
        transform.position = Vector3.Lerp(move, move + new Vector3(0, -1f, 0), 1f);
    }
}

How does one make both movement and animation to sync up and happen simultaneously?

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:
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:
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:
How to move a car over an environment At the moment I'm writing a little OpenGL application. For now I have a car which can drive down a road. This works really good because I simply put the car on the street plane. Now let's say on the road is a little ramp and my car should be able to drive along that ramp. How can I do this? At the moment I only have translation along the z axis. Let me describe how I would do it:

Calculate angle between ramp and street normal
Rotate car by this angle and translate it

First of all: Is there an easier way to do it? My main problem from this idea is how should I get the normal from the triangle the car is interacting with? And of course I can not rotate the car the full angle at the beginning because then a part of the car is under the ground. So what is the usual way to do this?

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:
How do multipass shaders work in OpenGL? In Direct3D, multipass shaders are simple to use because you can literally define passes within a program.  In OpenGL, it seems a bit more complex because it is possible to give a shader program as many vertex, geometry, and fragment shaders as you want.

A popular example of a multipass shader is a toon shader.  One pass does the actual cel-shading effect and the other creates the outline.  If I have two vertex shaders, "cel.vert" and "outline.vert", and two fragment shaders, "cel.frag" and "outline.frag" (similar to the way you do it in HLSL), how can I combine them to create the full toon shader?

I don't want you saying that a geometry shader can be used for this because I just want to know the theory behind multipass GLSL shaders ;)

sentences:
Light point buggy on old device after migrating to URP Light point is very buggy on Samsung A5 after migrating to URP, it works well on PC and Samsung A7.
Altought it has light points, these are really few and using lowest settings by default, all other graphic stuff is lightweight and runs well.
Does someone know if it's expected or what can I do? I tried to reduce the lightning settings and add OpenGL-ES 2, but I've got the same results.

sentences:
How can I implement a real-time game loop in a text-based game? I am trying to make a short text game with c++ to help me learn the language. I have made a version that basically displays texts, waits for an input, once the input is received it displays text, and so on. What I want to do now is make it so that it doesn't wait for the input. Real-time if you will. So certain values keep changing while the player is sitting, and if he sits for  too long that game changes in a major way.

My problem is that I can't figure out how to incorporate this in a my game loop. I have a while loop that has a input function, an update function, and a display function. Is this just something I have to do with a wait function?

(I am just using Visual C++ and nothing else).

sentences:
How to implement curved movement while tracking the appropriate angle? I'm currently coding a 2D top-down car game which will be turn-based. And since it's turn-based, the cars won't be controlled directly (i.e. with a simple velocity vector that adjusts its angle when the player wants to turn), but instead it's movement path has to be planned beforehand, and then the car needs to follow the path when the turn ends (think Steambirds).

This question has some interesting information, but its focus is on homing-missile behaviour, which I kinda had figured out, but doesn't really apply to my case, I think, since I need to show a preview of the path when the player is planning his turn, then have the car follow that path. In that same question, there's an excellent answer by Andrew Russel which mentions Equations of Motion and Bézier's Curve. Some of his other suggestions of implementation are specific to XNA though, so they don't help much (I'm using Marmalade SDK).

If I assume Bézier's Curve as the solution of choice, I'm left with one specific problem: I'll have the car's position (the first endpoint) and the target/final position (the last endpoint), but what should I use as the control point (assuming a square/quadratic curve)?

And whether I use Bézier's Curve or another parametric equation, I'd still be left with another issue: the car can't just follow the curve, it must turn (i.e. adjust its angle) accordingly. So how can I figure out which way the car should be pointing to at any given point in the curve?

sentences:
Smooth Camera Rotation around 90 degrees I'm developing a third person 3D platformer in XNA. My problem is when I try to rotate the camera around the player.
I would like to rotate (and animate) the camera 90 degrees around the player. So the camera should rotate until it has reached 90 degrees from the starting position.
I cannot figure out how to keep track of the rotation, and when the rotation has made the full 90 degrees.

Currently my cameras update:

public void Update(Vector3 playerPosition) {
    if (rotateCamera) {
        position = Vector3.Transform(position - playerPosition, Matrix.CreateRotationY(0.1f)) + playerPosition;
    }
    this.viewMatrix = Matrix.CreateLookAt(position, playerPosition, Vector3.Up);
}

The initial position of the camera is set in the constructor.
The "rotateCamera" bool is set on keypress.

Thanks for the help in advance.

Cheers.

sentences:
Math to set tangential force? I have an 2-dimensional planet at coordinate (pX, pY) and an object at the surface of the planet at some coordinates (oX, oY). I want to have the object go left or right when the user press the keys, which I'd like to simulate by applying a force. I have a homemade physics engine built and all I'm missing is the x/y amounts to use to apply the force in a tangential direction.

What calculation is needed to apply a tangential force clockwise/counterclockwise on an object at (oX, oY) around a center of (pX, pY)?

sentences:
Godot: How to get mouse button input for a Tilemap for Cellular Automata Conway's Game of Life
I have been working with a tilemap for the implementation of a cellular automata game. My current method for getting mouse button input is using an Area2D as a child of the Tilemap and detecting mouse button input like that.
I have done this and have since been wondering if there is something built in that I can use for this. I have looked into it and cannot find anything better.
Is there something built-in to Node2Ds or Canvas Items that I can use.

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:
How do I efficiently deal with entities moving between chunks? I am working on a game in which entities need to be stored in chunks.

This is the basic chunk format:

public static Entity [row][column][entities] chunkEntities;

However, some of my entities move. How do I handle an entity switching chunks as a result of moving, and what is the most efficient way of doing so?

sentences:
Quaternion camera in 3D space with Pitch and Yaw I am having trouble implementing a quaternion camera that can fly freely in 3D space with only Pitch and Yaw rotations.

It works fine except when you look up or down and then try to look left or right (Yaw).
Then the camera gets a roll effect which is incorrect.

Here is how I handle Pitch and Yaw:

void Camera::rotate(const int& inPitch, const int& inYaw){

//Look Up and Down
if (inPitch != 0)
{
    quat qPitch = angleAxis((float)inPitch * 0.003f, vec3(-1.0f, 0.0f, 0.0f));
    mQuaternion = qPitch * mQuaternion;
}

//Look Left and Right
if (inYaw != 0)
{
    quat qYaw = angleAxis((float)inYaw * 0.003f, vec3(0.0f, 1.0f, 0.0f));
    mQuaternion = mQuaternion * qYaw;
}

mQuaternion = normalize(mQuaternion);
mat4 reversedView = inverse(mat4_cast(mQuaternion));
mLeft = normalize(vec3(reversedView * vec4(-1.0f, 0.0f, 0.0f, 0.0f)));
mUp = normalize(vec3(reversedView * vec4(0.0f, 1.0f, 0.0f, 0.0f)));
mDirection = normalize(vec3(reversedView * vec4(0.0f, 0.0f, -1.0f, 0.0f)));
}

And this is how I update my ViewMatrix:

void Camera::onUpdate(){
if (mIsMoving[move::MOVING] == true)
{
    ///Position is handeled with flags in each direction
    ///to enable moving in muliple directions at once

    if (mIsMoving[move::FORWAD])
        mPos += mDirection*mVelocity;

    if (mIsMoving[move::BACK])
        mPos -= mDirection*mVelocity;

    if (mIsMoving[move::LEFT])
        mPos += mLeft*mVelocity;

    if (mIsMoving[move::RIGHT])
        mPos -= mLeft*mVelocity;

    if (mIsMoving[move::UP])
        mPos += mUp*mVelocity;

    if (mIsMoving[move::DOWN])
        mPos -= mUp*mVelocity;

    ///Rotation
    mViewMatrix = mat4_cast(mQuaternion);
    ///Translation
    mViewMatrix = glm::translate(mViewMatrix, -mPos);
}
}

sentences:
How do I let the an object know where in a matrix it is? Game Engine: Gamemaker Studio

Situation: I want 6 rows of 6 objects, each housed in a cell of a 6x6 matrix. However, this presents the problem of the matrix knowing what's in the cell, but the object in the cell doesn't know where in the matrix it is.

Reason why this is a problem is because I want to have events in the housed object's events that check adjacency to other objects in the matrix.

Question: How do I let the an object know where in a matrix it is?

Do I just need to have 2 variables in the object, which is set to the object's position in the matrix, or is there an easier way to do this? Or a better way, I guess.

Or perhaps the question is, is there a better way than the way I am doing?

How I'm using it Right Now:

//check if the last link in the chain is adjacent to the target link

     //includes diagonals
     if(obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y-1)
     || obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y+1)
     || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x-1)
     || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x+1))
    {
        obj_Handle_Links.Match_Length +=1; //because we're increasing the length
        image_index = 1; //this should highlight
        //add to link - implement later
        obj_Handle_Links.Last_Link = id; //makes it so this is what's seen as last link
    }

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:
Spritefont in OpenGL I develop in OpenGL using C# as programming language.
I want to draw some text on the screen. For this i created a texture that contains all the characters.

Now i am not sure how to continue. I can draw now every character like this:

Gl.glBegin(Gl.GL_QUADS);
{
    Gl.glTexCoord2f(posX, posY);
    Gl.glVertex2f(-1, -1);

    Gl.glTexCoord2f(posX + size, posY);
    Gl.glVertex3f(1, -1);

    Gl.glTexCoord2f(posX + size, posY + size);
    Gl.glVertex3f(1, 1);

    Gl.glTexCoord2f(posX, posY + size);
    Gl.glVertex3f(-1, 1);
}
Gl.glEnd();

posX and posY contain the start position of the character in the character-texture. size is the size of the character in the texture.

This method needs a lot of draw calls. I mean i draw lots of quads but i only need one where i can put all the text on it. How can i improve my code?

sentences:
Is there a standard way to track 2D tile positions both locally and on screen? I'm building a 2D engine based on 32x32 tiles with OpenGL.  OpenGL draws from the top left, so Y coordinates go down the screen as they increase.  Obviously this is different than a standard graph where Y coordinates move up as they increase.

I'm having trouble determining how I want to track positions for both sprites and tile objects (objects that are collections of tiles).  My brain wants to set the world position as the bottom left of the object and track every object this way.  The problem with this is I would have to translate it to an on screen position on rendering.  The positive with this is I could easily visualize (especially in the case of objects made of multiple tiles) how something is structured and needs to be built.

Are there standard ways for doing this?  Should I just suck it up and get used to positions beginning in the top left?

Here are the OpenGL calls to start rendering:

// enable textures since we're going to use these for our sprites
glEnable(GL_TEXTURE_2D);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

// enable alpha blending
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

// disable the OpenGL depth test since we're rendering 2D graphics
glDisable(GL_DEPTH_TEST);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);

I assume I  need to change:

glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);

to:

glOrtho(0, WIDTH, 0, HEIGHT, 1, -1);

sentences:
Updating object position An object - a player or npc or whatever - has a position, direction and speed and such.

Before drawing each frame, we want to compute the current position of each object.

How do you do this?

If you take the elapsed time since last frame, you run the very real risk of the game running at the wrong speed if the frame-rate is very fast and the clock precision poor (as it often is on some platforms).

And how can you incorporate player controls such as the player wanting to go left or right (e.g. in a simple asteroids clone without ship inertia)?

sentences:
Dealing with angles in 3D In 2D everything is easier to understand. I'm not enought experienced to join people who say that 3d is the same: you JUST need to add a dimension - THAT adding a dimension is my problem, bacause I can't easily visualize (or draw on paper) the situation I'm dealing with. So please don't say it is the same.

First let's talk of a concrete situation.

Use case: bounding sphere intersection

I have two entities colliding with theirs bounding sphere intersecting at a certain point. Let's consider two vectors, the velocity of the first entity v1 and distance between boundingsphere centers d. If I want to get v1 component along d I may want to do

V1 * Math.Cos(alpha)

with alpha = Math.Atan2(...)

a. My questions come now. Math.Atan2(...) takes 2 arguments, the
    first is the difference between Xs and second is the difference
    between Ys of the two vectors involved. So, since I'm working in 3D
    and not in 2D, should I assume that common practice is to consider a
    pair of dimenstion at time when dealing with angles in 3D? Since I'm
    a bit confused here, can someone tell me what's the best practice to
    follow in this case? (details would be appreciated here).

b. Then I have some information I'd like someone to confirm. When my
    double angle value is returned from the Math.Atan2(...), I have my
    angle in radians. I read somewhere that this float value varies
    between +- Pi, reasonable. And also that Math.Atan2(...) always
    consider the lesser between the 2 angles, which is not important if
    you need to calculate Cos(angle) but you must keep it in mind if
    you wants to get the Sin(angle). Is this how things work?

sentences:
2D grid based placement (limited to 1 tile in each direction) in Unity I've been trying to get my head around this for hours now, I hope one of you is able to help.

I'm trying to make a small game (2D using sprites) that allows you to place blocks (tiles). That is pretty simple in itself, I use ScreenToWorldPoint and mouse position to place the block (no snapping to grid yet).

Now, what I need to do is ensure that the player places blocks on either side of the block that was just placed, and not just some random place on the screen.

A block is just a 1x1 sprite in this case.

For example. Player placed a single block on the screen:

            can place here
                  |
can place here - [#] - can place here
                  |
            can place here

Player then places another block next to the already placed block:

            can place here
                  |  |
can place here - [#][#] - can place here
                  |  |
            can place here

As you see, there is always room to place 1 block around each block placed (using the word block too much!). This is in 2D space.

So in the end, the player might make this:

                   can place here
                      |  |   |
can place here     - [#] |  [#] - can place here
can place here  - [#][#][#][#][#] - can place here

As you also see here, there is always room for 1 block to be placed around the already placed blocks - obviously not when there's already a block placed next to it.

Hope it makes sense.

I guess what I'm after is just: How would I go about creating a grid around a single game object (2D sprite) - I can then use Ray's to figure out if player has pressed one of the grids around it.

Thanks a lot!

EDIT:

So, I managed to get something working. I made a game object with 4 parents (1x1 sprites: top, right, left, bottom) - clicking on one of these parents, "replaces" (destroys) the object and inserts another tile with 4 parents.

This seems like a really bad implementation, so please suggest alternative ways of doing this.

Screenshot:

Code:

using UnityEngine;
using System.Collections;

public class GameManager : MonoBehaviour {

    public Transform boatObject;
    public GameObject tile;
    public GameObject boatPlank;

    private Vector2 mousePosition;

    void Start ()
    {
        Vector3 position = new Vector3 (boatObject.transform.position.x, boatObject.transform.position.y, 0);
        GameObject gridTile = Instantiate (tile, position, Quaternion.identity) as GameObject;
        gridTile.transform.SetParent (boatObject.transform);
    }

    void Update ()
    {
        // Mouse button 1
        if (Input.GetMouseButton (0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction);

            if (hit.collider.gameObject.tag == "GridItem")
            {
                Vector3 position = new Vector3 (hit.collider.transform.position.x, hit.collider.transform.position.y, 0);

                GameObject gridTile = Instantiate (tile, position, Quaternion.identity) as GameObject;
                gridTile.GetComponent<SpriteRenderer> ().sortingOrder = 10;
                gridTile.transform.SetParent (boatObject.transform);

                // Destroy the grid item that was clicked
                Destroy (hit.collider.gameObject);

                Debug.Log ("Hit something: " + hit.collider.gameObject.tag);
            }
        }
    }
}

sentences:
how can I visually compensate for latency in a diep.io style game implementing extrapolation using linear velocity, orientation and position like on here gafferongames.com/post/state_synchronization/ I'm a little confused if I want to extrapolate from a known position, velocity and orientation forward 8 tick ahead for example, how could I do that, any simple example?

I'm using p2.js physic engine.

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:
Control animation using animator control class I did a sample existing code to control animation using animation.I dragged and dropped a character into the scene then I added a Animator to it and added the animator controller.Below I have given the screen short of the animation

Then I have attached the following code to it

Animator animator;

int eatHash=Animator.StringToHash("ideal");

int stateHash=Animator.StringToHash("Base Layer.pickbothfork");

void Start () {
    animator = GetComponent<Animator>();
}

// Update is called once per frame
void Update () {
    //animator.SetBool ("isEat", true);
    float move = Input.GetAxis ("Vertical");
    animator.SetFloat ("Speed",move);

    AnimatorStateInfo stateinfo = animator.GetCurrentAnimatorStateInfo (0);
    if (Input.GetKeyDown(KeyCode.Space))
    {
        Debug.Log ("clicked spacebar");
        animator.SetTrigger(eatHash);
    }
}

The problem here is the above code is working,when I run the project the animation is getting played one after the another according to the state diagram.But when I click on the space bar the trigger function(jump animation ) is not working

if (Input.GetKeyDown(KeyCode.Space))
{
    Debug.Log ("clicked spacebar");
    animator.SetTrigger(eatHash);
}

Can anybody please help me finding solution for it

sentences:
Can copying assets be legal if I'm not intending to make money? I very recently started going through game development tutorials and I was thinking of trying to mimic a game I know as closely as possibly just to see if I can do it as a first project.

I wouldn't at all be wanting to sell this game but would I be able to show this in some kind of online portfolio so long as I mention that none of the assets are mine and give credits to the relevant companies/people?

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 setup a Visual Studio 2015 Android C++ project to use SFML and targets an Android device? In Visual Studio I have installed the cross platform tools to set up a C++ project for Android and iOS such as the Android SDK, NDK and the corresponding USB drivers required to debug the program on a connected android device as well as varying sdk levels allowing for compilation on devices from different periods in time. My first question is: using the default C++ application template in visual studio for android:

How would I go about rendering an sfml window to the screen of the device I am debugging on within the project’s main function code?:

void android_main(struct android_app* state) {
struct engine engine;

memset(&engine, 0, sizeof(engine));
state->userData = &engine;
state->onAppCmd = engine_handle_cmd;
state->onInputEvent = engine_handle_input;
engine.app = state;

// Prepare to monitor accelerometer
engine.sensorManager = ASensorManager_getInstance();
engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
    ASENSOR_TYPE_ACCELEROMETER);
engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager,
    state->looper, LOOPER_ID_USER, NULL, NULL);

if (state->savedState != NULL) {
    // We are starting with a previous saved state; restore from it.
    engine.state = *(struct saved_state*)state->savedState;
}

engine.animating = 1;

// loop waiting for stuff to do.

while (1) {
    // Read all pending events.
    int ident;
    int events;
    struct android_poll_source* source;

    // If not animating, we will block forever waiting for events.
    // If animating, we loop until all events are read, then continue
    // to draw the next frame of animation.
    while ((ident = ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,
        (void**)&source)) >= 0) {

        // Process this event.
        if (source != NULL) {
            source->process(state, source);
        }

        // If a sensor has data, process it now.
        if (ident == LOOPER_ID_USER) {
            if (engine.accelerometerSensor != NULL) {
                ASensorEvent event;
                while (ASensorEventQueue_getEvents(engine.sensorEventQueue,
                    &event, 1) > 0) {
                    LOGI("accelerometer: x=%f y=%f z=%f",
                        event.acceleration.x, event.acceleration.y,
                        event.acceleration.z);
                }
            }
        }

        // Check if we are exiting.
        if (state->destroyRequested != 0) {
            engine_term_display(&engine);
            return;
        }
    }

    if (engine.animating) {
        // Done with events; draw next animation frame.
        engine.state.angle += .01f;
        if (engine.state.angle > 1) {
            engine.state.angle = 0;
        }

        // Drawing is throttled to the screen update rate, so there
        // is no need to do timing here.
        engine_draw_frame(&engine);
    }
}

sentences:
XNA - Prevent Holding of Mouse Button as Part of an Input Handler Game Component I'm using C# XNA 4.0 Refresh.

I'm working to create an InputHandler Game Component for my XNA game to handle all of the keyboard and mouse input.

I used SixOfElevens RPG Game Tutorial (Here - http://xnagpa.net/xna4/rpgtutorials/xna4rpgtutorial1.pdf) to create the InputHandler.

Currently, as shown in the guide it can handle keyboard input and has methods for performing an action when a key is down, pressed, or released.

I added mouse input into this InputHandler so that it gets the current and previous state of the mouse.

My problem though is that I can't figure out how to make working methods to perform actions when a mouse button is down, released, or pressed.

For example:  With the keyboard input here is the section that handles performing and action when a key is released after being pushed.

public static bool KeyReleased(Keys key)
    {
        return keyboardState.IsKeyUp(key) &&
            lastKeyboardState.IsKeyDown(key);
    }

I've tried every way I could think of or find to get a similar thing working with the mouse.

I've seen this posting ( http://www.techpowerup.com/forums/threads/sample-code-c-xna-mouse-control-tip.57633/ ) and while it checking the button presses its doing it right at the moment when the action is to be performed.  I need a way to pass it through the InputHandler and return it like the keyboard example shown above.  Otherwise I'll be stuck having my keyboard input handled neatly and my mouse inputs handled messily all over the place.

Anyone out there know of a way to implement this like I need?

sentences:
Unity 2D Hingejoints break under extreme force I have added a rope to my game that is made up of multiple small gameobjects, each connected to eachother by a HingeJoint2D. Since 1 unit of mass in Unity is supposed to represent 1 kg, I've made the player's mass 60 (60kg). When the mass of each rope segment (of which there are 40) is 20, the rope supports the player when they jump off a cliff.

Now 20 kg per rope segment sounds ludicrous. However when I make each rope segment weigh 1 (1kg) the hingejoints break completely and jitter around crazily. The force of the 60kg player against the 1kg segments seems to be too much.

I would much rather have the rope be lighter, so it doesn't move the player when throwing and being dragged as much. Any suggestions on how to fix HingeJoint2D's and make them act, as you know, a joint should?
EDIT: Increasing the Position and Velocity Iterations in File->Project->Physics2D menu from the default 3 and 9 respectively, up to a whopping 40 fixes this problem. This is a massive increase. Unsure if performance will suffer too much with these new settings.

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:
Why doesn't SDL2 recognize a game controller button press? SDL2 recognizes my PS4 controller but not the button presses. Here is a minimal code example.

#include <SDL2/SDL.h>
#include <stdio.h>

int main(int argc, char** argv) {
  if (SDL_Init(SDL_INIT_VIDEO) != 0 ) {
    printf("Unable to initialize SDL (%s)\n",SDL_GetError());
    printf("Exit\n");
    return -1;
  }

  SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);

  SDL_GameController *gameController = NULL;
  int numJoysticks;
  numJoysticks = SDL_NumJoysticks();
  printf("%d joysticks found\n", numJoysticks);

  if( numJoysticks <= 0 ) {
    return -1;
  }

  if( ! SDL_IsGameController(0) ) {
    printf("Error: joystick 0 is not a game controller\n");
    printf("Exit\n");
    SDL_Quit();
    return -1;
  }

  gameController = SDL_GameControllerOpen(0);

  if( ! gameController ) {
    printf("No game controller found\n");
    printf("Exit\n");
    SDL_Quit();
  }

  printf("Opened Game Controller 0\n");
  printf("Found a valid controller, named: %s\n", SDL_GameControllerName(gameController));

  if( SDL_GameControllerGetButton(gameController, SDL_CONTROLLER_BUTTON_A) ) {
    printf("Button press!\n"); // Never printed
  }

  // Exit
  SDL_GameControllerClose(gameController);
  SDL_Quit();
  return 0;
}

Here is the output I get:

1 joysticks found
Opened Game Controller 0
Found a valid controller, named: PS4 Controller

What am I doing wrong?

sentences: What are some good methods of implementing RTS-style Box selection? I'm scouting around for different methods of implementing a typical RTS box selection. This is for 3D game - so I'm looking for methods for finding units within selection box in 3D world. Here is a quick screenshot of what a box selection looks like in 2D Starcraft:

sentences:
What other components would one have to combine with Ogre 3D render engine to make a full fledged custom game engine? I have heard that Ogre 3D is not actually a game engine, rather it is a 3D render engine. I have also heard people claim that one can piece it together with other components (engines?) to create a full featured game engine. So my question is:

What are the other types of
components/engines one would have to
add to Ogre 3D to create a game
engine?
Also, what are the most popular and
powerful examples of these other
components/engines?

sentences:
How can I make a tile appear on top of another without completely blocking the tile below? Making a small RPG with libdgx just for learning about how to draw tiled maps and move around in them.  I've got the tiles drawn and OrthographicCamera stuff figured out so I can see my world.  My question is, how can I put character on a tile, so that he appears to be standing on the tile?

My idea is to give each tile a separate texture that has the character drawn on the tile.  So for example, I would have grass.png and then I would have grass-hero.png.  And then based on where the hero is upon the next render loop, if the hero has moved to a tile that was previously "grass", instead this time draw "grass-hero".

Example:

Now, I haven't done it yet, but I'm pretty sure that would work.  My question is, is there some way that I can bypass having to use a separate "combined" tile like grass-hero, and just have my hero walk on top of the grass tile?  I imagine if I use another tool like .NET Paint I could "cut" the hero out of the black background and make the background transparent, but I still don't know how to make one tile appear on top of another.

To provide some abbreviated semi psuedo code, let me show what I have:

GameScreen (implements Screen)

@Override
public void render(float delta)
{
    worldrenderer.render();
}

WorldRenderer

public void render()
{
    spriteBatch.begin();
    drawTiles();
    drawHero();
    spriteBatch.end();
}

private void drawTiles()
{
    for (Tile tile : world.getTiles())
    {
        switch(tile.getTileType())
        {
             case GRASS:
                 spriteBatch.draw(grassTexture, tile.getPosition());
                 break;
             case FOREST:
                 spriteBatch.draw(forestTexture, tile.getPosition());
                 break;
             case STONE:
                 spriteBatch.draw(stoneTexture, tile.getPosition());
                 break;
        }
    }
}

private void drawHero()
{
    Hero hero = world.getHero();
    spriteBatch.draw(heroTexture, hero.getPosition());
}

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 10 - dimension of vertices passed to vertex shader I'm trying to learn DirectX programming.
Looking at different tutorials there is something about vertices that I find a bit confusing.

I know that DirectX uses vertices with four elements (x, y, z, w).
I saw many tutorials (example http://msdn.microsoft.com/en-us/library/ff729721(v=VS.85).aspx) passing XMFLOAT3 as vertices positions omitting the w component.

How does this works?
Assuming that passing XMFLOAT3 or XMFLOAT4 doesn't change DirectX behavior (true?) should I set the w to 1 in the vertex shader or does DirectX assume it to be 1 by default?

sentences:
How to make some monsters appear more dangerous than others? My game is an open-world co-op MMO with retro graphics, permadeath and no leveling system.

The problem I'm facing, is the fact that I don't know how to make some monsters appear harder than others. Since nothing has a level, and characters can only get stronger by acquiring better items, it's difficult for me to "warn" players that a monster is difficult for them.

Fortunately, the whole world is designed by hand and we know which areas should be more difficult than others. So this means, I as developer knows which monsters are stronger than others.

But new players won't! I don't want them to get frustrated by walking into the wrong monsters reserved for higher players.

So then, how can I make monsters appear more dangerous than others?

Some things I thought of:

increasing the size of the monsters: This could work but it's not a valid rule for everything. For instance, the end-boss has small minions which are also powerful.
use of particles: I remember from playing WoW some monsters who were stronger excessively used particles to make them appear more powerful:

dividing the world into danger levels: Here I would add a danger level or something to the HUD that displays whether the player is in a safe zone or somewhere dangerous. It would change and display a notice whenever the player moves to a different danger level. Do-able although I have no clue how to portray it on the HUD.

sentences:
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:
Pathfinding towards a moving target in 2D Platformer I have an enemy in my 2D platformer that chases the player around the level.

I implemented a modified version of A* that works with gravity as described here: https://gamedevelopment.tutsplus.com/tutorials/how-to-adapt-a-pathfinding-to-a-2d-grid-based-platformer-theory--cms-24662

But for a moving target I would have to calculate a new path whenever the target moves. Of course I'm going to run the pathfinding on a separate thread and only once a second or something like that, but it's still a waste to calculate the path from scratch.

So I found this algorithm for transforming the old path to the new path with the new start and target position called FRA* http://idm-lab.org/bib/abstracts/papers/ijcai09b.pdf

However the platformer version of A* has a kind of 3D grid where nodes with different jump values in the same 2D location has a different z-coordinate.

Is it possible to use FRA* when jump values comes into play? Do I have to recalculate jump values?

sentences:
Why are my canvas drawings larger than the actual image? For the following page source, I've finally gotten a grip on rendering the cards.  I'm puzzled why they appear about 2.5x larger on the canvas.

<html>
  <head>
    <style>
      canvas#game-canvas {
        position: absolute;
        top: 5%;
        left: 5%;
        background: lightblue;
        height: 281px;
        width: 500px;
      }
      body {
        background: darkblue;
      }
    </style>
    <script type="text/javascript" src="jquery1_10_2_min.js"></script>
    <script>
    // $(document).ready(function() {
      window.onload = function() {
      var canvas = document.getElementById("game-canvas");
      var context = canvas.getContext("2d");

      var cards = cardsheet('small_playing_cards.png', 50, 68);
      context.drawImage(cards[0], 10, 10);
      context.drawImage(cards[1], 50, 50);

      function cardsheet(path, frameWidth, frameHeight) {

         this.image = new Image();
         this.frameHeight = frameHeight;
         this.frameWidth = frameWidth;
         this.image.src = path;

         var card_sprites_canvas = [];
         var card_sprites_context = [];
         var card_names = [
         '1d', '2d', '3d', '4d', '5d', '6d', '7d', '8d', '9d', '10d', 'Jd', 'Qd', 'Kd',
         '1h', '2h', '3h', '4h', '5h', '6h', '7h', '8h', '9h', '10h', 'Jh', 'Qh', 'Kh',
         '1s', '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', '10s', 'Js', 'Qs', 'Ks',
         '1c', '2c', '3c', '4c', '5c', '6c', '7c', '8c', '9c', '10c', 'Jc', 'Qc', 'Kc'];

            framesPerRow = Math.floor(this.image.width / frameWidth);
            framesPerCol = Math.floor(this.image.height / frameHeight);
            k = 0;

            for (i = 0; i < framesPerRow; i++) {
              card_sprites_canvas[k] = document.createElement('canvas');
              card_sprites_canvas[k].width = frameWidth;
              card_sprites_canvas[k].height = frameHeight;
              card_sprites_context[k] = card_sprites_canvas[k].getContext('2d');
              card_sprites_context[k].drawImage(this.image, frameWidth * k, frameHeight * 0, frameWidth, frameHeight, 0, 0, frameWidth, frameHeight);
              k++;
            }

        return card_sprites_canvas;
      }
    };

    </script>

  </head>
  <body>
    <canvas id="game-canvas"></canvas>
    <img src="small_playing_cards.png">
  </body>
</html>

sentences:
Why are my animated objects (from Blender) always playing at the global origin in Unity? I created and animated a sledgehammer in Blender 2.67b using an armature. The sledgehammer has one animation (created using the Action Editor) called "Idle". I parented the imported sledgehammer to an empty GameObject and set the sledgehammer's position to (0, 0, 0). I then moved the parent GameObject to where I want it in the scene. When I launch the game, the animation plays but the sledgehammer child always re-positions itself to be at the global origin, no matter where I place the parent GameObject. See the image below:

Notice how the sledgehammer's position goes from (0, 0, 0) to (-1087, -3, -1149).

The armature has a single bone and has the sledgehammer object as a child. I've spent about 4 hours looking this up on the Internet, but it seems like parenting the animated mesh to an empty GameObject worked for everyone else except me. Anyone else experience this? I've tried both .fbx and .blend files.

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:
How can someone make 3D tiles not looking like perfect cubes? Here are the graphics an artist did for me:

While the texture is nice when seen as image file, I think the tile is somewhat flat.

The problem is:

If he bevel the cube, then there will be tiling problems (not to mention seams between cubes). How can he make tile looks less flat?

If he make the 3D model to act like 2D isometric Tiles (which have very irregular outline) there will be so much polygons that will be a nightmare for him to model dozen of Tiles.

Of course keep in mind that for occluding reasons (each cube project 6 planes that are used to occlude hidden geometry) the overall shape should be actually bigger than a cube volume, but not smaller (anyway I can loose the height requirement, cubes can be made of any height).

sentences:
Detecting collision between browser window middle point and other sprites visible in the window In HTML5 canvas, I have an object which is always in the middle point. On the big map there are other moving objects. I want to detect if the middle point of the window hit any shape we see on the window. I wonder if there is a way to only detect collision between the middle point and the shapes that are visible in the window so I don't have to iterate through all shapes on the map (could be many thousands of shapes).

Is there a good solution to this kind of collision detection? Assume that I have already known how to write the collision detection code for the middle point and shapes.

sentences:
How do I program a fan in a platformer game? Fan physics

I have a platformer game and want to have fans in it that blow in a given direction and if the player presses the jump button they can go even further.

How do I do this?

side note:

I am working with godot engine

EDIT

My character moves on the two axes using two variables, both multiplied by speed: move_dir and y_velo. gravity affects y_velo and the arrow keys affect move_dir

sentences:
What is the point of a borderless fullscreen window? Quite a lot of game allow user to play in a "borderless fullscreen window" instead of a "fullscreen mode". I've been wondering. Why would one prefer a fullscreen window over the "built-in" fullscreen mode?

Simple test of my own showed me, that using fullscreen mode instead yields better performance. I also tried to search on Google and on SO, but most answers are gaming related or on how to actually create those windows in API X,Y or Z.

So what is the point of having a borderless fullscreen window? Are there any technical reasons?

sentences:
Queued rendering in LibGDX 2D In my 2D game project, as well as in LibGDX in general, are a lot of different entities that need to be rendered(static images, sprites, animations, etc...), as well as have certain effects applied (shaders). Most, if not all, tutorials show a simple hardcoded way of rendering each sprite instance, or at the most, a loop iterating over one type of renderable entity and rendering it.

I have a need to render a decent number of entities (~1000 static(background/tilesets) and dynamic(characters) per screen) where certain entities might have one or even multiple shaders applied to them. I'll also probably have to deal with rendering to FBO's to be able to apply multiple shaders on entities, though I haven't yet reached that point so I'm not sure yet (so far my entities have either 0 or 1 shader, but I'm planning on placing multiple shaders per entity soon so I need to take that into account).

I don't know what rendering techniques would allow me to accomplish this task however I've got some ideas I'm stuck with.

For more context I'm also using an ECS but I'm not coupling rendering to it.

My current idea is to have a RenderingEngine of sorts, decoupled from ECS. It would basically contain a queue of... something, some message POJO describing what and where to render. This queue would then, each render cycle, be sorted according to layer, type, shader and then be distributed to their own appropriate renderer.

The gist is that other game systems send a message to the RenderingEngine describing what they want rendered and then the engine works out what to do with it the next rendering cycle.

Current issues I've got with this idea:

Messages might prove to be a performance overhead as they are plain objects created for the sole purpose of sending a message over. This could probably be alleviated via pooling.
Shaders. Without shaders rendering logic is fairly simple [sort by layer -> for each layer sort by type -> render]. Shaders however are applied per batch and that confuses me. I am not sure where in the above rendering logic would shaders fit in...

Am I reinventing the wheel? Is there a standard technique of accomplishing this kind of "flexible" rendering?

Is the queueing idea I've described above a part of some well known technique I could investigate for clues?(My searches have given me no anwsers so far)

sentences:
How to fix pink tiles when there is a problem with the Shader? Because of some dumb mistake I did fifth time, I had to repaint my level in my 2D game.
The problem is that the tiles I use from the Tile Palette turn into pink because of some shader error. I came to this conclusion after a long time of browsing through the forums.

I am 100% sure that this will happen again, because I don't know what causes this behavior. So, prevention is not an option for me.
What is the solution?

By @DMGregory's suggestion, I was able to recreate this dumb behavior of mine in an empty project.
What I do is dragging and dropping a tileset onto a tile palette which I am using, and then overwriting the current tile palette. Then, the former assets are lost (I guess?) leaving me with pink tiles.

Attached picture is one of my levels created using Tile Palette. How do I take this back? I don't want to repaint my level everytime I do whatever that causes this behavior.

sentences:
Best way to do discontinuous animation? Or: Best way to animate a character with a jerky center of mass? I am using Unity and need to know how to use it animation system properly for… well let me describe it below.

In this game I have this big 3D block-like character that moves in an unusual fashion compared to most game characters. In most games, the character moves along a straight line at a constant rate. However this character, and other characters in the game, does not move in a continuous fashion. Instead it is discontinuous and choppy in unique ways.

For example, here is how I want a big block character to move:

Basically the two corners in front of him are pivot points, and the character moves forward by alternating between these two points and rotating. How can I do this with Unity's animation system? For the most part the animations in Unity don't move the character but instead have an animation play, such as the "Run" animation, and then a script actually moves the character. Know I the animator has a “use root movement” or something that does exactly this, but I have heard that it can causes problems. I’ve been considering just programming all of the animations, since they are relatively simple. However that makes fine tuning them a nuisance, and have some animations programmed and others not is probably not a good practice. I kind of also fear that if I don’t end up programming it I will have troubles with detecting if a character can walk through a certain walkway, considering for example the above animation his “walk width” is greater than his actual width since he rotates side to side.

Also keep in mind that there are other animations that are discontinuous like this but work in different ways. For example, another block that hops but pauses between hops. Another might rock backwards and then slide forward on the forward rocking animation.

So I know there are multiple ways to tackle this, but my question is what is the best way to do this? How would you do it?

sentences: How can I update vSync settings after creating an SDL_Renderer? I have an SDL_Renderer which I set to use or not use vSync depending on the user). In my options menu I have an option for enabling/disabling vSync. Can I edit my renderer to update the vSync preferences so that I don't have to destroy and recreate it? Doing so would invalidate a lot of renderer pointers in my game, so I would like to find an alternative solution.

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:
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:
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: Can packet latency fluctuate? Can the time it takes for a packet to be transmitted from a client to the server fluctuate?

sentences:
place sprites in grid pattern within an area I have been trying to do this for a few hours in unity now but cant get my head around it. basically i have 4 points(vector3) 1 each for the 4 corners topleft, topright, bottomleft, bottomright. now i have a sprite that i use as a block what i want to do is basically fit X number of blocks within the four points. see the image below. Icant think of a way to do this right now.
I would really appreciate any help in how to achieve this. thanks for helping.

sentences:
Too Low Amount of Tris in Statistics Window, Only in the Tens (Unity) I'm working on a mobile game, and for optimization it would be useful to see the correct amount of polygons rendered.
However in the Statistics window the amount of polygons displayed are suspiciously low, only 62. Getting the poly count this low would be quite an achievement.
I'm using the Universal Rendering Pipeline.
Would there be a way to fix this?

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:
Detect collision that happen between frames, between slices of moving, rotating circles? To detect a collision between two circles, we check if the distance between their centers is smaller than the sum of their radii.

To detect a collision between a slice (in this case half) of a circle and a circle:

Check if the circles are in collision.
Find the two points of the imaginary segment that splits the circle (in the middle).
Check if either of these two points is contained inside the other circle (if so, it is colliding with both slices, red & blue).
If not, compute the angle between the two circles and use that to decide if the circles are touching from one side or the other.

Is there any reasonable way to compute this on moving objects? i.e, so collisions will not be missed because of the discrete nature of frames?

sentences:
SpriteBatch.Draw with scale or rotation trigger a new batch? I recently read that any transformation changes will cause a new batch to be triggered.

So, if I have 10 Sprites and each has a different rotation or scale will there be 10 batches sent up?

Or is this somehow limited to SpriteBatch.Begin, where a Matrix is used?

I'm not clear on how the Begin/End relate to scale/rotation in draw calls or if they do at all in terms of how many batches are created.

I appreciate any info on this topic...

sentences:
Tiled object layer draw sprites I added some tiles to some object layers in my tiled map and now I want to draw them in game.
I tried to render everything with

mapRender.render();

but the tiles doesn't show up.
Then I tried to render just one object layer and all of its objects with

mapRenderer.renderObjects(tiledMap.getLayers().get(0));

but it wasn't working.

Ingame:

Tiled:

Could someone please tell me how to make the tiles show up?
Thank you very much!

sentences:
How to keep a round body rotating without rotating it's center I want to make a game in Unity in which the Player is a sad star.  I want to have the points (The "arms and legs and head") of the star to rotate like a circle but to keep it's face (which is in it's center) still.  How can I do that ?

The body should rotate and it's center should stay still. Many thanks in advance!

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:
Microphone channel not detected in Unity This is very specific to Unity.

A few testers are reporting that their microphone output isn't being detected. The code below works for the vast majority of users, but certain microphones seem to be outputting on the wrong channel (R maybe)?

 AudioClip current_microphone_recording_clip = Microphone.Start(microphone_name, true, 30, 16000);

How can I capture and analyze output from several channels? I don't see any channels parameter for Microphone.Start

sentences:
Does it makes sense to apply perspective projection, in a 2D game? Does it makes sense to apply perspective projection, in a 2D game? What will be the cost for doing so, and does it overweigh the benefits gained from the 3rd dimension?

Perspective projection has features that could be used in 2D games. Two very beneficial characteristics that come to my mind are:

Using perspective projection as a substitute for parallax scrolling.
Using perspective projection to perform depth order for 2D sprites

On the other hand, perspective projection resizes objects with distance, including 2D sprites. That is why mip mapping has been developed. Mip mapping, however, does not always produce perfect results, as it relies on interpolation between two neighboring mip-mapped frames. This might not be sufficient, for a 2D game, where developers require pixel-based precision and detail.

sentences:
What does the term "channel" mean when used in regards to computer graphics? I was studying terminology for computer graphics, and this statement came up that confused me.

  The image can have alpha channels for transparency.

I tried searching for the meaning of the term "alpha channel," but I got really confused by the definition which used another concept called a "channel." I'm not really sure what this means, so could someone be kind enough to please explain this term to me?

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:
Cocos2d patterns for simple texture management I'd like to simplify the way I preload image resources in my Cocos2d based iOS apps. I've created a small object the just wraps a few of CCTextureCache's methods. It looks like this:

@interface TextureHelper : NSObject
+ (void) preloadTextures;
+ (CCTexture2D *) textureForImageNamed:(NSString *) imageName;
@end

@implementation TextureHelper
+ (CCTexture2D *) textureForImageNamed:(NSString *) imageName {
    return [[CCTextureCache sharedTextureCache] textureForKey:imageName];
}

+ (void) preloadTextures {
    // or could read from a directory...
    NSArray *imageNames = @[
    @"myImage1.png",
    @"myImage2.png"
    ];

    for (NSString *imageName in imageNames)
        [[CCTextureCache sharedTextureCache] addImage:imageName];
}
@end

The goal is to preload all images at start-up. Then during game play any sprites created on the fly won't cause images to be read from disk. What are some other  more common and/or more effective patterns for achieving 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 can I generate random lakes and rivers in my game? I have a 2D block building game and am trying to make randomly generated lakes and rivers. I have looked into the Perlin noise algorithm, but, I couldn't get it to generate random and nice results.

I have been trying to use the python noise library, but, it didn't create maps very randomly.

Is there some seed function I am missing on that library to make it more random? What variable do I change if I want it to go more random? If possible, give me a less technical answer, with less math and more python terms.

The map is a 2D tiled map. Here is some examples of the non-randomness of the other algorithm. The following code was outputted 3 times in a row. I was randomizing the octaves and frequency with something like this: freq = 16.0 * random.randint(1, 500000) * 0.000001 + 0.5

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 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 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 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 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 0 0 0 0 1 1 1 1 1 1 1 1 1 1 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 0 0 0 0 0 1 1 1 1 1 1 1 1 1 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 0 0 0 0 0 0 1 1 1 1 1 1 1 1 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 0 0 0 0 0 0 1 1 1 1 1 1 1 1 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 0 0 0 0 0 0 1 1 1 1 1 1 1 1 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 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 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 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 1 1 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 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 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 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 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 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 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1
1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1
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 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

This is the code that produced the output above:

"""Writes a 256x256 grayscale simplex noise texture file in pgm format
(see http://netpbm.sourceforge.net/doc/pgm.html)
"""
# $Id: 2dtexture.py 21 2008-05-21 07:52:29Z casey.duncan $

import sys
from noise import pnoise2
import random
octaves = random.randint(1, 500000) * 0.000001 + 0.5
freq = 16.0 * octaves
for y in range(30):
    for x in range(40):
        n = int(pnoise2(x/freq, y / freq, 1)*10+3)
        if n>=1:
            n=1
        else:
            n=0
        print n,
    print

sentences:
How can I represent collision for an object needing more than PolygonShape's maximum of 8 vertices? This is a part of map (it is a cave) of my LibGDX game (using Box2D):

I would implement a PolygonShape as the black part of the map to prevent the whatever moves (for example a ball) inside the cave from leaving it.

This is an example of my PolygonShape like I would draw it (with 100 vertices):

The problem is that Box2D doesn't allow me create it with not more than 8 vertices...

How can I fix this thing?

Sorry, my English isn't very good. :)

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:
Should I use an arraylist to store client connections I am running a server, and I have an arraylist of clients.

When a client connects, I create a new object in the arraylist(all running on their own threads)

When a client disconnects, the server closes the Socket. And the thread terminates

My problem is when a client disconnects, it closes the Socket, but it doesn't delete its spot in the arraylist, and shift everything down one. So the arraylist is constantly growing bigger.

What can I do/use to fix this problem?

I will update with more detailed information/code if need be.

sentences:
How to make natural-looking paths with A* on a grid? I've been reading this:
http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html

But there are some things I don't understand, for example the article says to use something like this for pathfinding with diagonal movement:

function heuristic(node) =
    dx = abs(node.x - goal.x)
    dy = abs(node.y - goal.y)
    return D * max(dx, dy)

I don't know how do set D to get a natural looking path like in the article, I set D to the lowest cost between adjacent squares like it said, and I don't know what they meant by the stuff about the heuristic should be 4*D, that does not seem to change any thing.

This is my heuristic function and move function:

def heuristic(self, node, goal):
    D = 5
    dx = abs(node.x - goal.x)
    dy = abs(node.y - goal.y)
    return D * max(dx, dy)

def move_cost(self, current, node):
   cross = abs(current.x - node.x) == 1 and abs(current.y - node.y) == 1
   return 7 if cross else 5

Result:

The smooth sailing path we want to happen:

The rest of my code: http://pastebin.com/TL2cEkeX

Update

This is the best solution I have found so far:

def heuristic(node, start, goal):
    dx1 = node.x - goal.x
    dy1 = node.y - goal.y
    dx2 = start.x - goal.x
    dy2 = start.y - goal.y
    cross = abs(dx1*dy2 - dx2*dy1)

    dx3 = abs(dx1)
    dy3 = abs(dy1)

    return 5 + (cross*0.01) * (dx3+dy3) + (sqrt(2)-2) * min(dx3, dy3)

def move_cost(current, node):
    cross = abs(current.x - node.x) == 1 and abs(current.y - node.y) == 1
    return 7 if cross else 5

It produces the desired path from the second pic, but does not handle obstacles very well (tends to crawl on walls) and fails to produce optimal paths sometimes on longer distances.

What are some tweaks and optimizations I can apply to improve it?

sentences:
What is the primary use of Vertex Buffer Objects? From what I've read, it seems VBOs are purely for performance.

I'm working on a very rudimentary learning project in lwjgl and I'm just trying to figure out what more advanced features of the library I should be delving into, and what their use is.

My understanding is that VBOs allow a person to keep vertexes in VRAM while they aren't currently being drawn in a scene. In my case, I'm just drawing quads and performance probably isn't a concern at all, but I'm trying to piece together what's happening under the hood. If I'm drawing quads directly, I'm drawing from the CPU memory, correct? Also, if I'm not doing any checks for visibility, does that mean I'm rendering absolutely everything in the "scene", regardless of whether its in view? Are VBOs a way to store objects and only render what's needed?

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:
Soft-restart tampers with physics determinism, resulting in different results Updated question
I have a Spawner entity that spawns my Rollables:
// Spawner.cs
public abstract class Spawner : MonoBehaviour
{
    public abstract T Spawn<T>(T prefab) where T : Component;
}

// PositionSpawner.cs
public abstract class PositionSpawner : Spawner
{
    public override T Spawn<T>(T entity)
    {
        T spawnedEntity = Instantiate(entity);
        spawnedEntity.transform.position = transform.position;
        spawnedEntity.transform.rotation = transform.rotation;

        return spawnedEntity;
    }
}

// RollableSpawner.cs
public sealed class RollableSpawner : PositionSpawner
{
    public Rollable Spawn(Rollable entity)
    {
        Rollable rollable = base.Spawn<Rollable>(entity);

        Restore(rollable);

        return rollable;
    }

    public void Restore(Rollable entity)
    {
        Quaternion r = transform.rotation;
        Vector3 p = transform.position + transform.up * (entity.Radius + 0.05f);

        entity.transform.rotation = r;
        entity.transform.position = p;

        entity.Rigidbody.rotation = r;
        entity.Rigidbody.position = p;

        entity.Restore();
    }
}

The Rollable though, is quite a big one and somewhat coupled with RollableCollider - found, fully, here.
The Restore method:
public void Restore()
{
    rigidbody.velocity = Vector3.zero;
    rigidbody.angularVelocity = Vector3.zero;
    rigidbody.Sleep();

    inAir = Drowning = false;

    Speed = 0f;
    Altitude = 0f;
    UnShift();

    UpdateDirectionality();
    UpdateOrientedTransform();

    ClearGateEventRegistry(gateEntryEvents);
    ClearGateEventRegistry(gateExitEvents);
    ResetSoakedParts();

    StopCoroutine(sleepingRoutine);
    StopCoroutine(gateRoutine);

    rigidbody.WakeUp();

    UpdateInAir();

    sleepingRoutine = StartCoroutine(SleepingRoutine());
    gateRoutine = StartCoroutine(GateRoutine());

    previouslyBackwards = false; Backwards = false;
}

And, to reset, I am calling RollableSpawner.Restore() with a push of a button.
The problem here is that even if after reset all of the values are as expected - position/rotation are correct, velocities and everything else - the Rollable still ends up taking a slightly different trajectory each time.
Though, that's only noticeable with soft-reset.
If I am to play/stop/replay the scene - the Rollable always takes the same trajectory.
Why is it that upon soft-reset the Rollable - while having the same properties - ends up in different trajectories, yet, hard-reset doesn't?
And... how do I fix it?
P.S. As for what have I tried.. Switching Sleep()/WakeUp() to isKinematic. But to be honest, I don't even have a clue what to attempt.

sentences:
Using XBox 360 controller in Unity game - game doesn't recognize axis movement I have a problem with the usage of XBox controller in Unity game. I connected the controller to the PC and it works fine, I also managed to use it in the game itself - I'm using "A" button to fire and Start to start the game and they work properly. However the game doesn't recognize the x-axis movement. I'm not sure if the problem is in the input settings or my code. This is how the Horizontal movement is defined in the game:

This is the code that handles the movement:

   float x = Input.GetAxis("Horizontal");
        Vector3 newPosition = new Vector3(transform.position.x + x*playerXMoveSpeed, 0, 0);
        newPosition.y = transform.position.y;
        newPosition.z = 0;

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

        var limit = animator.SpriteRenderer.bounds.extents;
        if (transform.position.x - limit.x < leftBorder)
        {
            var capped = transform.position;
            capped.x = leftBorder + limit.x;
            transform.position = capped;
        }
        else if (transform.position.x + limit.x > rightBorder)
        {
            var capped = transform.position;
            capped.x = rightBorder - limit.x;
            transform.position = capped;
        }

        OnMove(gameObject);

All variables are more or less self explanatory, the OnMove is a delegate that just applies the transform to the gameObject in question. The entire code is inside a void method called Move(). That method is called inside an if statement:

if ((Input.GetAxis("Horizontal") != 0.0f || Input.GetButtonDown("Horizontal")) && !IsContinueDisplayed)
        {
            FollowTouch();
        }

Like I said, the game recognizes the other buttons, but not the x-axis, it doesn't move the character. The Input.GetButtonDown is there just so keyboard input would be supported also (and it works properly).
Can you see the problem with this code or settings? Please advise.

sentences:
Help trying to use TinySoundFont library with SDL_Mixer I'm using SDL_Mixer in my project currently and I found the following library to play sounds from a soundfont https://github.com/schellingb/TinySoundFont
I tried this example which use the normal SDL_OpenAudio and it works fine https://github.com/schellingb/TinySoundFont/blob/master/examples/example2.c#L72
The issue here is that I'm not sure how to translate this example into SDL_Mixer.
Usually in SDL_Mixer I just load a wav into a Mix_Chunk with Mix_LoadWav, and then I play it with Mix_PlayChannel(-1, myChunk, 0)
In the TinySoundFont example it seems like there is a callback that I'm not sure where to add in the SDL_Mixer, and also, how I put tsf_note_on inside a chunk so it gets played when I call Mix_PlayChannel?

sentences:
How do you make a particle system collision add a force to an object towards the particle system? I have a lightning particle that gets shot at the ground. I want the particles to collide with the object they hit and add an upward force. I tried just entering a negative force in the Collider Force tab but it defaults to 0. If anyone knows a way to do this it would be greatly appreciated!

Edit: I want to send the cube in the photo upwards by adding a force on its y-axis. The Particles should remain as they are.

sentences:
Change animation speed of a 3D model I am working on a small simulator. There is a 3D character on the screen and it randomly plays an animation (I used animation.PlayQueued(...) command inside a for loop).
Now I have added a slider ( GUI.VerticalSlider ) on screen. I want to change the speed of all playing animations of 3D character when change the value of slider.

I know to use animation["animationNane"].speed=xx; but my problem is I have to pass the parameter of animation name that I want to change the speed . but actually I don't want to change the speed of specific animation clip. I want to change the speed of whatever the animation running in my 3d character. How can I change the speed of whatever animation is playing?

sentences:
How to test if procedurally generated level for infinite runner can be passed? I have a 2D infinite runner platformer game built in Unity 5, where the level procedurally generates itself. I need to check if it is possible to pass the holes on the level.

How could I do that?

sentences:
How much of a game can be protected by law? I want to remake an old multiplayer game in commercial way and I wonder how different my game has to be not to violate some IP rights. I know so far that name and logo are registered trademarks of the company that still exists so I cannot use it. But ...
How about other things such as maps or mechanics of the game? Can this be somehow protected?
If I make a new map that will NOT use a single asset from that old map (like textures, sounds or models) but will mimic the old map as much as possible, can this be problem from legal point of view?
By mimic I mean for example putting tree in excactly same position as on the old map, but the tree would be completely different model; buildings would have same plans but all the models and walls textures would be different.
Also this game has some certain amount of features (players classes, mission scenarios, types of weapons) that are being used in other games commonly so this cannot be patented.
But how about given set of these features? For example having given types of classes connected with given missions scnarios and types of weapons can be protected even though seperately they cannot be???
Is that possible?

sentences:
Unity 2d overlapCircle melee combat issue I have an issue with my overlapCircle melee combat in the game. I'm not good at such things, so I just copied that code from some YouTube tutorial. But the thing is that if the enemy is behind the collider, I can still damage and kill him. And I don't want this. Is there a solution to this problem except recreating the melee combat system from the ground up? Maybe changing circle radius when close to collider?...
Here's a video clip that may help show the situation.
void Attack()
{
    Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, whatIsEnemy);
    foreach (Collider2D enemy in hitEnemies)
    {
        Debug.Log("Melee hit: " + enemy.name);
        if (enemy is BoxCollider2D)
        {
            CinemachineShake.Instance.ShakeCamera(3f, 0.2f);
            SoundManager.PlaySound("Knife_kill");
            if (enemy.tag == "Melee enemy")
                enemy.GetComponent<enemy_melee>().TakeDamage(attackDamage);
            else if (enemy.tag == "Gun enemy")
                enemy.GetComponent<enemy_gun>().TakeDamage(attackDamage);
        }
    }
    animator.SetTrigger("Melee_attack");
    animator.SetBool("IsCrouching", false);
    animator.SetBool("IsJumping", false);
}

sentences:
How can I organize code for views efficiently? I'm making a video game for the Android platform and I need advice on the overall set up of the activities and views in the code. I don't need actual code, psuedocode will do, but actual code always helps. I will basically have the following:

A surface view that draws bitmaps in a 2d scene and rearranges them according to what ever is happening on the screen.
A main UI interface that needs to be shown on top of the surface view at all times that has buttons like the attack, defend, hotkeys and so on.
A start menu as a seperate activity that the user can choose options like volume, orientation, graphics quality, save & exit and so on.

Also I want dialogs throughout the games that pop up when interacting with NPCs and these dialogs need to display pictures as well.

That pretty much encompasses the first version of the game. I will add complexity to it maybe later on down the road but for now I would just like a general plan of how to set all of this up in a functional way. Again code would be nice but I really just need an idea of how to efficiently do these things without wasting memory resources and utilizing the Android APIs capabilites with smart programming methods.

sentences:
How do I listen for an Admob interstitial ad load event? I can show interstitial AdMob ads with the following code:

    if (GUI.Button(new Rect(10, 300, 150, 50), "Load Interstitials"))
    {
        interstitial.LoadAd(interstitialsRequest);
    }

    if (GUI.Button(new Rect(10, 400, 150, 50), "Show Interstitials"))
    {
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
        }
    }

That's all working well.

Now I want to attach a listener for when the interstitial ad has loaded. I checked all the available source files, but can't find the right listener method.

void onAdLoaded()
{
    print("Interstitial Ad Loaded");
}

public void HandleAdLoaded(object sender)
{
    print("HandleAdLoaded event received.");
    // Handle the ad loaded event.
}

I use googleads-mobile-plugins for Admob ads.

What listener should I be using?

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:
Which Box2D-like physics engine parameters need pixel conversion? The official guide does not have any useful details on the matter:

http://www.box2d.org/manual.html

Position is an obvious one. What about velocity? Density? Anything else?

Update: the context is wrapping/interfacing a physics engine to make it more usable. E.g. units of measure in the game editor should be consistent.

sentences:
Fixed Function vs Programmable Pipeline performance with many batches In OpenGL 2.0 I can easily make 10,000 draw calls per frame (with state changes in between each call).  However, if i try to do this in either OpenGL ES 2.0 or DirectX9 with shaders, my peformance is 1Hz.  Is there an inherent different between fixed function and programmable pipeline rendering that requires programmable pipeline to require much fewer draw calls per frame, or is it more likely that I'm just doing something stupid in my code? I thought that most fixed function pipelines were implemented in shaders nowadays anyway, so if it is the case that I have to batch, then how does the fixed function implementation get away with not batching if its really using shaders?

Any "official" resources you could point me to would be great.

sentences:
How to detect intersections with only colliders and not use the physics engine? I do not want to use the physics engine, I only want the collider to detect when they have entered into another collider, then I want to handle what happens to the objects.

Moving static colliders (colliders that do not attach to a rigidbody) around has a penalty, so how would I accomplish this without incurring a penalty for moving colliders around that do not attach to a rigidbody?

I could use a Kinematic Rigidbody Collider for this, but this seems kind of hacky since they are meant to be used in conjunction with Rigidbody Colliders (at least thats what their intention seems like from the manual). I have also looked into CharacterController, it says it "does not make use of Rigidbody
physics", but it does not say how the physic system treats it which would come with a penalty if the physic system sees it as a static collider (as it uses a capsule collider with no rigidbody). I tested to see if it did have a penalty, but unless stated how it works within the physics system, it is just speculation which could lead to undesired results.

Other than a Kinematic Rigidbody Collider or CharacterController, is there any way to accomplish this in unity?

sentences:
Why are radians preferred over degrees in game development? I've been looking up the definition of radians and found out that mathematicians prefer them because they are derived from pi instead of being completely arbitrary like degrees.

However, I have not found a compelling reason to use them in game development, possibly due to my complete lack of related mathematical understanding. I know that most sin/cos/tan functions in languages what radians, but someone could just as well create library functions in degrees (and avoid the inherent rounding errors when using pi).

I don't want this to be an opinionated poll, I would just like to hear from people that have done game development (and the associated math research) where radians offer a superior experience over degrees, as opposed to "We're using radians because we always used them", just for the sake of helping me (and possibly others) to understand what they are good for.

sentences: how to port my game for android in sfml i am a c++ programmer , and I want to develop games . I chose sfml , because I wanted to see what happens behind the scene better . I have an idea to make , and the desired platform is mobile devices(android , ios) . I have seen that sfml , support for touch and other capabilities of mobile devices , but I have no idea , how I can write a code , that works on all of them .

sentences: How can a programmer learn to draw 2D assets? Are there any good tutorials for someone who wants to create 2D graphical game assets? Drawing classes for absolute beginners, preferably teaching skills that can be as relevant as possible to games - drawing characters sideways/top-down, isometric, drawing textures and such.

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: 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:
How does faction work in a Multiplayer game? I'm trying to work out how Factions would work in any Standard MMO
If the player is hostile with a faction, then the NPC's of that faction would attack on sight.
If the player is neutral> with a faction, then the NPC's of that faction wouldn't attack on sight.
The "Reputation Value" would be an integer.
Hostile = 0
Unfriendly = 2000
Neutral = 4000
Friendly = 6000
Honored = 8000
Revered = 10000
Exalted = 12000

Example:
When the player Logs in. The Bandit faction must find out the Player's Reputation Value towards them.
if Player.Bandit.UNFRIENDLY or Player.Bandit.HOSTILE:
    the NPC would be able to attack the player on-sight.
if Player.Bandit.NEUTRAL or FRIENDLY or HONORED or REVERED or EXALTED:
    the NPC won't be able to attack the player on-sight.

or
ReputationValue = Player.Bandit.Reputation

if ReputationValue > 4000
   the NPC won't be able to attack the player on-sight.
else
   the NPC will be able to attack the player on-sight.

This is more complicated than it initially appears.
Every player has a FactionList, and the FactionList ReputationValue can change potentially, multiple times per second.
For the player, it is relatively simple, they have a FactionList which contains the FactionName and FactionReputation for each Faction. Clientside, they can attack anything as long as it's 5999 or below.
But for the Enemy, Serverside. they need to check the players FactionList and not only for a single player, but for potentially hundreds of players.
For ANY entity to KNOW if they can or can't attack, they first NEED to know the SPECIFIC player's FactionList ReputationValue for their Faction.
the FactionList ReputationValue is a constantly changing value which must be obtained potentially every few seconds from Each Player.
How does this check work?
When is it performed?
How often is it performed?
I'm assuming Each Faction performs this check whenever a player logs in. Adding this players value to a list.
Performing this check as part of an Aggro-radius would be insanely inefficient.

sentences:
Find shortest path to gather items I have a rectangular grid with obstacles and food items on certain tiles. There are also a few storage bins. Each food item gives 10 food. How can I find the shortest path that will allow me to collect 30 food and bring it back to any storage bin ?

I don't think I can use Dijksra class of algorithms because it does not account for a state (food carried) during the pathfinding.

sentences:
Removing inline declarations makes code work. Why? This does not work:

camera = new OrthographicCamera(100, 100 * (Gdx.graphics.getHeight() /Gdx.graphics.getWidth()));

This does:

float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();

camera = new OrthographicCamera(100, 100 * (h/w));

I do not get the difference. One displays fine on my screen, the other remains black.

Why is this? Is there any syntactical reason why this does not work, or is it a bug?

sentences:
How to make a text of several letters animate, only with an animation I wonder if it is possible to create an animation in a text with a single "animation". The problem is that for me to reach the desired effect I need to create an animation for each letter, as each one will appear a screen location. There is possibility to create this effect with just an animation? Remember that the deed is not the same as an animation into a sprite (one over another).

I did the animation for entering each letter on the screen, Curve > Transform > Position. (in the picture I tried to simulate using arrows to input source for each letter).

sentences:
UDK game Prisoners/Guards For school I need to make a little game with UDK, the concept of the game is:

The player is the headguard, he will have some other guard (bots) who will follow him. Between the other guards and the player are some prisoners who need to evade the other guards.

It needs to look like this

My idea was to let the guard bots follow the player at a certain distance and let the prisoners bots in the middle try to evade the guard bots.
Now is the problem i'm new to Unreal Script and the school doesn't support me that well.

Untill now I have only was able to make the guard bots follow me.
I hope you guys can help me or make me something that will make this game work.

Here is the class i'm using to let te bots follow me:

class ChaseControllerAI extends AIController;

var Pawn player;
var float minimalDistance;
var float speed;
var float distanceToPlayer;
var vector selfToPlayer;

auto state Idle
{
    function BeginState(Name PreviousStateName)
    {

        Super.BeginState(PreviousStateName);
    }

    event SeePlayer(Pawn p)
    {

        player = p;
        GotoState('Chase');
    }
Begin:

       player = none;
       self.Pawn.Velocity.x = 0.0;
       self.Pawn.Velocity.Y = 0.0;
       self.Pawn.Velocity.Z = 0.0;
}
state Chase
{
    function BeginState(Name PreviousStateName)
    {

        Super.BeginState(PreviousStateName);
    }
    event PlayerOutOfReach()
    {
        `Log("ChaseControllerAI CHASE Player out of reach.");

        GotoState('Idle');
    }
//  class ChaseController extends AIController; CONTINUED
// State Chase (continued)
    event Tick(float deltaTime)
    {
       `Log("ChaseControllerAI in Event Tick.");

       selfToPlayer =  self.player.Location - self.Pawn.Location;
       distanceToPlayer = Abs(VSize(selfToPlayer));

       if (distanceToPlayer > minimalDistance)
       {
           PlayerOutOfReach();
       }
       else
       {
          self.Pawn.Velocity = Normal(selfToPlayer) * speed;
          //self.Pawn.Acceleration =    Normal(selfToPlayer) * speed;
          self.Pawn.SetRotation(rotator(selfToPlayer));
          self.Pawn.Move(self.Pawn.Velocity*0.001); // or *deltaTime
       }
    }
Begin:
     `Log("Current state Chase:Begin: " @GetStateName()@"");
}

defaultproperties
{
    bAdjustFromWalls=true;
    bIsPlayer= true;
    minimalDistance = 1024; //org 1024
    speed = 500;
}

sentences: What is "terrain mesh generation" exactly? I'm new to computer graphics and need to know and understand what the "terrain mesh generation" is? I read about "terrain", "mesh", "terrain generation" but can't find an article named "terrain mesh generation". So is there anyone can explain "terrain mesh generation" ?

sentences: What options are there for developing on the Nintendo platforms? I know of Wario Ware DIY but is this the only option?

sentences:
Multiple Mesh Renderes with Matrices. (Direct X11, C#) im just confused: Im trying to render 2 cubes instead of one. So in my main class i have my WORLD matrix. Then if i render the mesh the camera is multiplying all matrices with the worldProjectionBuffer etc... But how do i add the MeshRenderer´s world matrices to the of the Camera? And how do i add them to the Buffer then? :/ Please help me!

Creating the Buffer:

worldViewProjectionBuffer = new SharpDX.Direct3D11.Buffer(device1, Utilities.SizeOf<Matrix>(), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);

Setting the Buffer:

context.VertexShader.SetConstantBuffer(0, worldViewProjectionBuffer);

The Camera is updated every Frame:

currentCamera.Update(context, worldViewProjectionBuffer);
OnFrameUpdate();
renderer.Draw(context);

The Update of the Camera is recreating the matrices, but how would i add 2 other world matrices to the camera?

internal void Update(DeviceContext context, SharpDX.Direct3D11.Buffer worldView)
        {
            viewProjection = Matrix.Multiply(view, projection);
            worldViewProjection = world * viewProjection;
            worldViewProjection.Transpose();
            context.UpdateSubresource(ref worldViewProjection, worldView);
        }

And the MeshRenderer has it own world matrix - but how do i add the vertices from the model to it?!

 public sealed class MeshRenderer : BaseRenderer, IDisposable, ICloneable
    {
        private Model mesh;
        private Material material;
        private Matrix world;
...

Thank in Advance,

Best Regards, Kerbo

sentences:
How do I manually make a .pack file like TexturePacker (without using TexturePacker)? I am using libGDX and apparently the only way I see for creating a UI is with texture packs.

I would say that since a texture pack is nothing more than JSON or XML file and a large png I could manually code a texture pack. How?

sentences:
How do you handle animations that are for transitioning between states? How does one usually handle animations that are for going between a game object's states? For example, imagine a very simple game in which a character can only crouch or stand normally. Currently, I use a custom Animation class like this:

class Animation{
 int numFrames;
 int curFrame;
 Bitmap spriteSheet;
 //... various functions for pausing, returning frame, etc.
}

and an example Character class

class Character{
 int state;
 Animation standAni;
 Animation crouchAni;
 //... etc, etc.
}

Thus, I use the state of the character to draw the necessary animation.

if(state == STATE_STAND)
    draw(standAni.updateFrame());
else if(state == STATE_CROUCH)
    draw(crouchAni.updateFrame());

Now I've come to the point where I want to draw "in-between" animations, because right now the character will just jump immediately into a crouch instead of bending down. What is a good way to handle this? And if the way that I handle storing Animations in the Character class is not a good way, what is?

I thought of creating states like STATE_STANDING_TO_CROUCHING but I feel like that may get messy fast.

sentences: Is the "Match-3" mechanic unpatented? Can I use a match-3 mechanic in my commercial game without being sued by some company holding the patent? I will add some extra features to the mechanic.

sentences:
Simple screen aligned renderer I'm trying to create a super simple no frills off-screen process... I have the device, I can export the texture to Image... etc... I'm having one heck of a time just getting a simple Triangle Strip to display an image so I can run pixel shaders on it... I have found examples and even have the Direct3D cookbook.. However, I don't need all the camera functions and so on... I can't seem strip out the unnecessary bits and still have it work... please help...

I just need a super simple quad renderer that aligns to the renderer target...

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:
How to perform simple collision detection? Imagine two squares sitting side by side, both level with the ground like so:

A simple way to detect if one is hitting the other is to compare the location of each side. They are touching if all of the following are false:

The right square's left side is to the right of the left square's
right side.
The right square's right side is to the left of the
left square's left side.
The right square's bottom side is above
the left square's top side.
The right square's top side is below
the left square's bottom side.

If any of those are true, the squares are not touching.
But consider a case like this, where one square is at a 45 degree angle:

Is there an equally simple way to determine if those squares are touching?

sentences:
Putting a Java/Slick game on your website? I've made a simple little 2D game in Java using Slick and I want to embed it in my website. I'm just a little confused as to how to go about it, I'm guessing I need to export it as a WAR file?

Sorry if this isn't really specific but oddly enough I couldn't find any information on this subject. I think I may lack the basic vernacular to describe my question, because most of my Google and other searches turn up completely unrelated results any help would be appreciated, I just need a starting point.

sentences:
Network game syncing I'm creating a networked game and I have a huge problem understanding how to keep everything in sync. Right now I have a server and a client and the client can log in and move a character around using the keyboard arrows.

When a arrow key is hit I send data to the server, that then sends that data out to all the clients and then it moves the appropriate character in a specific direction.

However if I keep on hitting arrow keys eventually the result on two different clients will look different and they fall out of sync. So what is the best way to stop this from happening?

I've read that 1 method is to send data back and forth to figure out the latency between each client and then to include that into the movement, is that really the best method around at dealing with this? In which case would anyone be kind enough to explain in more detail how that works exactly?

Thanks

sentences:
How do you decide upon the price for a game? I hope this is the right board for the question.

I have this idea for a game, programming Skills with C++ and a licensed Engine. I already made a prototype of the game as proof of concept and a few friends liked it so far.

I don't want to spoil it all, but it is a 2D Robotron Style Precision Shooter in an arena which is set in space.

All you do is beating waves of enemies and when you leveled up, you select a perk to enhance your ship. Examples are making weapons stronger, faster, making the ship more agile, different Weapons as Smartbombs, Mines etc.

Having different maps with this kind of game is quite difficult, since space does not have obstacles. All you can do is make different backgrounds and maybe asteroids etc. Another type of content could be to allow the user to gather some virtual money to unlock goodies that are available at wave 1.

So far for my idea. Now, would this alone already justify asking 5$ for a game? When I compare it for example to puppygames game "Titan Attacks", I say yes, since they do not have more features. On their website the game is 7$, on Steam 4$. Their Ultratron is also 7$, which is also a classic robotron style game. But it does not yield any special features imho ( it is fun nontheless :D ), but has a very adorable artstyle.

Nation Red, which is also an inspiring source for me (Robtron Style 3D Zombie Shooter, awesome game btw), costs 10$ on Steam but also has coop, local and online.

So, how do you estimate the price of your game that you just made so people don't feel ripped off and you still make profit after getting back the investment of licenses?

sentences:
Are collision detection always O(n^2)? Are physics engine able to decrease that complexity, for example by grouping objects who are near each other and check for collisions inside this group instead of against all objects ? (for example, far objects can be removed from a group by looking at its velocity and distance from other objects).

If not, does that make collision trivial for spheres (in 3d) or disk (in 2d) ? Should I make a double loop, or create an array of pairs instead ?

EDIT:
For physics engine like bullet and box2d, is collision detection still O(N^2) ?

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:
How does Color.Lerp works? I want to understand how does Color.Lerp works in unity.
According to this page it is quite clear to understand how to use it but I'm interested in how it is implemented. Does it work on RGB channels? and how? In the docs it says that the t factor is clamped between 0 and 1 so i wonder to know on which values Lerp works with Color.

sentences:
Do Playfish and Zynga use COTS game engines? I'm very interested to learn how to make 2D and 3D games, but I'm very new to this field so I am wondering if companies like Playfish, Zynga and other producer of games on Facebook are using publicly available game engines to make their games or if they're building their own game engine or what?

What game engines or technologies that are used in such games?

Are there any resources available that I can use to get started?

sentences:
Fatal Python error: (pygame parachute) Segmentation Fault when using PyGame and cx_Freeze I'm using cx_Freeze to package my PyGame game. I'm running Ubuntu Linux, so I used the source package. However, I got the following error when I run cxfreeze game.py:

Fatal Python error: (pygame parachute) Segmentation Fault
Aborted

How can I fix this? I have seen other similar questions but no good answers.

sentences:
How to use transposition tables with MTD(f) I'm writing an AI for a card game and after some testing I've discovered that using MTD(f) on my alpha beta algorithm - a series of zero-window searches - is faster than just using alpha-beta by itself.

The MTD(f) algorithm is described well here http://people.csail.mit.edu/plaat/mtdf.html

The problem I have is that for each pass in the MTD(f) search (for each guess) I don't reuse any of the previous positions I have stored even though the write up on the link suggests that I should (in fact clearing the table between iterations speeds up the algorithm).

My problem is that when I store a position and a value in my transposition table I also store the alpha and beta values for which it is valid. Therefore a second pass through the tree with a different guess (and therefore alpha and beta) can't possibly reuse any information. Is this what is to be expected or am I missing something fundamental here?

For instance if for alpha=3 beta=4 we come to a result of 7 (obviously a cut-off) should I store that in the table as valid for alpha=3 to beta=6? Or beta=7?

(Copied from stack overflow in hope of answers)

sentences:
Curiosity on any Smartphones that Run on Android 2.3.3 with Different Screen Reoslution I have a question regarding about any smartphones that run only in Android 2.3.3. Is the size of screen or the screen resolution is always HVGA or does it have capable of running this OS (Android 2.3.3) on big screen size (4" to 5") at about 720x1280?

I'm thinking of the game's compatibility depending on the version of the Android OS and the screen resolution, which affects the change of coordinates especially for assigning touch buttons and drag-n-drop at exact location, before I'm gonna decide to make one. My program works on the Android 4 ICS and Jellybean, however, will that work on Android 2.3.3 in spite of precise touch coordinate or just dependent on the screen resolution (regardless how large it is) as the X and Y coordinate?

And take note, I'm using Eclipse IDE for Java developers.

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:
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:
Unity2D Best way to determine degrees between two colliding entities? I'm trying to determine the collision-direction between two objects. I'll be using this for various things such as creating blood-entities in a specific direction proportional to where the other entity is hitting an entity. What's the best/most efficient way to do this? I've been doing this but it seems unstable/not to be working.

Assuming both entities are center-pivoted, I use trigonometry to find the angle like; atan(b/a).
For some reason the output angle seems to be pretty random.

Here's the method I made:

protected void checkCollisionDirection(Collision2D target)
    {
        Vector3 positionDifference = target.gameObject.transform.position - gameObject.transform.position;
        int quadrant = 0;
        float x = positionDifference.x;
        float y = positionDifference.y;
        float degrees = Mathf.Atan (y / x) * Mathf.Rad2Deg;

        if (positionDifference.x > 0 && positionDifference.y > 0)
        {
            quadrant = 1;
        }
        else if (positionDifference.x < 0 && positionDifference.y > 0)
        {
            quadrant = 2;
            degrees += 180;
        }
        else if (positionDifference.x < 0 && positionDifference.y < 0)
        {
            quadrant = 3;
            degrees += 180;
        }
        else if (positionDifference.x > 0 && positionDifference.y < 0)
        {
            quadrant = 4;
            degrees += 360;
        }
        hitDirectionDegrees = degrees;
    }

I'm open to any suggestions that can find an angle between two entities.

sentences:
Game Physics: Implementing Normal Reaction from ground correctly I am implementing a simple side scrolling platform game. I am using the following strategy while coding the physics:

Gravity constantly acts on the character.
When the character is touching the floor, a normal reaction is exerted by the floor.

I face the following problem:

If the character is initially at a height, he acquires velocity in the -Y direction. Thus, when he hits the floor, he falls through even though normal force is being exerted. I could fix this by setting the Y velocity to 0, and placing him above the floor if he has collided with it. But this often leads to the character getting stuck in the floor or bouncing around it. Is there a better approach ?

sentences:
What 3D engine supports real-time editable 3D terrain loaded in from a server? I'm currently having a problem choosing an engine for a game project I have since a few years.
What I'd need is to be able to load a terrain from a remote server (which I can take care of) and display it dynamically, if possible with paging.
The terrains should also be able to be edited in realtime (locally or remotely and transmitted by the server).

I can take care of the network part but need a 3d engine flexible enough to support the terrain features detailed above.
Would you know a 3D engine which could support this ? I'd prefer programming with .NET but C++ is also fine.

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:
How do I transition a cocos2d scene to a UiViewController? My project is a cocos2d game project, but I added a UIViewController for the initial log in. The first scene is the splash logo, followed by the menu screen, but I need to pass to my UIViewController instead of my menu screen. I've tried lots of methods, but it keeps crashing.

-(id) init
{

    if( (self=[super init] ))
    {
        CCSprite *sprBack = [CCSprite spriteWithFile:@"logo.png"];
        [sprBack setPosition:ccp(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)];
        [self addChild:sprBack];

        [self schedule:@selector(logoTimer:) interval:3];
    }

    return self;
}

-(void) logoTimer: (ccTime) dt
{

    [[CCDirector sharedDirector] replaceScene:
        [CCTransitionFade transitionWithDuration:0.5f scene:[TitleLayer node]]];
}

My UIViewController is called LoginViewController. I need to pass a scene like this:

[[CCDirector sharedDirector] replaceScene:
    [CCTransitionFade transitionWithDuration:0.5f scene:[loginviewcontroller node]]];

I tried a lot of methods, but unfortunately, nothing will gives me the correct solution.

Itvis worth mentioning that  LoginViewController is not a Node. I have tried that method, but it geta stuck at the logo scene, with no page transition taking place.

-(void) logoTimer: (ccTime) dt
{
    UIViewController *cocos = [[LogoViewController alloc] init];
    [cocos.navigationController dismissViewControllerAnimated:YES completion:nil];
    [cocos.navigationController popViewControllerAnimated:YES];
}

How do I solve my problem?

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 do I make my 3d cube move left and right with buttons in Unity with RigidBody.AddForce? How do I make my 3d cube move left and right with buttons in Unity with RigidBody.AddForce()?
I can't figure out how to do this in Unity!
I'm trying to make my game playable on Android but I can't get my cube to move with buttons!

sentences:
Input.mousePosition gives a NullReferenceException I'm trying to Add raycast shooting to my player but when I get the Vector2 mouse position it give this error

  NullReferenceException: Object reference not set to an instance of an
  object

This is my code

   Vector2 mousePosition =
         new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x,
                     Camera.main.ScreenToWorldPoint(Input.mousePosition).y);

How can i fix this ?

sentences:
How to edit WoW models with Blender? My situation is following, I am into role play, mostly me and my friends are using World of Warcraft. Since I am a bit into Blender too, I would like to try to edit some models(armor and weapon) for private use only(!). Problem is - I have no idea how to import and export them.

So far I have found only this forums.runicgames, but it looks very outdated, and I am not sure if it will work with Warlords of Dreanor extension.

How would I go about exporting the models from WoW and importing them into Blender?

sentences:
Google play services not working in unity I've done everything as specified- Linked my app to play services in the developer console. Added the SHA1 from Applications -> Release Management -> App signing -> Upload certificate. Downloaded the latest 'play services' unity package from GitHub. Added the required 'resource' to the play services setup in unity editor. Added the following script to the 'Canvas' object:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using GooglePlayGames;
 using GooglePlayGames.BasicApi;
 using UnityEngine.SocialPlatforms;

 public class PlayGamesServices : MonoBehaviour
 {
     // Start is called before the first frame update
     void Start()
     {
         PlayGamesClientConfiguration clientConig = new
         PlayGamesClientConfiguration.Builder().Build();
         PlayGamesPlatform.InitializeInstance(clientConig);
         PlayGamesPlatform.Activate();
         Social.localUser.Authenticate((bool success) =>
         {
             if (success)
                 Debug.Log("Logged In");
             else
                 Debug.Log("Failed to Log In");
         });
     }

     public static void PostToLederboard(long newHighScore)
     {

   Social.ReportScore(newHighScore,GPGSIds.leaderboard_global_high_score, (bool success) =>
         {
             if (success)
                 Debug.Log("New High Score posted");
             else
                 Debug.Log("Unable to post New High Score");
         });
     }

     public void ShowLeaderboard()
     {
    PlayGamesPlatform.Instance.ShowLeaderboardUI(GPGSIds.leaderboard_global_high_ score);
     }
 }

I've already published my game to alpha testing and then implemented play services. I'm wondering if that's the problem.
I've run the adb logcat and this error popped up:

[Play Games Plugin DLL] 07/21/19 12:06:19 +05:30 ERROR: UnityEngine.AndroidJavaException: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment 07-21 12:06:19.325 23287 23314 W Unity :
at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0 07-21 12:06:19.325 23287 23314 W Unity :
at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (System.IntPtr clazz, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <00000000000000000000000000000000>:0 07-21 12:06:19.325 23287 23314 W Unity :
at UnityEngine.AndroidJavaObject._CallStatic[ReturnType] (System.String methodName, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 07-21 12:06:19.325 23287 23314 W Unity :
at UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) [0x00000] in <00000000000000000000000000000000>:0 07-21 12:06:19.325 23287 23314 W Unity :
at GooglePlayGames.Android.AndroidTokenClient.DoFetchToken (System.Boolean silent, System.Action`1[T] callback) [0x00000] in <00000000000000000000000000000000>:0 07-21 12:06:19.325 23287 23314 W Unity :
at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0 07-21 12:06:19.325 23287 23314 W Unity :
at GooglePlayGames.OurUtils.PlayGamesHelpe

I've tried reproducing the error by re-doing the exact same steps in an empty project and ended up with the same error.

Update:
When i change Player Settings -> Publishing -> Minify ->
Release to None and Debug to None the error is gone and play services sign-in was successful.
This worked for the empty project, however when i make the same change in my original game project the build fails with errors.
How do I build my game without errors when Minify is set to None?

sentences:
Problem when reloading unity scene(level) I am using

SceneManager.LoadScene(SceneManager.GetActiveScene().name);

to reload my current scene in unity  , but when i run the game ,in hierarchy lots of scene are appearing. Also if i do some editing, i can not save the scene any more. unity is giving and error "Overwriting the same path as another open scene is not allowed". I am new to game development. I would appreciate any help.

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 to move through a game object - while getting the normal of the initial contact In Unity, how can I detect a collision between two game objects, but have them pass through one another, i.e. not block each other?
Specifically, I need the collision normal provided by the Collision2D object that comes with the OnCollisionEnter2D method. But I want to be able to move through the object that detected the collision, not get blocked by it.
PS: Checking the Is Trigger checkbox would mean the argument passed into the trigger method no longer contains the collision normal!

sentences:
If collision move around the collider I am writing a game in Java, I have this long method to move GameBodyObject towards the point:

public boolean moveTowardsPoint(Point p, double stepSize, double minDistance, ArrayList<GameBodyObject> objects,  boolean shouldStepInto) {
    double dx = p.getX() - getPosition().getX();
    double dy = p.getY() - getPosition().getY();

    boolean isClose = true;

    Point lastPosition = getPosition().clone();

    if(Math.sqrt(dx * dx + dy * dy) > minDistance) {
        isClose = false;
        setRotation(Math.atan2(dy, dx));

        // Though the sqrt is expensive operation
        // We check first without using sqrt
        if (shouldStepInto && Math.abs(dx) + Math.abs(dy) < stepSize) {
            if (Math.sqrt(dx * dx + dy * dy) < stepSize) {
                getPosition().setX(p.getX());
                getPosition().setY(p.getY());
            }
        } else {
            getPosition().setX(getPosition().getX() + (stepSize * Math.cos(getRotation())));
            getPosition().setY(getPosition().getY() + (stepSize * Math.sin(getRotation())));
        }

    }

    for(GameBodyObject obj : objects) {
        if(!obj.equals(this)) {
            if (checkCollision(obj)) {
                setPosition(lastPosition);
                return isClose;
            }
        }
    }

    return isClose;

}

checkCollision checks if there is a collision and if yes it returns true otherwise it returns false.

Now if GameBodyObject collides it stops. What if I want this object to walk around the collider? simply to find a path around when the collision occurs. (I don't want to implement any A* or other pathfinding algorithms btw)

Is it possible without pathfinding?

I was thinking that if collision occurs I try to move more to the left, if the collision occurs again I try to move a bit to the right, and then move a more than a littlebit left, and if the collision doesn't occur I move to that direction. But that's bruteforce and very inefficient.

IMPORTANT EDIT:
ALL my GameBodyObjects are circles with getRadius() and getPosition().getX(), getPosition().getY()

EDIT

I've tried to calculat normal vector of vector pointing from me (gameBodyObject1) and the colliding gameBodyObject2. Then I moved towards that normal vector. I got a jiggling bouncing effect which I don't want. The bouncing effect appeared when there was a multiple colliding objects. After moving by the normal I could walk through the objects which is also not wanted effect. Maybe I should check if that new movement creates a collision.

sentences:
Procedural Generation of Galaxy I'd like to generate galaxy using seed , with shape changing a bit and positioning X number of stars.

I'd like to make it realistic (as possible). But i have absolutely no idea how i should do that.
I'm not talking about procedural content generation , i know a bit about and i can search for it if i need, i talking about formulas to use to generate galaxy and then placing dots (stars) so it can look real.

In my mind i see it this way:

1) place a center

2) generate tentacles (don't know the exact term) (i'd like to set the number of tentacles)

3) place dots randomly around those tentacles.

bonus question : i'd like to move the galaxy ingame (like it move in real) , and i don't get if a rotating would be enough and if the movement is more complex)

sentences:
Collision detection against large arbitrarily shaped textures What is the most effecient way to do collision detection on strangely shaped textures in XNA? Here is an example texture:

As you can see, it is far from a perfect square. I want the player to collide with the brown parts and pass through the transparent ones.

How do I create a bounding box that wraps around irregular terrain? Should I create many smaller bounding boxes instead?

sentences:
Why do games dynamically link to the CRT? Almost all big titles that I have played require you to install the MSVC runtime. There have been numerous questions about "statically vs. dynamically linked CRT" on StackOverflow, the reasons for dynamic CRT generally boil down to:

Reduced memory usage if other programs are using the same libs
Can update the libraries independently.

But I wonder, how often are these reasons related to game development?

Most games spend at least a hundred MB of RAM and it's not like saving some KBs really matter. Besides, games are supposed to capture the user's sole attention so he'll probably not be running other programs to share the CRT.
I don't think I have seen a game needing to upgrade its CRT in its life-cycle.

So, why don't games statically link their CRT so they can reduce the extra step of installing MSVC runtime?

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

sentences:
Large amounts of strings to be used, but how to store them? This is a question I've been meaning to ask. I have thought about it for a little bit and have a few ideas, but I'm not sure which is most secure, and will give me the most functionality with the most efficiency. For my game (being a story game) I have a plethora of strings that I'm going to need to display. I decided to split up the story into chapters, each chapter being a new scene(This way I could organize the content for the chapter). What I was thinking was that I could write regular text files with the chapter's content, while efficient and practical, this seems highly insecure. Then I thought, why not put it into large string arrays on a separate C# file. Well that's more secure, but it's not really practical and it has less efficiency. So I have found pretty much the two extremes here.

What would be the best way to deal with large amounts of strings in a secure, efficient, and functional way? Think about a happy medium compared to my two extremes.

sentences:
Do games depend on the OS to scale resolution? I'm having issues with my computer related with scaling when using different resolutions other than the native. So I started to wonder, in PCs, is scaling handled by the card driver or the game engine? Does it depend of what engine we are talking about? Do engines somehow bypass the scaling algorithm from the driver?

PS: I'm talking about the regular PC games that uses DirectX or OpenGL.

sentences:
Enemy gun won't aim properly when collision line is flipped | Game maker studio When the enemy move's to the right their gun faces right. When they move left the gun will face left as it should. When the player collides with the enemy collision line on the right side, the enemy gun will point towards the player properly.

When the player is on the left side of the enemy and hits the collision line, the enemy gun will sort of point towards the player but not facing the right direction.

 Step Event of Enemy gun object:

//image_xscale = 1 is looking to the right, -1 is left
// I use image_angle so the enemy gun will aim at the player on x and y axis

if obj_testEnemy.image_xscale == 1 { //When the enemy is looking to the right
    if (collision_line(x, y, x + 128, obj_testPlayer.y , obj_testPlayer, false, true)) {
        image_angle = point_direction(x,y,obj_testPlayer.x,obj_testPlayer.y); //how it aims at the player
    } else {
        image_angle = obj_testEnemy.image_xscale; // faces the correct direction when not colliding
    }

} else {
    if (collision_line(x, y, x - 128, obj_testPlayer.y , obj_testPlayer, false, true)) {
        image_angle = point_direction(x,y,obj_testPlayer.x,obj_testPlayer.y);
        image_xscale = -1; //gun should be facing left but it's not
    }
}

I don't understand why the gun won't face left when the collision line is facing left

Working:

Not Working:

sentences:
Generating and rendering not point-like particles on GPU Specifically I'm talking about particles as seen (for example) in the UE4 dev video here. They're not just points and seem to have a nice shape to them that seems to follow their movement.

Is it possible to create these kinds of particles (efficiently) completely on the GPU (perhaps through something like motion? Or is the only (or most efficient) way to just create a small particle texture and render small quads for each particle?

sentences:
Difference between rotation methods? My question is in about rotate methods in android.graphics.Camera. In Docs, I saw these comments:

  public void rotateX (float deg) Since: API Level 1
  Applies a rotation
  transform around the X axis.

  public void rotate (float x, float y, float z) Since: API Level 12
  Applies a rotation transform around all three axis.

There is my question:What is difference between using rotate (float x, float y, float z) and a sequence of rotate methods? For example what's the difference between these two snippets A and B?

A)

camera.rotate (x, y, z);

B)

camera.rotateX (x);
camera.rotateY (y);
camera.rotateZ (z);

sentences:
Best practices for UnitTesting heavy Flash game clients and libraries? We have several quite heavy game clients completely written in AS3 (some also use Flex for UI). Some clients are built with PureMVC, others are a pile of spaghetti code that's grown over the years. We also have several libraries used by our game clients that are written in AS3/Flex.

I'm tasked to evaluate the benefits/risk/cost of applying unit-testing to our clients and libraries and decided to give FlexUnit a closer look. I chose FlexUnit for a first attempt over fluint since FlexUnit is definitively able to test pure AS3 projects while I'm not sure about that for fluint.

Now I'm wondering what some good starting points and best practices are to get unit-testing into previously untested applications.

So my questions for unit-testing game clients and libraries are:

How to get started? What are "low-hanging" (= easily testable) fruits to test with unit-testing?
What are commonly tested aspects of game clients?
Can you apply unit-testing to the BBOY design pattern or do you need to (extensively) refactor the game clients?
Is it useful (and does it make sense) to test asset loading? If so, how to do it (comparing a binary diff, or comparing hash checksums, or ...)?
How to test server communication and asynchronous commands?
How to integrate the whole thing with Hudson/Jenkins CI server and Maven? Are there any reporting tools that can generate overviews of the run tests and report which test failed on which function/class?

I'm thankful for all pointers about the issue (direct answers, blog posts, forum discussions, how-tos, etc. etc. etc.) since I have little previous practical experience with unit-testing.

sentences:
What PPU should I choose for assets aimed for different resolution So I'm trying to make my pixel-art game handle multiple resolutions. I've stumbled upon this article: https://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/ but I don't understand it completely.

Let's base my question on the example from this article.

My base resolution is 1024x768, PPU is 32 and camera ortographic size is 12. How can I calculate the PPU for assets which will handle 1080p resolution?

In the article, the author took a value of 48. But simply I can't understand where did this value come from.

I'd really appreciate if someone would explain this to me.

sentences:
Predicting physics/trajectory for pool/billiards games I'm thinking of making a quick proof of concept of a billiard-style game mechanic, where the player has perfect information of what is about to happen.
Here's a good example:

I'm only mildly familiar with physics in both Unity and Flixel-Box2D, and I can't really off the top of my head imagine how to do this.

Should I even use physics at all, or should I just use basic math?

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:
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:
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:
Determining IF & WHERE a line intersects with a 2D plane (in 3D space) The following problem I'm working on is for one of my favorite past-times: game development.

Problem: We're in 3D space. I'm trying to determine if a line between two vectors in said space is passing through a circle; the latter of which consists of: center vector, radius, yaw & pitch.
In order to determine that, my aim is to convert the circle to a plane which can either be infinite or just have the diameter of the circle for all it's sides.
Should the line between the two vectors in fact pass through that plane, I am left with the simple task of determining whether that intersection point is within the radius of the circle, in which case I can return either true or false.

What's already working: I have my circles set up and the general framework is there. The circles are appearing/rendered in the 3D space exactly as specified, great!

What was already tried: Copied some github gist codes and tried to make them work for my purposes. I kinda worked, sometimes at least. Unfortunately due to the nature of how the code was written, I had no idea what it was doing and just scrapped all of that. Researched the topic a lot, too. But due to me not really understanding the language people speak when talking about line/plane intersections, I could have read the answer without recognizing it as such.

Question: I'm stuck at line intersections. No idea where to go and how it works logically! So, where do I go from here and how can one comprehend all of this?

Note: I'm working with Java, but I'm not looking for spoon-fed code. It's a logical issue I'm trying to get past. If explained well enough, I will make the code work with trial and error!

sentences:
Why when rotating the character to the next target it's rotating to the other direction? Instead rotating and facing the target it's rotating to the other side but moving to the target.

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

public class SoldierPatrol : MonoBehaviour
{
    System.Random rnd = new System.Random();
    public GameObject[] points;
    // assume you have 5 possible points that you can go
    public int moveIndex = 0;
    public float speed = 3;
    public float smoothSpeed = 0.5f;

    void Update()
    {
        Rotate(points[moveIndex]);
        transform.position = Vector3.MoveTowards(transform.position, points[moveIndex].transform.position, speed * Time.deltaTime);
        if (Vector3.Distance(transform.position, points[moveIndex].transform.position) < 1)
        {
            moveIndex = rnd.Next(0, 3);
        }
    }

    private void Rotate(GameObject target)
    {
        transform.rotation = Quaternion.Lerp(transform.rotation, points[moveIndex].transform.rotation, Time.deltaTime * 1);
    }
}

sentences:
How to detect unknown forces on pool re-used rigidbody? I have a ragdoll which performs dying quite well when it is initialized. But when the same prefab object is re-used by being pooled and recycled, it jerks violently when die. As if some forces were left on the rigidbodies when the mesh is disabled.

My code goes through the rigidbodies in the ragdoll and sets isKinematic when the enemy is alive and does his usual animations, but turns isKinematic false when the enemy dies so that ragdoll can take over.
From there the pool's lifetime kicks in giving the corpse sometime to be a ragdoll, then the whole gameobject is disabled and pooled.
When a new enemy is to generated the pool is asked for one and it is provided. The enemy enters the game normally and performs it's animations correctly.
This is where the problem occurs, when the enemy is killed a second time it "jerks" upward as if collapsing in on itself.

The only thing I could think of it that there are some forces left on the mesh when disabled and they activate again when the ragdoll is enabled through death.
So I went through all rigidbodies and do:

rigidbody.angularVelocity = Vector3.zero;
rigidbody.velocity = Vector3.zero;

But this doesn't also work, so I'm not sure if it's remnant forces or even if there's such a thing.

What else could be effecting the gameobject to cause a sudden jerk in the ragdoll, which supposedly doesn't have any forces applied on it's inception?

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:
Collision detection - Smooth wall sliding, no bounce effect I'm working on a basic collision detection system that provides point - OBB collision detection. I have around 200 cubes in my environment and I check (for now) each of them in turn and see if it collides. If it does I return the colliding face's normal, save the old player position and do some trigonometry to return a new player position for my wall sliding.

edit
I'll define my meaning of wall sliding: If a player walks in a vertical slope and has a slight horizontal rotation to the left or the right and keeps walking forward in the wall the player should slide a little to the right/left while continually walking towards the wall till he left the wall. Thus, sliding along the wall.

Everything works fine and with multiple objects as well but I still have one problem I can't seem to figure out: smooth wall sliding. In my current implementation sliding along the walls make my player bounce like a mad man (especially noticable with gravity on and moving forward).

I have a velocity/direction vector, a normal vector from the collided plane and an old and new player position. First I negate the normal vector and get my new velocity vector by substracting the inverted normal from my direction vector (which is the vector to slide along the wall) and I add this vector to my new Player position and recalculate the direction vector (in case I have multiple collisions).

I know I am missing some step but I can't seem to figure it out.

Here is my code for the collision detection (run every frame):

Vector direction;
Vector newPos(camera.GetOriginX(), camera.GetOriginY(), camera.GetOriginZ());
direction = newPos - oldPos; // Direction vector
// Check for collision with new position
for(int i = 0; i < NUM_OBJECTS; i++)
{
    Vector normal = objects[i].CheckCollision(newPos.x, newPos.y, newPos.z, direction.x, direction.y, direction.z);
    if(normal != Vector::NullVector())
    {
        // Get inverse normal (direction STRAIGHT INTO wall)
        Vector invNormal = normal.Negative();
        Vector wallDir = direction - invNormal; // We know INTO wall, and DIRECTION to wall. Substract these and you got slide WALL direction
        newPos = oldPos + wallDir;
        direction = newPos - oldPos;
    }
}

Any help would be greatly appreciated!

FIX
I eventually got things up and running how they should thanks to Krazy, I'll post the updated code listing in case someone else comes upon this problem!

for(int i = 0; i < NUM_OBJECTS; i++)
{
    Vector normal = objects[i].CheckCollision(newPos.x, newPos.y, newPos.z, direction.x, direction.y, direction.z);
    if(normal != Vector::NullVector())
    {
        Vector invNormal = normal.Negative();
        invNormal = invNormal * (direction * normal).Length(); // Change normal to direction's length and normal's axis
        Vector wallDir = direction - invNormal;
        newPos = oldPos + wallDir;
        direction = newPos - oldPos;
    }
}

sentences:
Unity: Built-In Shader Transformation Explanation Resource I'm working on some of my first shaders and taking a look at the variables included by cginc I see this  list of transformation matrices:

I've watched some beginner talks and I understand what the first one does but pretty much every other one I'm not sure what it does or how to apply it. Does anyone know of a good resource for explaining these transformations?

sentences:
Question about where to put a method I'm working on a tower defense game as a class project and i got it to a kinda working level(creep spawns, towers can shoot etc), but i have a problem with my classes.

Currently the towers shoot but there's no bullets, i'm using an ArrayList to store bullets.

Where should the ArrayList be, on the Game class(manages all the logic) or on the tower class?

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:
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:
How to use 2D textures in OpenGL / WebGL for physics Following along the answer here, it was mentioned about textures:

  They can also store things like velocities. For example, you can use a texture as a "flow field" for animating particles or other objects. They can even be used to control geometry. You can sample a texture in a vertex shader, for example, and use the result to determine how to transform the vertex.

That is a new idea to me, using it for physics stuff! That is pretty cool.

I am implementing a 2D game where there will be basic physics like gravity, light shining, things rotating and orbiting like planets, things moving fast and slow, plants blowing in the wind, things flying and flapping wings, things cracking like rocks, water flowing (simple 2D water, nothing fancy), smoke billowing, etc.

I'm wondering some specific ways I can apply textures and shaders to these physics problems, rather than implementing them on the CPU like you typically see. My understanding of shaders so far is that they are purely for mapping position  and color into the graphics renderer, so that's all I'm using them for currently. But I have tried to imagine how I could use shaders (and now textures) for velocity so I could optimize the calculations for how everything is moving around, and I don't see how it's possible. Same with calculating the geometries. It seems you need that hierarchical calculation (iterative computation) which you can't do in the GPU, for calculating relative positions of all the stuff relative to everything else (or just their parent). But if you could somehow batch GPU calculate that, that would be super cool.

Other physics things that might benefit from the texture system are raycasting. I can imagine having a 2D light like the sun, and it shines and creates shadows on the 2D objects from the side. Wondering what some pseudocode of OpenGL/WebGL might look like for that perhaps (if it is using shaders and textures only). Wondering if it's even possible to get it to work if it's only using shaders and textures, not completely implemented in JavaScript or the main CPU.

Another physics thing is just the motion of things (smoke billowing, wings flapping, water moving or splashing, leaves blowing in wind force, etc.). The sub question is if I can calculate these velocities (and hence, positions) directly using WebGL/OpenGL/the GPU, not simply calculating them on the CPU. Wondering if you could direct me to any resources/examples demonstrating how to do this in greater detail.

But the main question is simply if one could explain how you would go about generally implementing raycasting, velocity calculations, or other force calculations, using only shaders and textures, and/or perhaps some resources that describe how to do this. I would like to implement these in my game and there is a big architectural difference implementing them in shaders/textures vs. on the CPU, so it would be helpful to figure this out first.

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:
Getting a TileMap wrapping as a toroid on player movement [libgdx version 1.9.13 - Desktop Game]
This question seems to have been asked many times, but I have yet to find a decent solution. I want to display a map without edges, where the player moves in all directions on a 'world' which is toroidal.
I load my tiles into cells of an OrthogonalTiledMapRenderer, which I then render. This gives me a map which draws in the game window - works fine - but it has edges. The player can walk up to the edge of map.
So my questions:

How do I get a tiled map to draw without edges (I.E. no background color around edge of tile map, as per attached screen shot, which shows character about to walk off the map)

How do I then make the map toroidal - so the player moves off left map edge and is moved to right edge. Same for top/bottom. I can set the players coordinates to do this, but screen 'jumps' to the other edge.

So if the player continually presses a single up/down/left/right key, eventually they will come back to their starting position.

sentences:
How to Create Snakelike Objects I am working on a 2D action platformer in Python, though my question is a general one about creating snakelike objects which move in a variety of patterns.

I have noticed this kind of object in many 2D games. For example, this boss in Contra has snakelike arms.

And this enemy from Super Metroid clearly seems to be composed of multiple segments.

I want to create snakelike objects in my game, though I don't know where to begin or what I may need to add to my physics engine to support them.

So far, all my enemies and hazards consist of single sprites and are programmed using simple attributes like velocity, acceleration, parametric curves, etc.

Maybe I need to create a class for the segments, designate one segment instance as the leader, and update the positions of the  other segments based on the position of the segment in front of it. But how do I program different patterns of movement? Do I need to learn about so-called joints and implement them between the segments? I currently don't have them in my engine.

I know I could easily create a segmented object where each non-leader segment is moved to the previous position of the segment in front of it (like in classic Snake, described here), but I want more complex patterns than this. Sometimes I may want the object to be flailing from an anchored point, and other times I may want it to be following some pattern across the screen.

I really don't know where to begin in trying to create this kind of object and would greatly appreciate any advice.

How do you implement snakelike objects with a variety of movement patterns?

(Given the ubiquity of this kind of object in games, I was surprised that I couldn't easily find much about it online. I think a detailed write-up on it would be cool.)

sentences:
Are javascript MVC model implementations too slow for games? I wanted to implement a game in javascript with an MVC design pattern, with each entity's state stored in a model.
So for example,
In an update loop we iterate over all models and apply the velocity attribute to the position attribute of the model.
A view associated with each entity/model would then receive a position changed event,
and update the representation of the entity.
This would happen independently of the views render method being called in a requestAnimationFrame callback.
What I found though, through a possibly naive implementation, is that setting attributes of a model is simply too slow.
As much as I prefer the architecture of this code, the framerate was significantly lower.
Should I give up on using MVC for frequently updated attributes like position?
Below, I've included some code to test aspects of setting attributes of an object.
The most minimal model-like behaviour, in which an attribute is set only when the new value differs from the current,
and a "changed" update event is triggered, is about 10x slower than just setting attributes directly.
Output:

> test(1000, 100, 10)
object[key]: 163 ms
object[key] if changed: 172 ms
object[key] if changed & emit backbone event: 953 ms
Backbone.Model: 4043 ms
eventsBackboneCount: 100000

var test = function(creations, iterations, keyCount){
  var eventsBackbone = _.extend({}, Backbone.Events);
  var eventsBackboneCount = 0;
  eventsBackbone.on('all', function(){
    eventsBackboneCount = eventsBackboneCount + 1;
  });

  var looper = function(label, create, set){
    var start = (new Date()).getTime();

    var data = {};

    for(var i = 0; i < creations; i++){
      data[i] = create(i);
    }

    for(var j = 0; j < iterations; j++){
      for(var i = 0; i < creations; i++){
        var key = ''+(j % keyCount);
        set(data[i], key, Math.random());
      }
    }

    var end = (new Date()).getTime();

    console.log(''+label+': '+(end - start)+' ms');

    return data;
  };

  looper(
    'object[key]',
    function(id){
      return {};
    },
    function(datum, key, value){
      datum[key] = value;
    }
    );

  looper(
    'object[key] if changed',
    function(id){
      return {};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
     }
    }
    );

  looper(
    'object[key] if changed & emit backbone event',
    function(id){
      return {id:id};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
        eventsBackbone.trigger('changed:'+datum.id, datum, key);
     }
    }
    );

  looper(
    'Backbone.Model',
    function(id){
      return new Backbone.Model({});
    },
    function(datum, key, value){
      datum.set(key, value);
    }
    );

  console.log('eventsBackboneCount: '+eventsBackboneCount);
};

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:
Pick Up Object disapppears I'm trying to work with picking up and throwing objects. So far I've come up with a solution which does pick up the object but the same time disappears the object also. Please check to the functionality I've used.

public class pickupobject : MonoBehaviour {
     //GameObject mainCamera;
     bool carrying;
     GameObject carriedObject;
     Camera cam;
     public float distances;
     public float smooth;

     // Use this for initialization
     void Start()
     {
         cam = GameObject.Find("MainCamera").GetComponent<Camera>();
     }

     // Update is called once per frame
     void Update () {
         if(carrying)
         {
             carry(carriedObject);
         }
         else
         {
             pickup();
         }

     }

     private void pickup()
     {
         if(Input.GetKeyDown(KeyCode.E))
         {
             int x = Screen.width / 2;
             int y = Screen.height / 2;
             Ray ray = cam.ScreenPointToRay(new Vector3(x, y));
             RaycastHit hit;
             if(Physics.Raycast(ray, out hit))
             {
                 pickupable p = hit.collider.GetComponent<pickupable>();
                 if(p!=null)
                 {
                     carrying = true;
                     carriedObject = p.gameObject;
                 }
             }
         }
     }

     void carry(GameObject o)
     {
         o.GetComponent<Rigidbody>().isKinematic = true;
         o.transform.position = o.transform.position + cam.transform.position + cam.transform.forward * distances;
     }
 }

sentences:
"DirectX will only draw polygons with an [X,Y] from [-1,-1] to [1,1] and with a Z from 0 to 1.", What does this mean and how to work around it? I've been following the D3D11 tutorials on Rastertek to expand my knowledge on rendering which I will need as I want to build my own engine, as a hobby.

After finally getting a model to be rendered to the screen in 3D space, and being able to move and rotate both the camera and the model, I wanted to import custom FBX models instead, which isn't included in the tutorial. I found this tutorial online on just that, which I followed alongside the fbx SDK's documentation.

It now works to load and render FBX models, however, the vertices are quite messed up on some models, and on some, it works perfectly, then I read in the tutorial, and I quote:

"Finally, if you don’t use the shitty-bell FBX attached up at the top of this post, take note. In its default state, DirectX will only draw polygons with an [X,Y] from [-1,-1] to [1,1] and with a Z from 0 to 1. Look through the vertices in your FBX and make sure everything is in that range!"

As you can guess, that "shitty bell" works perfectly to draw. Anyway, what does it mean that it'll draw polygons within that range, also, how do I work around that when modeling?

sentences:
How do I set the Foot IK property of an animator state by code? I would like to set Foot IK to enabled via code, but I can't find how.
Which type is "Foot IK" a part of?

sentences:
Unity fails to effectively split spritesheet I'm very new to game development and I find it very difficult to split the spritesheets available at opengameart.org. All of them are kind of jumbled together without any fixed grid.
The resource I learned from always used neatly assembled sprite sheets and Unity would have no trouble in automatically splitting them. But almost all are randomly placed and Unity cannot split them.
For example:

And below is the automatic splitting in unity:

How do you guys get the sprites from such spritesheets in unity? Some guidance would be appreciated.
Thank you

sentences:
Procedurally generated 2d terrain for side scroller on Sega Genesis hardware? I'm working on the Sega Genesis that has a 8mhz Motorola 68000 CPU.

Any ideas on how to generate fast and decent 2d tile terrain for a side scroller in real time? The game would generate new columns or rows depending on the direction the player is scrolling in. The generation would have to be deterministic. The same seed value would generate the same terrain.

The style of game would be a platformer like Sonic The Hedgehog. Maximum size would be around 1024 x 1024 tiles, but smaller could also work.

A column or row doesn't have to be calculated every frame, just when a new one is needed. If the player moves 1 pixels a frame, then a new column is only needed every 8 frames.

I'm looking for algorithms that would satisfy the memory and CPU constraints of the hardware.

sentences:
Game Maker: How to check overlapping instances of the same object? I want to make sure that no two instances of obj_A are overlapping, but can't seem to figure anything out, because instance_position, instance_nearest and the like will include the instance running it, so if I had something like:

if instance_position(x,y,obj_A)!=noone
{
    with(instance_position(x,y,obj_A))
    {
        instance_destroy()
    }
}

All instances of obj_A will destroy themselves because they think they are overlapping with themselves.

sentences: .blend scenes are not showing texture in Unity I am new to Unity and Blender. I am getting a problem when importing .blend files into Unity: in Unity scenes the textures created in Blender are not showing.  But there are no problems with color. How can I fix this problem?

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

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

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

sentences:
Water Physics In top down 2D game I have been making a game like Minecraft or Terraria in which you add blocks and such to the world, and I came across this interesting debacle, the game is in a top down 2D perspective, and I would like to make it so users can add water to the world, however I would also like the water to behave like water would in the real world.

In other words, spread.

I'm guessing the code would work something like

if (space next to water block is open)
{
    \\spread to that block
}

However, this would not stop the water at that point, flooding the underpart of the map and creating little islands where the players have made things.

I could also pre-make the map, and put the water in that way, allowing the land mass of the map to go unscathed, however this prevents the players from making their own rivers and whatnot.

So my question is, do I prevent players from using water? Or do I allow them to and try to fix any disasters?

Would there be any use to code that allows me to limit the amount of water generated?

The reason water is important is due to the fact that several water vehicles are being planned, and water could be used as a resource to feed the player (dehydration etc)

EDIT:
I have worked in water as follows.
It the player will add the water like a block, at this point the water will spread in an equal outward direction.

If the water intersects ANY block it will stop and proceed with phase two, which is to move back and forth to simulate waves.

I found that through using XNA's ability to locate the side of the rectangle intersected, I can make it continue on down a length

For example:

 if (water.Intersects(something) && something.position.Y >= water.Top)
 {
     \\allow the water to continue adding to the width until the width hits something

 }

Here is an image of the partially completed function in action

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

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

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

I don't know why it crashes here.

you can download the sample code from here

sentences:
Libgdx: movement of scrolling background is not smooth even at 60fps I'm developing a game and I want to make a sliding background. The background is not scrolling smoothly. I logged the fps, but it was ok. This is my code, I don't know what I'm doing wrong, any ideas?

public class MyGdxGame implements ApplicationListener {
    private OrthographicCamera camera;
    private SpriteBatch batch;
    Texture back;
    float offset =  0f;

    FPSLogger logger = new FPSLogger();
    @Override
    public void create() {
        camera = new OrthographicCamera(320, 480);
        camera.position.set(320 / 2, 480 / 2, 0);
        camera.update();
        batch = new SpriteBatch();
        batch.setProjectionMatrix(camera.combined);
        back= new Texture(Gdx.files.internal("back.png"));
    }

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

    @Override
    public void render() {
        logger.log();
        offset +=  (400f * Gdx.graphics.getDeltaTime());
        offset = offset % 480f;
        batch.begin();
        batch.draw(back, 0, offset);
        batch.draw(back, 0, offset - 480);
        batch.end();
    }

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

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }
}

I uploaded the code to bring more information, I looked for on internet and a lot of people have the same problem, but I didn't find solution. I have almost finished the game, change the library will be a pity, any can help me? Thanks!
This is the code:
https://www.dropbox.com/sh/t26gt33wcex5izn/AAD8-yBSOztZfHe4wzDPRjjQa

sentences:
Why does this transparent shader cause objects' z-sorting to be backwards? I am making a Klondike Solitaire game, with the intent of later expanding it to encompass other solitaire games and allow deck customization. As part of this, the playing card meshes I am creating programatically are mostly opaque, but require non-alphatest transparency in order to draw the pips (rank/suit icons) correctly.

The problem is this:

The z-sorting of the cards is the exact opposite of what it's supposed to be. I know that transparency is the problem because the z-sorting works properly when it's disabled (the #pragma alpha:fade in the shader is removed):

...which obviously breaks how the cards' material is being rendered.

This is the shader I have:

Shader "Custom/Card" {
    Properties {
        _CardAtlasTex ("Card Atlas", 2D) = "white" {} // card atlas texture
        _ColorUVZone ("Colour UV Zone", Vector) = (0,0,0,0) // texture zone inside which the pips are, and so the suit colour should be used
    }
    SubShader {
        Tags { "RenderType"="Opaque" "Queue"="Geometry" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert vertex:vert alpha:fade

        sampler2D _CardAtlasTex;
        float4 _ColorUVZone;

        struct Input {
            float2 uv_CardAtlasTex;
            float3 vertexColor;
        };

        void vert (inout appdata_full v, out Input o) { // http://answers.unity3d.com/questions/923726/unity-5-standard-shader-support-for-vertex-colors.html
            UNITY_INITIALIZE_OUTPUT(Input,o);
            o.vertexColor = v.color;
        }

        void surf (Input IN, inout SurfaceOutput o) {
            half4 card = tex2D (_CardAtlasTex, IN.uv_CardAtlasTex);
            o.Albedo = card;
            o.Alpha = 1; // make it opaque to start with

            // if this is a pip, colourize it
            if (IN.uv_CardAtlasTex.x >= _ColorUVZone.x && IN.uv_CardAtlasTex.y >= _ColorUVZone.y && IN.uv_CardAtlasTex.x <= _ColorUVZone.z && IN.uv_CardAtlasTex.y <= _ColorUVZone.w) {
                o.Albedo *= IN.vertexColor; // colourized
                o.Alpha = card.a; // transparented
            }
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Things I have tried:

Changing the subshader's RenderType to things like Transparent or TransparentCutout, or removing it entirely. No effect.
Changing the subshader's Queue to things like Transparent or AlphaTest, or removing it entirely. No effect.
Adding a ZWrite On (just before the LOD 200). Does nothing because the generated code forces ZWrite Off due to having #pragma alpha:fade (as far as I can tell), and putting the line after the pragma in hopes of re-overwriting it is a syntax error.

From #3, I'm guessing that if I can somehow force ZWrite On despite the alpha:fade, it should work as expected. But chances are there's something else I'm missing that could work.

Other notes:

The problem is very consistent: the back-most cards are always drawn front-most, no matter what the shuffle is or whether the lower cards are ahead or behind.
There is no alternative to using full transparency; pips can be any colour against any background. (The face card designs don't use transparency.)
All cards use the same material, which uses a single texture atlas.

sentences:
What are the other three "game dynamics"? Seth Priebatsch recently gave a tedtalk entitled “Building the game layer on top of the world.” In it, Seth described four “game dynamics,” techniques used by game designers to make games fun and addictive. The four dynamics that Priebtsch described were:

Appointment dynamic-a dynamic in which to succeed, one must return at a predefined time to take a predetermined action. (Real life example: happy hour)
Influence and status-the ability of one player to modify the behavior of another's actions through social pressure. (Example: different color credit cards as a reflection of status)
Progression dynamic-a dynamic in which success is granularly displayed and measured through the process of completing itemized tasks. (Example: linkedin profile progress bar)
Communal discovery-a dynamic wherein an entire community is rallied to work together to solve a challenge. (Example: finding interesting content on Digg.com)

Seth explained these four game dynamics in his talk and added that his company has an additional three. Does anyone know (or have any theories) about what the other three game dynamics are?

sentences: 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: 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:
Are native code obfuscations needed to prevent piracy of Android games? Is the copyright protection and enforcement of Android apps written in Java sufficient or should I be relying on a native implementation to use machine code obfuscating techniques in order to prevent piracy of my game?

Please provide an answer with supporting examples of games which use either technique.

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:
How do you freeze your cursor in Unity? In a typical MMORPG, when I hold down the right click button and drag, the cursor disappears and stays in the same position.

How does one do that?

sentences:
What alternatives are there for creating Keyboard/Mouse controls in LWJGL? So I'm currently working my way through openGL tutorials, using LWJGL to do all my work in. However as I get to the part on how to access Keyboard and Mouse events in this library, I stumble across this little gem:

public static void poll()

Polls the keyboard for its current state. Access the polled values using the isKeyDown method. By using this method, it is possible to "miss" keyboard keys if you don't poll fast enough...
(from http://www.lwjgl.org/javadoc/org/lwjgl/input/Keyboard.html#poll())

So in order to make use of Buffered Input (as the top answer in LWJGL multiple keyboard/mouse input checks calls it) you have to use this poll() method.

This means that no matter what I do, I will miss key presses if I use LWJGL for this. I have made a test with this bit of code:

while(Keyboard.next()) {
    int character = Keyboard.getEventCharacter();
    int key = Keyboard.getEventKey();
    String charName= Keyboard.getKeyName(key);
    System.out.println(charName+""+character);
}

When pressing the buttons Z X C V at the same time, an example output is as follows: Z122
V118
X120
C0
V0
Z0

As you can see the C press and X release aren't found in the buffer. In some cases a single keystroke had both the press and release missing from the buffer.

I need this to not be the case and polling faster doesn't solve the issue at all (why would that even be a solution?). So what are the alternatives for this system?

(P.S. Yes pressing those 4 buttons at the same time was properly recorded in other applications)

sentences: Multiple inputs for Google Cardboard on iOS and Android? So far I am having a problem with having only a singular input mechanism (the magnetic trigger) for Google Cardboard games.  Are there any other options to augment this in order to have at least two or three input "buttons" or triggers for a Cardboard app or are we stuck with one?

sentences:
Presentation / input layer that communicates with server I want to learn more abot how to use some kind of presentation/input layer that communicates with server for HTML5 games.

Instead of sending all the code to the clients browser, I would like to just send a simple interface and code to handle the keyboard input. The algoritms for the game would be kept on the server and the data for the game would be sent with AJAX. I guess this is possible, but I cant find any tutorial that show some simple examples how this should be done.

Is there someone here how knows about tutorials about this or have knowledge about this and would like to share some info about this? I'm just looking for an overview of the design so that I know what to focus and seek for.

Could the algoritm be done in PHP functions that return back the data to the game? I guess there could be some bottlenecks in time delays, but I'm not going to create any fast action game.

I read some about Websockets and Node.js. But to use Node.js, I guess you have to pay to get a special server that run Node.js.

Looking forward to get some info or tips! :)

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:
Using polymorphism in an Entity-Component System without sacrificing data-oriented design I've been planning out an Entity-Component System in C++. My idea of it is most in line with the one described on this page of the entity systems wiki. To summarize, components are just structs of data, all code is in systems, and entities are just IDs shared by components.
The issue I'm having is mostly to do with how components are stored and accessed. My intent was to have a vector for each component type (which inherit a base Component class). These vectors are then stored in an unordered map, with a ComponentType (an enum) as the key. An EntityManager handles interactions with the vector, with functions like removeComponent, which takes a ComponentType and ID as arguments (which would search the unordered map and then iterate over the matching vector until finding the correct component to remove).
I specifically liked this implementation because it meant I could add new component types without having to change the way the manager accesses the vectors.
I realized that this implementation only works when utilizing polymorphism (i.e., a bunch of vector<Component*>s), since this allows them to all be stored in a single container, and operated on the same way. Unfortunately, this design results in the actual object data being scattered all over memory (even though the pointers are contiguous).
An advantage of the original structure that I chose, in my mind, was the improved cache performance offered by accessing large contiguous structures of data. But storing components in vectors is a problem, because then each vector is of a different type (ex: vector<Position>vs vector<Velocity>). This means I can't store them in one container, or use the same interface for operations on all of them. I believe I'd have to add new code to handle each new type of vector every time one was added.
I've been wracking my mind for the last few hours trying to devise a compromise. I can't seem to think of a design that would both store each type of component contiguously in data as well as allow for generic operations on those collections (ex: functions like the aforementioned removeComponent that don't require edits with each new compent type). I'm also unsure if my desire to maintain contiguity is reasonable, or if the impact on performance would actually be quite minor.

sentences: How to display a GUI text at run time in unity? I'd like to display a GUI text at run time in my game for a second, so I want to know if it's possible to add or remove a GUI label to the scene at run time?

sentences:
Correct way to project a texture with alpha and colors onto surfaces in Unity I am experimenting with Unity and wanted to project a unit circle beneath a unit and my very first naive approach was to create a child plane below the unit, assign the material to it and stretch it using the Pro Builder UV editor but it looked horrible:

In order to figure out what's wrong I read a lot of various approaches to "fix" that issue which were mostly the following:

use a higher resolution for the texture
do not use any compression
do not use a POT resolution
change the filtering option from bilinear to point
...

Eventually I figured that I have to do something completely different and that is how I stumbled upon the idea to use a shader attached to a projector game object in order to project a material. Unfortunately though it turns out the shader expects a grayscale image and only tints the projection based on a parameter. For reference this is the shader I have just copied from the web (source):

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

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

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

            float4x4 unity_Projector;
            float4x4 unity_ProjectorClip;

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

            sampler2D _ShadowTex;
            fixed4 _Color;
            float _Attenuation;

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

With that shader I was able to render the following effect:

Since I have no experience with shaders at all I just blatantly copy & pasted it and do not know (yet) how to customize them or even write custom ones in the first place.

Assuming my approach to combine a projector with such a shader is the way to go, I'd like to know whether there is any shader you can share that allows me to project an unlit texture with transparency and its own color such as the following example:

sentences:
Why is my counter not incrementing when OnTriggerEnter is called? I have a script that handles the destruction of game objects based on what they collide with.  I am trying to count the number of objects destroyed when they collide with specific objects.  However, this is not happening.  Instead, the counter is getting to "1" and no longer counting.  Can anyone explain why?

public class Destroy:MonoBehaviour{
    public GameObject asteroid_explosion;
    public GameObject ship_explosion;
    private int destroy_count = 0;

    void OnTriggerEnter(Collider other){
        if(other.tag == "Boundary"){
            return;
        }

        if(other.tag == "Bolt"){
            destroy_count = destroy_count + 1;
            Instantiate(asteroid_explosion, transform.position, transform.rotation);
            Debug.Log(destroy_count);
        }

        if(other.tag == "Player"){
            destroy_count = destroy_count + 1;
            Instantiate(ship_explosion, other.transform.position, other.transform.rotation);
        }
        Destroy(other.gameObject);
        Destroy(gameObject);
    }
}

sentences:
Unity3d turn based navmesh algorithm I am developing a game in Unity3d.

In this game, 2 teams will fight without any human interaction. The fight results must be always the same, if the same teams are the same. This way, I must reproduce the same fight in many devices, getting the same results in each device.

The map where the fight happens is a 3d environment, so, my soldiers can move in any direction. And the soldiers cannot walk in the same space of another soldier, so I need an agent avoidance algorithm.

I am having some trouble to find a solution to the problem above. To achieve the 'always the same results' I am treating this fight as Turn Based Strategy game, with little fixed time intervals between the turns.

To calculate the pathfind of the soldiers, I am using the Unity3d navmesh framework. And then I move manually my agents according to the 'NavMeshAgent' 'steeringTarget' property.

But this method doesn't cover the obstacle avoidance algorithm, and my agents overlaps.

So, I am looking for a solution to my problems, It should be a manual obstacle avoidance algorithm, or a way to unity navmesh work in fixed time intervals, or a completely new approach to my path-finding problems.

sentences:
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:
Poor performance in android when running APK, runs fine in browser I have created a small game project in HTML5 using Phaser engine (tried both 1.1.5 and 1.1.6). Then to port it to mobile platform, used Phonegap/Cordova for Windows Phone 8, Android and iOS.

In my game, there are around 10 elements, which get animated (moving from point a to point b and some rotation at same time). On iOS and Windows Phone 8, I didn't face any issue.

But with Android, performance is unacceptable. On the other hand, if I run my game via device browser, it run smooth without any lag. But compiled APK runs very jerky and elements move very slow & in flickering manner.

I have checked android hardware acceleration flag is set to "true" in manifest file. Tried changing it false too, but that didn't reflected any change in performance.

I have checked same on Android 4.2 on Samsung S2 device and on that performance is better. But on Asus Nexus Tab 7 (running Android 4.4) its very jerky, while the OS and Device both are latest. Also checked on another device running Android 4.3 (Samsung Galaxy Grand Duos) and on that too performance is not good at all.

In my game tried both WebGL / Canvas rendering (Phaser engine uses Pixi.js, which fallback to 2d canvas if WebGL isn't supported), but no change. Similarly with easeljs.

If anyone else faced similar issue and can suggest any way to get native like performance. I checked cocoonjs examples and while they seems smooth and acceptable, I can't go for that route.

sentences:
using Playerprefs on Android Mobile Platform I have a question about playerprefs on my android mobile game not initializing properly. I have already pre-set my playerprefs data on a variable with a value of 3. In my play mode on unity the value is showing 3 through the textmesh that I have it scripted on. But when I install and test it on my android mobile device it is 0. can someone help how to properly initialize my playerprefs data to the right value on android platform?

 public static Game GM;
 int maxAntiBody;
 public TextMeshProUGUI antibodyTexMesh;

void Start () {
    if (GM == null)
    {
        GM = this;
    }
 maxAntiBody = PlayerPrefs.GetInt("MaxAntiBody");
 antibodyTexMesh.text = maxAntibody.toString();
}

void Update () {
debugging();
}

//I use this method for setting or resetting my desired value for the playerprefs data I'm working with. In this case I choose 3 as a value.
void debugging() {
    if (Input.GetKeyDown(KeyCode.M))
    {

        PlayerPrefs.SetInt("MaxAntiBody", plus++);
        Debug.Log("max anti body value is : " + PlayerPrefs.GetInt("MaxAntiBody"));
    }
    else if (Input.GetKeyDown(KeyCode.R))
    {
        plus = 0;
        PlayerPrefs.SetInt("MaxAntiBody", plus);
        Debug.Log("max anti body is now reseted to : " + PlayerPrefs.GetInt("MaxAntiBody"));
    }
}

sentences:
Passing an SDL KeyboardState(Uint8*) to Lua I'm working on my first big project and I've decided to integrate Lua with my C++ framework. Everything's worked out so far, but the only way I've managed to pass the SDL_GetKeyboardState(NULL) array to Lua is by building a Lua table manually.

void passKeyboard(const Uint8* keyboard){
    std::map<std::string,std::string> kmap;
    kmap.clear();
    kmap["UP"]=toString(keyboard[SDL_GetScancodeFromKey(SDLK_UP)]);
    kmap["DOWN"]=toString(keyboard[SDL_GetScancodeFromKey(SDLK_DOWN)]);
    kmap["LEFT"]=toString(keyboard[SDL_GetScancodeFromKey(SDLK_LEFT)]);
    kmap["RIGHT"]=toString(keyboard[SDL_GetScancodeFromKey(SDLK_RIGHT)]);
    ...
    vbind_SetTable("keyboard",kmap);
}

Now, the code works and is reasonably fast for my purposes, but it's undeniably ugly. I even feel dirty looking at it. Is there any way I could to this more elegantly?

For reference, vbind.h:

void vbind_SetTable(const std::string &name,std::map<std::string,std::string> &t){
    lua_newtable(L);
    for(std::map<std::string,std::string>::iterator it=t.begin();it!=t.end();it++){
        lua_pushstring(L,it->first.c_str());
        std::string value=it->second;
        const char* p=value.c_str();
        char* end;
        long t=strtol(value.c_str(),&end,10);
        if(p!=end&&errno!=ERANGE){
            lua_pushnumber(L,t);
        }
        else{
            lua_pushstring(L,value.c_str());
        }
        lua_settable(L,-3);
    }
    lua_setglobal(L,name.c_str());
}

sentences: Line segment and Sphere intersect How can I check it if a line3D/ or ray is intersecting a sphere?

sentences:
Why is creating my sprites so slow? My 2D Unity game has tiles and layers. It creates one game object per tile, anywhere from 100 to 10,000. To create 3,000 game objects takes 68 msec, which is just fine.

But setting up the sprite and location takes 5,000 msec, or nearly 2 msec per sprite. This is a problem. Here is the code for setting up each tile.

   var sprite = _main.GetSprite(LevelIndex);  // pre-computed table of sprites
   _renderer.sprite = sprite;  // the sprite renderer for the tile
   if (sprite != null) {
     var cursize = _renderer.sprite.bounds.size;
     var scale = Math.Max(Size.x / cursize.x, Size.y / cursize.y);
     transform.localScale = new Vector3(scale, scale, 0);
   }

How can that code take 2 msec? What's going on?

The sprite size is 80x80. Is this a problem?

Once it's all set up it renders at 100 fps easily. So why is the setup so slow, and what can I do about it?

Yes, I considered using a TileMap. It's not easy to see how to create one in fully procedural code, but at the heart of it is the Tile class, which has a GameObject and a Sprite. If I implement my own Tile class it's going to have code that looks a lot like the above, and (after a lot of work) most likely perform exactly the same.

Since Tile and TileMap are just layers over standard Unity infrastructure, then if they do have a way to perform much faster, I should be able to apply the same technique to my situation and get the same performance.

sentences:
Design pattern for allowing components to interact with main state machine I am making a game using Unity in which I have a main game state machine that controls the current game scenario.

My question is how do I handle communication between different components of the game and the state machine in a way that keeps the code decoupled and scaleable and so that the code doesn't turn into a spaghetti later on.

What I have thought so far

Make the state machine a global in a static class or vice versa and allow components to directly call upon its methods
Make a global event dispatcher system allowing the FSM to subscribe to necessary events like changeState() etc and fire them from the component classes with the required data
Use the service Locator pattern to provide the FSM to locator and just use it from anywhere

Which one of these will be suited more for the application keeping it scaleable and reusable no matter how big the code grows?

Or is there any other better way of communication that I am missing out on?

sentences:
FindNextValidTechnique fails My effect file compiles successfully, but FindNextValidTechnique fails.

Technique part of the shader:

technique Diffuse
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VertexShaderMain();
        PixelShader = compile ps_2_0 PixelShaderMain();
    }
}

I try to get the first valid technique after compilation:

pEffect->FindNextValidTechnique(NULL, pValidTechnique);

This returns some minus value which doesn't go along with D3D_OK.

I've used other flags than D3DCREATE_HARDWARE_VERTEXPROCESSING to test, but no result with them either.

UPDATE

I've read in documentation that, "Applying Compiler Flags or Assembler Flags to the incorrect API will fail shader validation.", but I'm not sure this applies to the compile time validation or afterwards. I have no problem in compile.

I compile with these flags:

D3DXSHADER_DEBUG |
D3DXSHADER_NO_PRESHADER |
D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT |
D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT

sentences:
Stop Lerp at relative location? In my Unity 2D platformer, I'm trying to move the camera down a bit when the character is crouching but not moving. I've done this with the following:

cameraPosition = mainCamera.transform.position.y;
cameraPosition = Mathf.Lerp(cameraPosition, cameraPosition - 0.8f, 3 * Time.deltaTime);
mainCamera.transform.position = new Vector3(mainCamera.transform.position.x, cameraPosition, mainCamera.transform.position.z);

This works, but it's causing the camera's y value to decrease continuously rather than just 0.8f, because cameraPosition is assigned a new value every frame. But cameraPosition has to be relative because its location depends on the player's location, so I can't figure out how else to write it.

sentences:
How do I use Unity's OnPlayerConnected method? https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnPlayerConnected.html

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

public class SendData : MonoBehaviour {

    void OnPlayerConnected (NetworkPlayer player) {
        Debug.Log ("A player connected!");
    }

}

This code, surprisingly, doesn't work!

Expected: The server prints "A player connected!" in the Unity editor debug console.

What happens: Nothing is printed. It doesn't matter if I use print() or Debug.Log().

This script is applied to a standard object in the scene. It has a NetworkIdentity.

I really don't know what else to try. The Unity documentation is very short and gives an example very similar to this. My code should be even simpler than Unity's example but it doesn't work.

sentences:
Texture won't appear using a vector of unique pointers of an Object I am working on a top down 2d shooter game. I have a player Sprite and a Bullet class. I made a vector of pointers to Bullet to store the bullets. Here is the code of the vector and the functions I’m using:

    std::vector<std::unique_ptr<Bullet>> b;

    while(win.isOpen)
    {
    //Getting Key Press
    if (Keyboard::isKeyPressed(Keyboard::Space))
    {
        space = true;
    }
    else
    {
        space = false;
    }
    if (space)
    {
        Bullet b1;
        b1.setPos(player.getPosition());
        b.push_back(std::make_unique<Bullet>(b1));
    }

    for (auto& it : b)
    {
        //Keep Updating
        it->update();
    }

    //Bullet out of Screen
    for (int i = 0; i < b.size(); i++)
    {
        if (b[i]->getPos().y < 0.0f)
        {
            b.erase(b.begin() + i);
            i--;
        }
    }

    //Drawing Bullet
    for (auto& i : b)
    {
        win.draw(i->getSprite());
    }
     }

The game runs fine but the bullet’s texture won’t load. I’m assuming it has something to do with the vector but I don’t know how to solve it.
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();
void setPos(Vector2f pos);
void update();
Sprite& getSprite();
Vector2f getPos();
};

Cpp File:
     #include "pch.h"
     #include "Bullet.h"
     #include

Bullet::Bullet()
{
//Setting Texture
if (!t.loadFromFile("Graphics/bullet.png"))
{
    std::cout << "Bullet Texture Failed to Load\n";
}
else
{
    t.loadFromFile("Graphics/bullet.png");
    bullet.setTexture(t);
}

}

void Bullet::setPos(Vector2f pos)
{
//Setting Position
this->pos = pos;
bullet.setPosition(this->pos);
}

void Bullet::update()
{
pos = bullet.getPosition();

bullet.move(0.0f, -4.0f);

}

Sprite& Bullet::getSprite()
{
return bullet;
}

Vector2f Bullet::getPos()
{
return pos;
}

sentences:
Unity3D -- WAV plays an octave too low on Android I have generated a synthetic 'concert pitch A' tone from sinewaves.

It plays properly on OS X player, and on my Android device.

Now I record myself singing a 'concert pitch A' into the microphone as a MONO .WAV -- foo.wav.

In Unity I add foo.wav to my resources, making sure to turn off "is 3D sound" in the settings panel.

I then create a script that loads it into an audioclip and extracts the contents into a float buffer:

    AudioSettings.outputSampleRate = 44100; // just to be safe

    AudioClip phonemeClip = Resources.Load( filename ) as AudioClip;

    float [] phonemeBuf = new float[ phonemeClip.samples * phonemeClip.channels ];

    phonemeClip.GetData( phonemeBuf, 0 );

I then add this sound to my synthetic tone, 30000 samples in (so nearly 1 second):

    float PHONEME_VOL = 0.3f;
    int OFFSET = 30000;

    for(int i=0; i<phonemeBuf.Length; i++)
        if( OFFSET+i < buf.Length )
            buf[OFFSET+i] += phonemeBuf[i] * PHONEME_VOL;

On OSX player this works perfectly.

However on my android device the original synthetic tone plays correctly whereas the added foo.wav appears to be exactly an octave low.

What might be causing this?

I suspect it may be converting the clip into a stereo clip, with 0 for the right channel. That would interpolate the resultant float buffer with zeros, which would certainly take it down octave.

But I can't see how to address this problem.

sentences: How do I change the material of an object with Script in Unity? I was making a game with Unity and I want to change an object's material using UnityScript when the player collects 5 collectables that I made. The collectables get stored in an int variable called Score.

sentences:
What is the best collision detection method or algorithm for a 2d platformer? I'm working of a 2d platformer.
It's a preety simple game, but the ground is flat and it looks boring. I did the collision detection for it and it's all working when the boxes are axis aligned, but I want to add slopes so it's more interesting. I researched a lot and I found the separating axis theorem but I read that it is not good for platformers because it's not side specific. So, my question is: what is the best way to detect collision with curves and slopes? I use javascript if you want to provide some code.
Thanks in advance!

sentences:
Switching from Arcade to P2 physics in Phaser so i just started using phaser for test

i've followed the tutorial in the phaser website  (making-your-first-phaser-game) everything is clear no problem .

but since i've making a pool game i need rotation on collision so i've switched to P2 ... suddenly everything moves and collides!

here is the live code

http://199.26.84.223/

i have 2 groups

sides ( sides of table ) and  balls

1 - i want sides to be immovable so i 've added

side.body.immovable = true;

to each object like in arcade ... it doesn't work ... how can i make objects immovable in p2 ?

    game.physics.startSystem(Phaser.Physics.P2JS);

    sides = game.add.physicsGroup(Phaser.Physics.P2JS);
    side = sides.create(0,0 , 'sideA');
    side.body.immovable = true;

2 - i dont want my player to collide with red balls only with white ball

so in arcade we had to define each collision otherwise they wouldn't collide

game.physics.arcade.collide(player , wball );

but here there is no defining everything collides with everything !

how can i make exception in ocllision so my player wouldn't collides with anything other then white ball (Wball) ?

3 - what happend to overlap ? or collide call back functions ? i need to add some holes to my table and make the balls dissapir on collide or overlap ... in the arcade i had it like this

game.physics.arcade.overlap( balls , holes ,  killBall  , null, this);
function killBall  ( b , h  ){ b.kill() ; }

sentences:
Make an object rotate from 0 to 360 degrees by using the trigger button on the htc vive controller Hello I would like to be able to make a sphere that is attached to a cube rotate  from 0 to 360 degrees by pressing the trigger on the vive controller. As the sphere rotates I want it to be able to stop at any of the degrees in rotation. For example I press the trigger and the sphere starts rotating but I can stop the rotating at 190 degrees or 10 degrees or 359 degrees etc... I would appreciate any suggestions.
Best Regards,
Rafman27

sentences:
Procedural generation for a text adventure game I'm working on a text adventure game written in Python and I am at the point where I need to implement procedural generation for the map. As the user moves around, spots are generated, so the entire map is not generated at once but rather it's generated as the user gets closer. For example, the user begins at the position (0, 0) and so the spots generated in the beginning of the game are the eight spots/squares surrounding (0, 0) and of course (0, 0) itself.

I'm have trouble finding a simple way to decide if a "spot" or square is plains, forest, beach, ocean, mountains, etc. I don't want it to be totally random, I want there to be some cogency.

Any help would be appreciated. Thank you.

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:
Simulation of a two-masses connected by a rod 2D system I'm working on a multitouch-based interface and I want to add some physical behavior to gestures (pan, zoom and rotation). I thought model the system like that:

When a touch starts, a point mass is created.
As the finger moves, I calculate it's velocity vector.
When the touch ends, I suppose the mass is released and starts to move freely.

My problem comes when I have two masses (I don't need more than two masses to model this system):

The masses should act as if they were connected by a massless rod and, optional, they can slide along the rod with some coefficient of friction.

I attach a picture to explain the thing better.

I forgot almost all the physics I knew at college and now I'm a developer.

I know that at time t the masses have a position (x, y), a velocity and one or more forces or accelerations acting on it. And I want to know those values at time t+dt.

I would like to have some advice or approach to this problem. It's not about integrators or numerical analysis. My main doubt is about the rod constraint (keep the distance between masses) and the rotation movement.

sentences:
Why do I get errors cs1502 and cs1503 in my Destroy object script? I have a script that lets the player place blocks (like in Minecraft), but I also want to be able to destroy those blocks. I keep getting error messages cs1502 and cs1503.

Could anyone take a look at the script and tell me what is wrong?

using UnityEngine;
using System.Collections;

public class TestForCube : MonoBehaviour {

  Ray ray;
  RaycastHit hit;

  // Use this for initialization
  void Start () {
  }

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

    ray = Camera.main.ScreenPointToRay (Input.mousePosition);

    if (Physics.Raycast (ray, out hit)) {

      if (Input.GetKeyDown (KeyCode.Mouse0)) {

        Vector3 position = hit.transform.position + hit.normal ;
        Quaternion rotation =  Quaternion.FromToRotation( Vector3.up , hit.normal );
        GameObject Placement = GameObject.CreatePrimitive( PrimitiveType.Cube );
        Placement.transform.position = position;
        Placement.transform.rotation = rotation;
      }

      {
        if (Physics.Raycast (ray, out hit)) {
          if (Input.GetKeyDown (KeyCode.Mouse1)) {
            DestroyObject( PrimitiveType.Cube);
          }
        }
      }
    }
  }
}

sentences:
How to make a 90 degree rotation happen over time I'm trying to take a RotateAround function and make it happen over time. I've been tinkering with Quaternions to try and get it to work but I can't quite figure it out.

This is the code:

public class RotateCamera : MonoBehaviour {

public Vector3 rotatePoint = new Vector3(0,0,5);

public void RotateLeft ()
{
    transform.RotateAround (rotatePoint, Vector3.up, 90);
}

public void RotateRight ()
{
    transform.RotateAround (rotatePoint, Vector3.up, -90);
}

I'm applying each void to a button, and this works like a Final Fantasy Tactics camera - rotate an isometric camera 90 degrees. But it happens instantly, and I want to make it happen over time, like a second or a half a second. I'm super new to programming and I can't find any guides on this or any other posts using google, so I'm asking on here as a last resort. Thanks for any help.

sentences:
Inversion of control in Unity? I am semi-experienced .NET developer who has just began working with Unity. I am trying to decide on how to make IoC work in Unity 4.X ( I have not yet tested anything), and I wonder what are the good ways of achieving it.

This post and its answers states that Ninject won't work with Unity, however it is old. Is it still true? If yes, what are other means of achieving IoC in Unity ?

Edit 1 : I am targeting mainly Windows platform. So I don't need platform interoperability, I just need it to work.

sentences:
Using QuadTree for Procedural Generation so I've been trying to start a new project that focuses on procedural room generation similar to what is seen in Binding of Isaac.

I plan to have the code use a QuadTree to help determine where rooms should be placed. Each node in the quad tree represents any of the possible 4 directions the next room can be placed.

The problem is this. I'm not sure where to start when trying to implement the QTree and haven't found good resources on the topic. Most implementations of QuadTrees in a procedural generation context use them for partitioning spaces and placing rooms within the partitioned spaces. Not sure if that's what I want to achieve. I'm also unsure of weather I should be going in this direction or if there's a more optimal solution?

sentences:
How can I get animated bone's transformation in LibGDX? I am trying to get transformation from a bone, but i can't, I exported just a animated armature with just a bone from blender, then I converted to .g3dj, so I just need the bone transformations so that I can get it value for some effects like moving sprites and other things.

any ways to read just transformation in "render()" method, seems bones animation does not effect on bone's value!
I want to use just openGL ES 1.x.

sentences:
How 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: 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:
convert gl_Position into screen coordinates Pretty simple question I think. I need to convert model space coordinates into screen space coordinates for a special shader effect.
I am of course able to just convert them into gl_Position coordinates by just multplyng them with the wold view and projection matrices.
Unfortunately though, thats where I am at my wits end. Since opengl somehow converts normal vertices them into screen coordinates itself, and I need a few extra vertices for a special effect, I have no idea how to achieve this.
So does anybody have any idea how I convert model space coordinates into gl_Fragcoord screen coordinates?
I basicly want to be able to give the vertex shader a bunch of model space coordinates and have it spit out where exactly they are on the screen if they were rendered.

sentences:
Algorithm for a smooth weather transitions in game weather system I've been slowly learning c++ and building up a codebase intending to create a simple first person role playing game.

I've coded a time management tool to track time elapsed in game, an inventory and container system, and some other bits. I have been considering a basic system to change the weather in game.

I haven't actually done code towards it yet but the simplest weather solution (not including rendering) would be a very very crude state system.

enum WEATHER_TYPES { FINE, CLOUDY, RAINY, STORM }
int min_duration = 2;   // 2 hours
int max_duration = 5;   // 5 hours

int current_duration;
if(current_duration >= min_duration && current_duration < max_duration) {
    float r = my_rand_range_float(0.f,1.f);
    if(r <= 0.25 )
        changeWeather();

That is obviously a really rough approximation and it would result in very harsh changes in the weather. It could instantly go from FINE to STORM which is very unrealistic.

I don't want a system where it models the weather based on realistic parameters. I am happy with a relatively simple randomly changing system to begin with. (Although it is worth noting that my timemanager class is tracking seasons as well as generating temperatures for the days)

I am thinking along the lines of having a WeatherManager class to keep track of the current weather state and decide when to transition between them. Each "Weather Type" would become it's own class that can be updated when it is in use. Each weather class would have a "starting" state where it would be possible to transition into the next weather state from the previous.

For example if changing from FINE to RAINY then during the "starting" state of the RAINY weather it would slowly build up the cloud layers, start the rain particle system with a small number of particles and build up to the desired number. The idea is to provide a bit of a build up.

It would also need to be able to do the reverse in the case of changing from RAINY to FINE.

I don't really know how others have implemented weather systems in game. Am I on the right track in my thinking in this regards and can anyone point me towards some resources to learn about implementing weather systems for a game?

sentences:
How can I extend the FindObjectsByTag to filter multiple parents of the found objects? private List<GameObject> FindDoors(string[] parents)
    {
        GameObject[] doorsLeft = GameObject.FindGameObjectsWithTag(c_doorLeft);
        GameObject[] doorsRight = GameObject.FindGameObjectsWithTag(c_doorRight);

        List<GameObject> allDoors = doorsLeft.Union(doorsRight).ToList();

        List<GameObject> toRemove = new List<GameObject>();
        for (int i = 0; i < allDoors.Count; i++)
        {
            for (int x = 0; x < parents.Length; x++)
            {
                if (allDoors[i].transform.parent.name != parents[x])
                {
                    toRemove.Add(allDoors[i]);
                }
            }
        }
        foreach (var it in toRemove)
        {
            allDoors.Remove(it);
        }

        foreach (GameObject door in allDoors)
        {
            Debug.Log("Door Parent : " + door.transform.parent);
        }

        return allDoors;
    }

Usage :

var allDoors = FindDoors(new string[]{ "Wall_Door_Long_01", "Wall_Door_Long_02" });

But in the function FindDoors the return allDoors is empty.
I think the problem is at this IF :

if (allDoors[i].transform.parent.name != parents[x])

Once it's Wall_Door_Long_01 so if it's Wall_Door_Long_01 it will not remove the item but next it's Wall_Door_Long_02 so now the it's true and will remove the even if the parent name is Wall_Door_Long_01 and same if it's Wall_Door_Long_02

And then in the end it will remove all the items.
But I want it to remove only doors that the parents of them is not Wall_Door_Long_01 and not Wall_Door_Long_02

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:
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:
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:
Rotate 3D Model from a custom position I have a 3D Model like above in which i want to rotate it from a given location(pointed in red) but I can only rotate it from the middle. How can I rotate it from a custom point.

Edit:

I successfully able to rotate the model from the below position by getting the radius of the model and applying it to the world matrix

        Vector3 point = new Vector3(-radius, 0, 0);
        world = Matrix.CreateTranslation(-radius, 0, 0);

But now I cannot change the position of the object and it always centered in middle of the screen. I think that's because i applied the above code. How can I place it anywhere I want?

sentences:
Blending and shadowmapping? I am trying to implement shadow mapping, and currently I have 2 point lights and 1 global ambient light source and my rendering loop looks roughly like this (the details are not relevant):

void OpenGLRenderer::DrawRenderables(const uint32_t windowWidth, const uint32_t windowHeight, const RenderQueue& renderQueue, const RenderableLighting& lighting)
{
    GLCALL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));

    for (uint32_t lightIndex = 0; lightIndex < lighting.mUsedLights; lightIndex++)
    {
        if (lighting.mLights[lightIndex].mLightType == LightType::LIGHT_TYPE_POINT)
        {
            GLCALL(glUseProgram(mShadowMapProgram.mProgramHandle));
            GLCALL(glBindFramebuffer(GL_FRAMEBUFFER, mFrameBuffer));
            GLCALL(glViewport(0, 0, mShadowTextureWidth, mShadowTextureHeight));
            for (uint32_t faceNum = 0; faceNum < CUBEMAP_NUM_FACES; faceNum++)
            {
                GLCALL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + faceNum, mShadowMapTexture, 0));
                GLCALL(glClear(GL_DEPTH_BUFFER_BIT));

                ShadowPass();
            }
            GLCALL(glBindFramebuffer(GL_FRAMEBUFFER, 0));

        }

        // final pass
        GLCALL(glUseProgram(mDefaultProgram.mProgramHandle));
        GLCALL(glViewport(0, 0, (GLsizei)windowWidth, (GLsizei)windowHeight));

        // enable blending, how?

        ShadingPass();
    }

    GLCALL(glUseProgram(0));
}

The problem is the screen will only be shown with last light in the light list, for example the ambient light and therefore ignoring the effects of the point lights. I assume I somehow needs to do blending but I was wondering how and where is this done?

Thanks

sentences:
ios screen design -> how to target multiple devices I am writing an IOS Game, landscape only and I am having a conceptual issue with my artwork. The screens are all different sizes. Retina, non-retina as well.

Non Retina ipads + ipad mini is 1024 x 768.

Retina ipads are 2048 x 1536.

So how big do I draw my art? What concept am I messing up? Any screen templates I can download to help me. i.e, learn the boundaries, etc?

sentences:
2d side scroller slope physics and collisions In old 2d games such as double dragon, streets of rage etc. where the player could move “up and down” on the y-axis to give an illusion of depth (as opposed to something like Mario) how were slopes and stairs handled along different points on the y-axis to give the appearance of still moving in a straight line?

For instance in the above picture would you set collision masks where the green lines are? Then imagine the characters are the red and blue lines respectively, how would you handle them in effect being moved “down” by gravity when in fact there isn’t really any gravity? For the top line I assumed when it hit the green line, rather then stopping or bouncing back on the x-axis you’d just nudge them down and continue the x movement?

I understand how this could be completed in 3D but I’m perplexed how this would’ve been achieved in purely 2d environments. Or maybe I’m imagining slopes/stairs in these old games...

I’m working in SpriteKit, so any ideas specific to that would be great but just understanding how this was accomplished theoretically in the first instance would be great.

Thanks

edit - after some thinking I don't think my 'collision' theory would work going down the slope for the blue line as it wouldn't be colliding unless it came off it's "straight" path, and also the problem would be reversed when going 'up' the slope.

so for instance in the above image where the characters are moving up the slope the other way I'm curious how this would have been handled? My thoughts now are, would the darker grey area with the "1" on it, actually be an entire entity itself or a collision mask? You'd then work out based on the characters "Y entry" point on to it (either at the top or the bottom) and based on their direction, where their 'Y' point should then be?

sentences:
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:
Alternative to Rotation degrees or clock facing to describe cards angle I'm working on some ideas for a system and hit a minor roadblock.

I would like to identify the angle of a card placed on a playing field. Besides a clock facing identification (3:00 would be a landscape position) or degrees (90 degrees would be a landscape position) are there any other terms that can be used to describe this angle?

I would like to find a different terminology for telling players (in the rules) to turn their cards to a landscape position, or portrait, etc. This may be unanswerable, but I could swear I have heard someone refer to an angle in an engineering environment that wasn't degrees or clock facings.

sentences:
.isGrounded is not working reliably New to Unity and C#, though, I got the code from the official doc page for Character Controller and thought that should work by default.
When pressing the Jump button here it doesn't always work. When checking if the player is grounded the variable groundedPlayer not always provides true when idle/not moving. Instead, the value is constantly changing between true and false.
Below is my current code which was modified a little:
public class PlayerController : MonoBehaviour
{
  private CharacterController controller;
  private Vector3 playerVelocity;
  private bool groundedPlayer;
  private float jumpHeight = 1.0f;
  private float gravityValue = -9.81f;

  private void Start()
  {
    controller = gameObject.AddComponent<CharacterController>();
  }

  void Update()
  {
    groundedPlayer = controller.isGrounded;
    //this will constantly return both false and true while idle
    print(groundedPlayer + ", " + playerVelocity + ", " + gameObject.transform.position.y.ToString("f8"));
    if (groundedPlayer && playerVelocity.y < 0)
    {
      playerVelocity.y = 0f;
    }

    if (Input.GetButtonDown("Jump") && groundedPlayer)
    {
      playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
    }

    playerVelocity.y += gravityValue * Time.deltaTime;

    controller.Move(playerVelocity * Time.deltaTime);
  }

}

It's just that I feel dumb since basic jumping is this difficult to implement for me. I feel like I'm missing something very obvious. I found 1 working solution for me which is implementing coyote time, but it looks like a workaround and might provide more glitches in the future. I also could try working on creating my own character controller, though that's a whole different field.
Anyone had this issue before? How did you fix it?

sentences:
In regards to real time turn based games, where should the turn handler be? I'm currently developing a pool-like browser game. I'm stuck on where should I handle the turn changing, timer, etc.
Currently, turn timer (i.e. 15 seconds left to do action, then turn will change) is handled by the server. But the changing of turns itself is handled by the client (the browser itself).
Now in my current setup, whenever a player leaves window focus, the game gets out of sync. Should I migrate the turn change handling to the server instead?

sentences:
Queueing with Unity's NavMeshAgent I have created a strategy game where the units use Unity's NavAgent pathfinding and flocking algorithms.  This works well.  However, I need to add queueing so that units will queue sensibly.  This works most of the time, but it isn't perfect and I want to know if there's a better way of doing it.

My first draft was to simply check which unit is closest to the destination, but this caused issues because a group might be navigating around an obstacle and the unit closest is at the back of the queue... so the whole group stops.

Second draft checked the distance to destination based upon the length of the path each unit had to take.  This works far more often, but sometimes still has issues.  Sometimes the same problem happens, but much less often.  The one who is supposed to be moving stops, and so the entire group stops.

There's also a problem I've noticed, where the waiting units could sometimes benefit from rotating, even if they shouldn't be moving.  Unfortunately they sometimes get stuck and will wait before they can move, to rotate.  If they could rotate when forbidden from moving it'd help considerably too.

What I need to know...

How can I make Unity NavAgent's queue, so that they will wait for the other agents closest to the destination to move first?
How can I ensure that this does not stop agents from rotating while in a queue (rotating may move them into a better position in the queue).

Code:

Unit Movement Function

private void Movement()
{
    // Unit is moving.
    if (moveVectors.Count > 0)
    {
        navAgent.isStopped = false;

        // Check for whether to wait in queue.
        Vector3 nextVector = transform.position;
                nextVector += transform.forward * speed * Time.deltaTime;

        foreach (Unit unit in list)
        {
            if (unit != this &&
                unit.moveVectors.Count > 0 &&
                Vector3.Distance(unit.transform.position, nextVector) <= (unit.footprint + footprint) &&
                PathDistance(unit) < PathDistance(this))
            {
                navAgent.isStopped = true;
                return;
            }
        }
    }
}

There's a bit more to Movement, but it's not relevant so we'll ignore it for now.

PathDistance Function

private float PathDistance(Unit unit)
{
    Vector3 startPosition = unit.transform.position;
    Vector3 endPosition = unit.moveVector;
    Vector3 lastPosition = startPosition;
    Vector3[] path = unit.navAgent.path.corners;
    float distance = 0;

    for (int i = 0; i < path.Length; i++)
    {
        distance += Vector3.Distance(lastPosition, path[i]);
        lastPosition = path[i];
    }

    distance += Vector3.Distance(lastPosition, endPosition);
    return distance;
}

Is there a better way of achieving the result I want?

sentences:
How to support all iOS device screen sizes / resolutions in my game I made this game. Right now the game supports all iOS devices except iPhone 5.

The definition of each level of the game is kept in a plist. The creation of each level is done through a graphical level editor. Each device family has its own plists. So, right now the game has 100 levels and 200 plists; 100 plists for the iPhone family and 100 plists for the iPad family.

In order to support the iPhone 5 I need to create 100 new plists and adjust the plists accordingly, which is time consuming, not to mention the creation of new levels...

The editor for creating and editing the levels is solely based on the manipulation of UIViews that describe the game elements. So, this is the code that I wrote to save and restore the state of each UIView in one level of the game.

- (void)encodeWithCoder:(NSCoder *)aCoder {
    // Save the screen size of the device that the view was saved on
    [aCoder encodeCGSize:self.gameView.bounds.size forKey:@"saveDeviceGameViewSize"];

    // ****************
    // ALL properties are saved in normalized coords
    // ****************

    // Save the center of the view
    CGPoint normCenter = CGPointMake(self.center.x / self.gameView.bounds.size.width, self.center.y / self.gameView.bounds.size.height);
    [aCoder encodeCGPoint:normCenter forKey:@"center"];

     // I rely on view bounds NOT frame
    CGRect normBounds = CGRectMake(0, 0, self.bounds.size.width / self.gameView.bounds.size.width, self.bounds.size.height / self.gameView.bounds.size.height);
    [aCoder encodeCGRect:normBounds forKey:@"bounds"];

     // Here I save the transformation of the view, it has ONLY rotation info, not translation or scalings
    [aCoder encodeCGAffineTransform:self.transform forKey:@"transform"];
}

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {

        // Restore the screen size of the device that the view was saved on
        saveDeviceGameViewSize = [aDecoder decodeCGSizeForKey:@"saveDeviceGameViewSize"];

        // Adjust the view center
        CGPoint tmpCenter = [aDecoder decodeCGPointForKey:@"center"];
        tmpCenter.x *= self.gameView.bounds.size.width;
        tmpCenter.y *= self.gameView.bounds.size.height;
        self.center = tmpCenter;

        // Restore the transform
        self.transform = [aDecoder decodeCGAffineTransformForKey:@"transform"];

        // Restore the bounds
        CGRect tmpBounds = [aDecoder decodeCGRectForKey:@"bounds"];
        CGFloat ratio = self.gameView.bounds.size.height / saveDeviceGameViewSize.height;
        tmpBounds.size.width *= (saveDeviceGameViewSize.width * ratio);
        tmpBounds.size.height *= self.gameView.bounds.size.height;
        self.bounds = tmpBounds;
    }
    return self;
}

I am really stuck here. I cannot explain what is wrong with this code. The UIViews are correctly positioned when restored on the same device. This is not true when the level is opened on another device. There are slightly misplaced elements and distortions.

Here are two pairs of screenshots demostrating the issues:

What is the correct approach to handle the scaling of the levels on different screens? Should I rely on AutoResizingMasks (I need to support iOS 4 and later)? In any case I would like to give a solid paradigm on how to achieve this.

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:
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:
How to 'point' an arrow in the direction that it's going? I am relatively new to OpenGL and 3D environments and am having trouble creating a rotation matrix that will rotate an arrow model so it 'points' in the direction that it is going. I am using GLM as a math library. My current approach is to predict the position the arrow will be at next frame and try to rotate the arrow to face that position.

double nextVelY = velocity.y - (gravity * (((glfwGetTime() + dt) - clock) / 1000.0));
glm::vec3 nextVelocity = velocity;
nextVelocity.y = pos.y - 0.5 > -3 ? nextVelY : velocity.y;

glm::vec3 lookat = glm::vec3((nextVelocity * glm::vec3(20) * glm::vec3(dt)));
glm::vec3 pos2 = glm::vec3(0);

And then try to calculate angles between the current position and the predicted position

model = glm::translate(model, pos);
model = glm::scale(model, glm::vec3(0.05));

float angleX = atan(nextVelocity.y / nextVelocity.z);
float angleY = atan(nextVelocity.x / nextVelocity.z);
float angleZ = atan(nextVelocity.x / nextVelocity.y);

glm::vec3 zAxis = glm::normalize(lookat - pos2);
glm::vec3 xAxis = glm::normalize(glm::cross(up, zAxis));
glm::vec3 yAxis = glm::cross(zAxis, yAxis);

model = glm::rotate(model, angleX, xAxis);
model = glm::rotate(model, angleY, yAxis);
model = glm::rotate(model, angleZ, zAxis);

I'm not at all sure if this is a good way to try and achieve this. I've also tried using glm::lookAt

model = glm::transpose(glm::lookAt(pos2, lookat, glm::vec3(0, 1, 0)));

and various other methods I've found with no success.

sentences:
2D Sidescroller Gravity Ive looked up implementing gravity on several sites. Subtract a constant gravity (9.8 * DeltaTime) from the velocity each frame. My problem is, when implementing it as they say, when walking off a ledge the player will float off, not vertically, just accelerates too slowly as he falls.

World->Gravity = -9.8 * PixelsToMeters;   // PixelsToMeters = 32
CurrentAcceleration = Vector2(0.0f, World->Gravity);
CurrentVelocity = (CurrentAcceleration * DeltaTime) + PrevVelocity;
Vector2 halfATSq = currentAcceleration * 0.5f * Square(DeltaTime);
Vector2 vt = CurrentVelocity * DeltaTime;
CurrentDelta = halfATSq + vt;
CurrentPosition += CurrentDelta;

Now the thing is, with the 1/2at^2 + vt + p calculation, the character does fall about 20 meters in 2 seconds, (I think those are the numbers I used, that was a couple hours ago), so it seems the calculations are right. Ive played quite a few side scrollers and none of them have this floating feel.

So, I tried calculating the gravity based on a TimeInAir variable that multiplies the World->Gravity on the third line, instead of DeltaTime.

CurrentVelocity = Vector2(currentAcceleration.X * DeltaTime, currentAcceleration.Y * TimeInAir) + PrevVelocity;

He no longer floats, he falls as expected. Even jumping looks better. However, now he falls 20 meters in 1 second. Ill deal with this, it is only a game and not reality.

Question is, why is it that this works instead of the original code? Or do I have an error somewhere? Because I have to rework the physics code to get it to look right for everything, instead of just using the basic equations. Is it because its all calculated in pixels? Im wondering if I need to add a full gravity to the velocity on the first frame instead of gravity * DeltaTime? This works for falling off a ledge, but not for jumping.

Im testing these questions as I think of them in my code, and still not getting it. These ideas dont seem to work. Thanks for looking and whatever help or ideas you can give!

sentences:
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:
Dealing with vectors in multiple planes Say I have my main "screen" plane, where vectors can be represented

I "know"/can represent vector Q, but the only information I know about vector R is relative to Vector Q. An easy way to visualize this is to have another plane at o2-- I can represent vector R in this plane (e.g. in cartesian coordinate form, or polar form), but how do I "globalize" to the original plane, or represent vector P?

Thank you

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: How can I detect a clicked element in an Editor Script? I want to implement a custom LayoutManager, e.g. a HorizontalLayout. (Yes I know, that this already exists, but I want my own behaviour) So when I let my script calculate the width, that works. But now I want to adjust the width of one Element and let the script recalculate the width of the other elements accordingly, I run into the problem, that the width is "locked" because the script is calculating all the time. So I want to tell the script, that it should only recalculate for the elements which are not clicked on the layout for the moment. I hope something like this is possible.

sentences:
Algorithm for spending x points on y things divided by n people I'm trying to devise an algorithm to spend a given amount of points on a randomly generated list of items each with their own cost in a way that results in having a number of items that is divisible by a given value (the number of points given is always divisible by this). Each item must be represented as equally as possible.

Points: 12
Divisor: 6
Items: Foo (1) & Bar (3)

The optimal result would be 3 Foo and 3 Bar (12 total points and 6 items).

That could be achieved by filling the space alternately starting with the smallest item but that algorithm won't work for other permutations of the starting values or if there are more items to spend points on, some of which may have the same value as other items but must be represented equally in the final result.

The algorithm can result in spending less points than are available but never more. There may not always be a 1 cost item to fill in any remainders.

Another example I can't solve...

Points: 24
Divisor: 8
Items: Foo (1), Nacho (1) , Pizza(2), Bar (3), Cake (4)

Just spending all of the points is easy but spending it in such a way that you end with a specific number of items that can be divided between the divisor has had me scratching my head all day.

sentences:
How would I go about generating a star map? Im trying to generate a star map.

My try would be:

Have a width and height for the map.
Place points (stars) randomly across the area of width and height.

A simple approach, but it has the problem of randomly placing stars extremely close to each other.

To solve this problem, one approach would be to have a minimum distance and when generating a star, you compare the distance from the new star to every generated star and if its below minimum distance, you generate a new one, but I dont know if thats efficient. Any tips?

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:
A terrain with underground tunnels The Terrain tool in Unity is great for constructing 3-D landscapes that are open from above. I am working on a game that happens entirely inside tunnels (specifically, blood vessels in a human body. But it can also be tunnels in an ant nest, or sewers below a city). There is nothing "overground" - all movement is inside the tunnels. I am looking for a tool, similar to Terrain, for easily constructing this complex system of tunnels.
One solution I thought of is to construct a terrain with "half tunnels" (i.e., open from above), then duplicate it, rotate 180 degrees, and "glue" on top of the first copy. But it can only handle one layer of tunnels, and in addition, for some reason I could not rotate the terrain.
Is there a way to construct such underground tunnels with the Terrain tool, or with a different tool in Unity?

sentences:
Read from OpenGL texture to Bitmap in C# I want to read a texture pixels from texture id (associated with some FBO) to bitmap object in opengl (opentk) in c#
But it throws an exception says:

System.AccessViolationException occurred
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=OpenTK

The code:

public Bitmap GetTexture(int AttachmentIndex)
        {
            if (AttachmentIndex > fbo_colorBuffer.Count - 1)
                throw new IndexOutOfRangeException();

            Bitmap bitmap = new Bitmap(width, height);
            BitmapData bits = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            BindToRead(ReadBufferMode.ColorAttachment0 + AttachmentIndex);
            GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Rgb, PixelType.Float, bits.Scan0);
            bitmap.UnlockBits(bits);

            return bitmap;
        }

public void BindToRead(ReadBufferMode Mode)
        {
            GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, fbo_id);
            GL.ReadBuffer(Mode);
        }

sentences:
How to load data from stbi allocated memory into java managed memory? LWJGL3 provides me with simple wrappers around nothings' stb libraries. In order to load images I thus make use of the stb_image wrapper.

My issue is that when I use this wrapper library, all I get back is a unsigned char * pointing to the pixel data in the memory allocated by stbi. While I can work with this, it introduces two issues that are non-trivial to me:

I have to explicitly manage this memory, thus either work with explicit free methods on any class that keeps the image-data any longer than during construction.
Access to the actual image-data from java is, to say the least, somewhat convoluted. Not to speak of modifying it.

Q: Is there any standard way to load the image-data produced by the stbi library via LWJGL wrappers into standard java memory?

My goal is that I can free the stbi allocated memory immediately after loading and don't have to worry about it anymore.

I also want to be able to access the actual image data for optional processing after loading the image.

I am looking for either a pure JDK solution or a solution that uses LWJGL3 or any other library (the smaller the footprint the better) that results in a java-managed memory structure giving access to these bytes (i.e. an object that can be garbage collected without me having to do anything other than releasing any references to it).

sentences:
Unity3d texture size different than original png image While selecting a png image as a texture for a material in Unity, it shows different size (bigger) than the actual file size, why is this so?
how can I reduce its effective size to make it perform better without loosing much detail.

Size in windows explorer (825 kb)

and this is same image in Unity texture select window (1.3 MB)

sentences:
Simplest way to generate a random path What's the simplest way to generate a random "path" for a level in a game? I don't know what search terms I should use to read more. I've looked into maze generation but thats not quite right.

The end result should look like this:

sentences:
Some of the model's vertices are incorrectly positioned in skeletal animation Everything is almost ready . I do not understand what the problem is.
The animation works, but some vertices are not where they should be.

I am using an SMD file from Half Life. I found that these vertices have a parent bone at index 2. "Bip01 Pelvis" This bone is in the right place - at the height of the pelvis.
version 1
nodes
  0 "Bip01"  -1
  1 "Bip01 Footsteps"   0
  2 "Bip01 Pelvis"   0
  3 "Bip01 L Leg"   2
  4 "Bip01 L Leg1"   3

Here is my code:
Animation:
// void modelUpdate()...
Mat4 TranslationM;
TranslationM[3] = objJoint.m_position;
TranslationM[3].w = 1.f;

Mat4 RotationM;
RotationM.setRotation(objJoint.m_rotation);

Mat4 NodeTransformation = TranslationM * RotationM;

if (mdlJoint->m_parentIndex != -1)
{
    objJoint.m_globalTransformation =
        m_joints[mdlJoint->m_parentIndex].m_globalTransformation
        * NodeTransformation;
}
else
{
    objJoint.m_globalTransformation = NodeTransformation;
}

objJoint.m_finalTransformation = objJoint.m_globalTransformation * mdlJoint->m_matrixOffset;

objJoint.m_finalTransformation - matrix for shader
Here how I read bind pose:
Mat4 R;
SMDAngleMatrix(v3f(nt.m_rotation.y, nt.m_rotation.z, nt.m_rotation.x), R);

Mat4 T;
T[3] = nt.m_position;
T[3].w = 1.f;

joint->m_matrixBind = T * R;

if(node.m_parentID != -1)
{
    joint->m_matrixBind = object->m_mdl->m_joints[node.m_parentID]->m_matrixBind * joint->m_matrixBind;
}
joint->m_matrixOffset = joint->m_matrixBind;
joint->m_matrixOffset.invert();

I have no experience with skeletal animation.
Perhaps someone has encountered a similar problem and knows the solution.
UPDATE
I disabled animation (for testing)
Mat4 NodeTransformation = mdlJoint->m_matrixBindNoParent;

if (mdlJoint->m_parentIndex != -1)
{
    objJoint.m_globalTransformation =
        m_joints[mdlJoint->m_parentIndex].m_globalTransformation
        * NodeTransformation;
}
else
{
    objJoint.m_globalTransformation = NodeTransformation;
}

objJoint.m_finalTransformation = objJoint.m_globalTransformation * mdlJoint->m_matrixOffset;

maybe problem with m_matrixOffset
How I create matrix from Tait–Bryan angles (ZYX)
// up / down
#define PITCH   0
// left / right
#define YAW     1
// fall over
#define ROLL    2
void SMDAngleMatrix(v3f& angles, Mat4& matrix)
{
    float       angle;
    float       sr, sp, sy, cr, cp, cy;

    angle = angles[YAW];// *(math::PI * 2 / 360);
    sy = sin(angle);
    cy = cos(angle);
    angle = angles[PITCH];// * (math::PI * 2 / 360);
    sp = sin(angle);
    cp = cos(angle);
    angle = angles[ROLL];// * (math::PI * 2 / 360);
    sr = sin(angle);
    cr = cos(angle);

    // matrix = (YAW * PITCH) * ROLL
    matrix[0][0] = cp*cy;
    matrix[0][1] = cp*sy;
    matrix[0][2] = -sp;
    matrix[1][0] = sr*sp*cy + cr*-sy;
    matrix[1][1] = sr*sp*sy + cr*cy;
    matrix[1][2] = sr*cp;
    matrix[2][0] = (cr*sp*cy + -sr*-sy);
    matrix[2][1] = (cr*sp*sy + -sr*cy);
    matrix[2][2] = cr*cp;
    matrix[0][3] = 0.0;
    matrix[1][3] = 0.0;
    matrix[2][3] = 0.0;
}

OpenGL shader:
"void main(){\n"
    "   mat4 BoneTransform = Bones[inputBones.x] * inputWeights.x;\n"
    "   BoneTransform     += Bones[inputBones.y] * inputWeights.y;\n"
    "   BoneTransform     += Bones[inputBones.z] * inputWeights.z;\n"
    "   BoneTransform     += Bones[inputBones.w] * inputWeights.w;\n"
    "   vec4 vertexPosition = BoneTransform * vec4(inputPosition.xyz,1.0f);\n"
    "   gl_Position = WVP * vertexPosition;\n"
    "   texCoord.x = inputTexCoord.x;\n"
    "   texCoord.y = inputTexCoord.y;\n"
"}\n";

My matrices:
class Mat4{
    ....
    vec4 m_data[4];
}

Where m_data[3] - position;
That's all I have.
I will try to use quaternions instead of function SMDAngleMatrix...no same result...

sentences:
Implementing an interaction system that can perform different tasks dependant on the object you are trying to interact with? In No Mans Sky there are objects to interact with in the world and the result of the interaction changes depending on the object. For example, if you interact with a plant it will give you resources but if you interact with the save point it will save the game. I was wondering if it would be efficient to add an 'Action' class that had different methods for each different action (save(), grab resources(gameObject)), then call each action depending on what object you are interacting with...

Another possible solution I came up with is to have a base class of 'Action' and have each action as a script that inherits from this class, then attach them as a component to the interactable objects. Then have the interaction system check if it has an 'Action' script and perform that action if required.

I am just wondering if any of my solutions would be effective, or if there is a much simpler way around this problem that I am missing.

sentences:
Subtracting magnitude from 2D circle contact I'm trying to create an agar.io clone. In agar.io, each player can have multiple cells that "chase" the mouse pointer. The cells can also have multiple masses and the velocity is tied to the mass. The bigger the cell, the slower it moves. The first picture in this question is a good representation of how this plays out

The cells can't overlap (mostly), so I've already implemented

check to see if they are touching
calculate how much they overlap -> distance between circle centers, minus both circle's radius
calculate a push vector -> subtract the two centers, normalize the resulting vector, and multiply by overlap value

The above code mostly works, but in the regular game if you have a smaller/faster blob moving behind a larger/slower blob, the faster blob will start to slide around the larger blob. I'm not sure how to implement that.

I think you should be able to calculate the normal to the point where the circles touch, and remove the magnitude of the "chase the mouse" velocity  in the direction of the normal? I'm not sure how to do that. Math is not my strong suit.

I took the idea for the circle collision from this link and I think my question of how to remove the velocity from the circle normal is in this link which talks about how to calculate the reflection off of a circle, but I haven't been able to translate that to code.

I'm using C++, not that that matters.

There's also the open source agar.io clones, Ogar and Agar.io-clone, but I haven't found much digging through the code with how they handle that.

sentences: Is there any way to bring animation into unity without a rig/bones? I am developing for mobile and to make the game run on lower spec mobiles, I was only going to import bones/rig for the main character. There are other humanoid characters in the scene which do move about and are rigged already in my 3d app but since they wont be controlled in anyway by the player in the game, I just wanted to bake and import their animations alone without the bones. I know unity can handle blendshapes but I am more comfortable with rigs and also cos these characters are already rigged properly.

sentences:
How to make players be creative in a game, if the game cannot evaluate it? I am working on a prototype game with several funny/visual effects that the player can trigger. The player can be quite creative in the way to use or combine these effects but it seems impossible to make detect/evaluate this creativity by the computer.

So, from a game design perspective, I wonder what could be the features to drive the players to be creative (experiment various combinations).

For the moment i think about "Draw something" where the result is evaluated by other players. I think about levels designed by "Little Big Planet" players but this aspect is out of the core game. I think also about "Minecraft" but I do not understand really how this game encourages the people to be creative (except of the open world).

Please tell me if you have any ideas, articles or references that could help me coping with this problem.

sentences: How to model chess knight movement in GameMaker? I am making a chess game in GameMaker, and I have the basic movement down for all of the other pieces except for the knight. I am using a system where I have an if statement that checks if the mouse is in a location that it can move too, then if it moves the piece there. For example, the rook code is (mouse_y div 64) *64 == y || (mouse_x div 64) * 64 == x. What would be an expression that would work for knights? Would this strategy even work for knights?

sentences:
Setting the colour of a dynamically created tile does not work I have a function that takes in the position of a tile on a Tilemap and sets the colour. If I do not replace the tile with a dynamically created one, it works just fine.
However, if I create a tile at runtime, set it's colour and add it to the tilemap, the tile does not change. In the preview window it appears black.
The function can be found below:
private void CreateTile(Vector3Int tilePosition)
{
    var tempTile = ScriptableObject.CreateInstance<Tile>();

    tempTile.flags = TileFlags.None;
    tempTile.color = Color.green;

    tilemap.SetTile(tilePosition, tempTile);
}

Any help would be appreciated, I have spent a few hours on this problem.
Thanks.

sentences:
Resolving 2D Collision with Rectangles For about a week I've been trying to grasp the basics of collision, but I've been driven to the point of wanting to just give up on everything when it comes to collision. I just don't understand it. Here's my code so far:

 public static void ObjectToObjectResponseTopDown(GameObject actor1, GameObject actor2)
        {
            if (CollisionDetection2D.BoundingRectangle(actor1.Bounds.X, actor1.Bounds.Y, actor1.Bounds.Width, actor1.Bounds.Height,
 actor2.Bounds.X, actor2.Bounds.Y, actor2.Bounds.Width, actor2.Bounds.Height)) //Just a Bounding Rectangle Collision Checker
            {
                if (actor1.Bounds.Top > actor2.Bounds.Bottom) //Hit From Top
                {
                    actor1.y_position += Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Height;
                    return;
                }
                if (actor1.Bounds.Bottom > actor2.Bounds.Top) //Hit From Bottom
                {
                    actor1.y_position -= Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Height;
                    return;
                }
                if (actor1.Bounds.Left > actor2.Bounds.Right)
                {
                    actor1.x_position += Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Width;
                    return;
                }
                if (actor1.Bounds.Right > actor2.Bounds.Left)
                {
                    actor1.x_position -= Rectangle.Intersect(actor1.Bounds, actor2.Bounds).Width;
                    return;

                }
            }
        }

Essentially what it does so far is correctly collides when the bottom of the first rectangle collides with the top of the second rectangle, but with the left an right sides it corrects it either above or below the tile, and when the top of the first rectangle collides with the bottom of the second rectangle, it slides right through the second rectangle.

I'm really not sure what to do at this point.

sentences:
How to reset my game? What I want is that when ever my player left click(mouse click) in the menuState,
My init() method in my Game Class must reload. How can i do that???

My game class witn the init() method

public class Game implements Runnable {

private Display display;
private int width,
            height;
public String title;

private boolean running = false;
private Thread thread;

private BufferStrategy bs;
private Graphics g;

//States
public State gameState;
public MenuState menuState;
public SplashScreen splashscreen;

//Input
private KeyManager keyManager;
private MouseManager mouseManager;

//Camera
private GameCamera gameCamera;

//Handler
private Handler handler;

public Game(String title, int width, int height){
    this.width = width;
    this.height = height;
    this.title = title;
    keyManager = new KeyManager();
    mouseManager = new MouseManager();
}

// MY INIT METHOD!!

private void init(){
    display = new Display(title, width, height);
    display.getFrame().addKeyListener(keyManager);
    display.getFrame().addMouseListener(mouseManager);
    display.getFrame().addMouseMotionListener(mouseManager);
    display.getCanvas().addMouseListener(mouseManager);
    display.getCanvas().addMouseMotionListener(mouseManager);
    Assets.init();

    handler = new Handler(this);
    gameCamera = new GameCamera(handler, 0, 0);

    gameState = new GameState(handler);
    menuState = new MenuState(handler);
    splashscreen = new SplashScreen(handler);
    State.setState(splashscreen);
}

private void tick(){
    keyManager.tick();

    if(State.getState() != null);
        State.getState().tick();
}

private void render(){
    bs = display.getCanvas().getBufferStrategy();
    if(bs == null){
        display.getCanvas().createBufferStrategy(3);
        return;
    }
    g = bs.getDrawGraphics();
    //Clear Screen
    g.clearRect(0, 0, width, height);
    //Draw Here!

    if(State.getState() != null);
        State.getState().render(g);

    //End Drawing!
    bs.show();
    g.dispose();
}
//WHEN THE GAME RUNS, it also runs the intit() method and shows fps and tick

public void run(){

    init();

    int fps = 1000;
    double timePerTick = 1000000000 / fps;
    double delta = 0;
    long now;
    long lastTime = System.nanoTime();
    long timer = 0;
    int ticks = 0;

    while(running){
        now = System.nanoTime();
        delta += (now - lastTime) / timePerTick;
        timer += now - lastTime;
        lastTime = now;

        if(delta >= 1){
            tick();
            render();
            ticks++;
            delta--;
        }

        if(timer >= 1000000000){
            System.out.println("Ticks and Frames: " + ticks);
            ticks = 0;
            timer = 0;
        }

    }

    stop();

}

public KeyManager getKeyManager(){
    return keyManager;
}

public MouseManager getMouseManager(){
    return mouseManager;
}

public GameCamera getGameCamera(){
    return gameCamera;
}

public int getWidth(){
    return width;
}

public int getHeight(){
    return height;
}

public synchronized void start(){
    if(running)
        return;
    running = true;
    thread = new Thread(this);
    thread.start();
}

public synchronized void stop(){
    if(!running)
        return;
    running = false;
    try {
        thread.join();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
}

sentences:
How do I check if an item no longer exists in GameMaker Studio? Let's say I have an array of objects[i,j], which has been fully populated by objects obj_example. I want to delete the obj_example at position [1,2]. That's simple, as objects[1,2] is currently pointing to that object (or is the object, or whatever logic Gamemaker uses).

But now, the object at objects[1,2] is destroyed.

What if statement would I use to check that makes objects[1,2] return an undefined(or null) value (but, clearly, not make the other, populated objects return such)?

Or how would I otherwise know that the objects[1,2] were destroyed?

EDIT: I added the following to my little project, after object_handler (which was made equal to the objects[i,j] to be deleted) was deleted. It returned "this is defined."

if (is_undefined(object_handler))
{
    show_message("this is undefined");
}
else{
    show_message("this is defined");
}

So...is_undefined(n) does not work for this purpose.

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:
How to detect matches in match-3 game? I am working on a match 3 game where the number of matched cells matters

  (if you match 3 then they just get removed, if you match exactly 4
  then something happens, and if you match more than 4 then something
  else happens)

Basically this image sums it up :

cells in the green frame should match and disappear, the ones in the red shouldn't.
Could anyone please help me out, am kinda stacked on how to tackle this.
Thank you

Edit
Thank you all for your help! flood-fill was the right thing to do, i made a good progress and faced a different problem, please check the new thread

sentences:
FlasCC requirements and limitations? It is now available for download.
It says you need twice* as many bits as I have. Why would you need more bits to compile code? Does that mean you need more bits to run flash games writtes with flasCC

Did anyone try it out and happens to know the answers?

http://gaming.adobe.com/technologies/flascc/

Minimum system requirements
    Flash Player 11 or higher
    Flex SDK 4.6 or higher
    Java Virtual Machine (64-bit)
Windows
    Microsoft® Windows® 7 (64-bit edition)
    Cygwin (included)

*This is meant as a joke. however I do own a 32-bit laptop and I am wondering why you need 64-bit.
Afaik - You only need 64-bit if you want to run a system that has more than 4gigs of memory.
Why would any flash game require more than 4 gigs of memory.

The only system that is 64-bits and does not have 4gigs of memory that I can quickly recall is that hilarious Nintendo that came ages ago with a Motorola CPU.

sentences:
Unity: transform.LookAt(target) not "looking at" target? I have been troubleshooting a prefab for several hours and am out of ideas. It concerns a method that I thought I was comfortable with, transform.LookAt(target).  I have this prefab:

As you can see, I verified that the registration points for the eyes are at the center of mass; I also verified that they rotate correctly for the X, Y and Z axes. That yellow ball you see is the target object and IS NOT inside the prefab.

I have tried two means to get the eyes to look at the target. The first is this script, and it caused the eyes to dart 90 degrees counter-clockwise about the y axis (which is very wrong). I applied this script to both eyes. Check it out:

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

public class LookAt : MonoBehaviour
{
    public Transform target = null;

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(target);
    }
}

And please, before you think it: Yes, I remembered to set the target object in the editor. You can see the eyes pointing to the side instead of the target:

I found this other script on the Unity documentation that didn't work at first, but then I changed "Rotation" to "LocalRotation", saw that I was close, reversed the "relativePos" vector, and it worked--but only about the y axis:

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

public class LookAt : MonoBehaviour
{
    public Transform target = null;

    // Update is called once per frame
    void Update()
    {
        Vector3 relativePos = transform.position - target.position;

        // the second argument, upwards, defaults to Vector3.up
        Quaternion rotation = Quaternion.LookRotation(relativePos, Vector3.up;
        transform.localRotation = rotation;

    }
}

You can see here that it works in the XY plane at eye level, but take my word for it when I say the eyes cannot look up or down if I move the ball up or down:

How can I fix this so that the eyes always look at the target I need it to?
Thank you sincerely for your time.

EDIT: I fixed it by this sloppy additional rotation, but there has to be a better way:

void Update()
    {
        //transform.LookAt(target);

        Vector3 relativePos =  target.position - transform.position;

        // the second argument, upwards, defaults to Vector3.up
        Quaternion rotation = Quaternion.LookRotation(relativePos, new Vector3(0,1,0));
        transform.rotation = rotation*Quaternion.Euler(0,90,0);
    }

sentences: OpenGL 2.0 Android Scrolling Horizontally and Vertically I am new to OpenGL2.0 in Android. How can I scroll the GLSurfaceView both horizontally and vertically?

sentences:
How can I move an object over linerenderer lines positions? I have 4 cubes the first 3 cubes connected with two lines one of the lines is curved. The fourth cube I want to move over the lines. The lines is built using linerenderer and in the linerenderer there are 397 positions. I created a small script that move an object over the positions. I checked and I have in the array 397 positions and the loop get to 397 but the object (Cube (3)) never moving all the positions only some. Or maybe the positions I get are not the same in the linerenderer ?
This screenshot show some of the positions in the linerenderer this is the positions I want the object to move on :

Why the object is not moving over all the positions , only on some ?
And this is the script I created that should move it :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveOnCurvedLine : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public GameObject objectToMove;
    public float speed;

    private Vector3[] positions = new Vector3[397];
    private Vector3[] pos;
    private int index = 0;

    // Start is called before the first frame update
    void Start()
    {
        pos = GetLinePointsInWorldSpace();
    }

    Vector3[] GetLinePointsInWorldSpace()
    {
        //Get the positions which are shown in the inspector
        var numberOfPositions = lineRenderer.GetPositions(positions);
        //Iterate through all points, and transform them to world space
        for (var i = 0; i < numberOfPositions; i += 1)
        {
            positions[i] = transform.TransformPoint(positions[i]);
        }

        //the points returned are in world space
        return positions;
    }

    // Update is called once per frame
    void Update()
    {
        if(index <= pos.Length - 1)
        {
            objectToMove.transform.position += pos[index] * Time.deltaTime * speed;
            index++;
        }
    }
}

Now I checked using a breakpoint the first position in the linerender at index 0 is : X = 30.57, Y = -6.467235, Z = 4.98
But in my script in the pos array I see that in index 0 the position is :
X = 30.6, Y = -6.5, Z = 5.0
And the result is that the object that move Cube(3) is moving only some of the way and also it's not exactly on the line :

Why the object is not moving over all the positions , only on some ?
Something is wrong in my script with getting the right positions from the linerenderer and maybe also the loop and the move is wrong. I can't figure out ho to do it.

sentences:
How to calculate a normalized direction of two rotations? In Vector math and translations we can do:

dir = (v1 - v2).norm

and then v1.translate(dir * 50) so v1 moves to the v2's direction.

What about rotation and eulerAngles?

Here's my attempt, but it doesn't work, probably from some obvious reasons.

Vector3 initial = ob1.transform.rotation.eulerAngles; // get it's initial rotation
ob1.Rotate(new Vector3(0,0,90)); // rotate
Vector3 after = ob1.transform.rotation.eulerAngles; // store new rotation
ob1.Rotate(new Vector3(0,0,-90)); // rotate back to initial

// here I need to calculate the direction so I can do rotate(dir * 50); or something similar

I need to get the rotation direction, so I can rotate the object continously with direction, not with a fixed desired angle value.

To be super clear, I need to get this blue line direction:

The object is initially rotated by (0,0,57).
I need to rotate it around it's center (green axis).

I know I can do logo1.transform.RotateAround(logo1.transform.position, logo1.transform.up, 80); and it works, but I need the direction from this, so I can use it in Tweening.

sentences:
Can I Create A Windows Package to Submit to the Window Store using the Mac Version of Unity 5.3? Note: New to App Development.

I'm using a Mac for building my three 3D puzzle apps with Unity 5.3.2. I want to create Windows versions to sell in the Windows Store. I attempted to transfer the package for one of our apps to the Windows version of Unity but it was a pure hot mess. A lot of the alignment of text and images was skewed really bad. We have not used Windows in approx. 10 years so for all practical purposes we are brand new Windows users. The last OS we used was XP. The laptop we just purchased runs Windows 10 Home.

I can create a Windows executable (.exe) file from the Mac version of Unity that executes my 3D puzzle app perfectly just like the Mac version. However I found out that I had to submit a special package to the Windows Store. The instructions that I found so far for this assumes that you are using the Windows version of Unity.

I do not plan to be a full time app developer so the idea of trying to learn Visual Studio for me is a waste of my time. I would prefer creating the Windows package for the Windows Store using the Mac version of Unity. Is this possible? I could not find instructions in the manual or from search on what options need to be set to do this. I'm thinking it can be done since I was able to create a Windows exe file using my Mac version of Unity. I would like to create Windows Store packages for both 8.1 and 10.

sentences:
How do you add equipment to a 3D character model using XNA/Blender? I've watched quite a few Blender tutorials, but I have yet to see examples of how to swap out sub-models. So my question is, how do you swap out equipment on a character model? Specifically I’d like to be able to dynamically add/swap clothing and items held by a character model in XNA. Ideally the items would follow the bone structure of the character model.

For example; starting with a naked character in XNA, I’d like to be able to have the character hold an axe and wear chainmail that follows the character’s animations. I’d also like to be able to switch this equipment for a sword and plate mail at any time during the game. I’d rather not create a model for each equipment combination. Is there some way to just add the bones (say a sword bone) and meshes of one model to another model bone (say a right hand bone)?

Thanks…

sentences:
Which key bindings to use for switchable primary and secondary attacks? I am making a game in which the player can have a primary and secondary weapon (like an ability). These are my current planned key bindings:

 Action | Effect
-----------------
 Click  | Shoot primary weapon
 WASD   | Move
 Space  | Use ability (secondary weapon)
 Q      | Previous primary weapon
 E      | Next primary weapon
 ???    | Previous/Next ability (secondary weapon)

I am trying to think of a way to switch the secondary weapon. Here are some options I have thought of and why I have rejected them:

scroll wheel

some mice don't have scroll wheels

R / F

awkward, also primary weapon switch is horizontal and this is vertical

shift / ???

cannot think of another key

So, what is a good key binding for switching a secondary attack?

sentences:
Unity crash upon opening a specific scene I have this one specific scene that I spent over 20 hours building. But as of today when I attempt to open it unity crashes. I have opened the error log and it states:

Unity.exe caused an Access Violation (0xc0000005)
  in module Unity.exe at 0033:4150123b.

Error occurred at 2017-09-22_200636.
C:\Program Files\Unity\Editor\Unity.exe, run by MarcR.
62% memory in use.
16257 MB physical memory [6165 MB free].
32641 MB paging file [18590 MB free].
134217728 MB user address space [134213224 MB free].
Read from location 00000098 caused an access violation.

I have tried running the program as administrator, updating the unity editor and cleaning the cache.

The funny thing is that I am actually able to open the scene additive to my current scene.

Can anyone tell me whats going on?

(On an end note I did not want to post ALL of the error log if you need to see please comment and I will, of course, link it)

sentences:
Moving my character/camera makes environnement jerky I'm learning to make a Tilebased game with Unity and for that I use the Zelda alttp assets.
I just have Tiles, a Camera and a moving Character with a rigidbody2D and a CircleCollider.

When the Camera follows the Character, the scene feels Jerky.

Info:

The Camera uses the 2D Pixel Perfect package.
The Character is moving via Rigidbody2D.MovePosition() in the FixedUpdate Method:

code:

void Update()
{
    float yInput;
    float xInput;

    #region yMovement
    if (Input.GetKey(keyMoveTop))
    {
        if (Input.GetKey(keyMoveBot))
        {
            yInput = 0f;
        }
        else yInput = 1f;
    }
    else if (Input.GetKey(keyMoveBot))
    {
        yInput = -1f;
    }
    else yInput = 0f;
    #endregion

    #region xMovement
    if (Input.GetKey(keyMoveLeft))
    {
        if (Input.GetKey(keyMoveRight))
        {
            xInput = 0f;
        }
        else xInput = -1f;
    }
    else if (Input.GetKey(keyMoveRight))
    {
        xInput = 1f;
    }
    else xInput = 0f;
    #endregion

    //Walking
    isWalking = Input.GetKey(keyMoveWalk);
    moveDirection = Vector2.ClampMagnitude(transform.right * xInput + transform.up * yInput, 1f);
}

private void FixedUpdate()
{
    _rb.MovePosition(_rb.position + moveDirection * (isWalking ? walkSpeed : runSpeed) * Time.fixedDeltaTime);
}

You can see the problem here:
https://youtu.be/MA2zZPME5X4

Edit: Added all my movement code

sentences: How to smoothly move camera when the player is climbing a diagonal staircase in 2D tile-based side-scroller? I am working on a game, which is tile-based, similar to the way Terraria works. My player is 2 x 3 and can move over one-high obstacles, but this creates a very jittery effect, since my camera currently strictly follows the player. I was thinking of either somehow implementing a smoother camera movement or overhauling the player movement itself. I would love some feedback on how one might go about fixing this.

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:
Importing fbx models made in Cinema4D in unity at runtime In my app I have requirement that I will be given a url and using this url I have to download a fbx model and then show it in the scene.

I am able to download the model from the url using the below code.

IEnumerator loadModel(string modelName)
{
    if (!isDownloaded)
    {

        string targetUrl = "http://XXX.XXX.X.XX:3000/" + modelName;
        Debug.Log("targetUrl" + targetUrl);
        WWW www = new WWW(targetUrl);

        yield return www;
        if (www.isDone)
        {
            Debug.Log("downloaded " + www.bytesDownloaded);
            var path = System.IO.Path.Combine(Application.dataPath+"/Resources", modelName);

            System.IO.File.WriteAllBytes(path, www.bytes);
            isDownloaded = true;

            LoadAndAttachModel(imageTargetTransform, modelName);
        }
        else
        {
            Debug.Log(www.bytesDownloaded);
        }
    }
}

And with the below code I tried using loading the model in the scene

public void LoadAndAttachModel(Transform parent, String modelName)
{
    Debug.Log(modelName);
    var path = System.IO.Path.Combine(Application.dataPath + "/Resources", modelName);
    String name = modelName.Substring(0, modelName.IndexOf("."));
    GameObject load = Resources.Load(modelName) as GameObject;
    Debug.Log(load.name);
    if (load != null)
        {
           // load.transform.parent = parent;
            load.transform.localPosition = Vector3.zero;
            load.transform.localRotation = Quaternion.Euler(new Vector3(90, 90, 0));
            load.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
        }

    else
    {
        Debug.LogWarning("Can't find boneName : " + parent);
    }
}

but this code always gives exception that the gameobject load is null. I tried with the obj model and that was working fine but with fbx models this is giving exception every time.

So how can I instantiate the downloaded gameobject in my scene ?

sentences:
Cocos2d rotating sprite while moving with CCBezierBy I've done my moving actions which consists of sequences of CCBezierBy. However I would like the sprite to rotate by following the direction of the movement (like an airplane). How sould I do this with cocos2d?

I've done the following to test this out.

    CCSprite *green = [CCSprite spriteWithFile:@"enemy_green.png"];
    [green setPosition:ccp(50, 160)];
    [self addChild:green];

    ccBezierConfig bezier;
    bezier.controlPoint_1 = ccp(100, 200);
    bezier.controlPoint_2 = ccp(400, 200);
    bezier.endPosition = ccp(300,160);

    [green runAction:[CCAutoBezier actionWithDuration:4.0 bezier:bezier]];

In my subclass:

@interface CCAutoBezier : CCBezierBy

@end

@implementation CCAutoBezier

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }

    return self;
}

-(void) update:(ccTime) t
{
    CGPoint oldpos=[self.target position];
    [super update:t];
    CGPoint newpos=[self.target position];

    float angle = atan2(newpos.y - oldpos.y, newpos.x - oldpos.x);
    [self.target setRotation: angle];
}

@end

However it rotating, but not following the path...

sentences:
Pinch in zoom in android In My layout
parent as Relative layout and then am having Scroll view
inside Linear layout
now am having child views as Image view Text View Web view and Recycle view and 2 buttons is there
now i want to pinch in zoom entire layout

please help me out
Regards
Govardhana

sentences:
How do I show the current view from the viewport on my map? I'm doing HTML5 Canvas development and currently have a large viewport (on the left) and a map (on the right). Like this:

I need to show on the map what is currently being viewed in the left. And I'm at a lost on how to calculate this. This is how I want it to be:

I am manipulating the main viewport via a transformation matrix. like [1, 0, 0, 1, 0, 0]

This is decently common functionality in different games and apps. So I assume there are resources on how to do it. But I haven't been able to find any.

sentences:
How can I make this style of 2D "glowing" graphics? I'm comfortable with the basics of building a 2d sprite based game in XNA, where all my objects are simply .png images that I move around.

What things do I need to learn next to be able to develop a 2d game that utilizes an art style similar to Super Laser Racer for example.

Other examples of this style would include Frozen Synapse, Geometry Wars, etc.

I would describe this style "2D abstract glowing geometry" or something like that.

I can see that a lot of the effects in these types of games are achieved via particle systems and also that maybe some things are still just sprites that were maybe drawn in a graphics editor to look all "glowing" etc.

But then the rest is possibly done by making draw calls to DirectX and implementing custom shaders, etc?

Is that right? I'm not really sure of what to learn next to be able to go in this direction or what questions to ask.

sentences: Programming an Artificial Agent in Open Arena Does anyone know source example source codes and tutorials to start writing an intelligent bot for Open Arena?

sentences: Can Java be used for developing games for Android in Unity3D I only know Java Programming Language and no other. Can I develop games for Android in Unity3D using Java?

sentences:
Draw contour around object in Opengl I need to draw contour around 2d objects in 3d space. I tried drawing lines around object(+points to fill the gap), but due to line width, some part of it(~50%) was covering object. I tried to use stencil buffer, to eliminate this problem, but I got sth like this(contour is green):

http://goo.gl/OI5uc (sorry I can't post images, due to my reputation)

You can see(where arrow points), that some parts of line are behind object, and some are above. This changes when I move camera, but always there is some part, that is covering it.
Here is code, that I use for drawing object:

    glColorMask(1,1,1,1);
    std::list<CObjectOnScene*>::iterator objIter=ptr->objects.begin(),objEnd=ptr->objects.end();
    int countStencilBit=1;
    while(objIter!=objEnd)
    {
        glColorMask(1,1,1,1);
        glStencilFunc(GL_ALWAYS,countStencilBit,countStencilBit);
        glStencilOp(GL_REPLACE,GL_KEEP,GL_REPLACE );
        (*objIter)->DrawYourVertices();

        glStencilFunc(GL_NOTEQUAL,countStencilBit,countStencilBit);
        glStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
        (*objIter)->DrawYourBorder();

        ++objIter;
        ++countStencilBit;
    }

I've tried different settings of stencil buffer, but always I was getting sth like that.
Here is question:
1.Am I setting stencil buffer wrong?

2. Are there any other simple ways to create contour on such objects?

Thanks in advance.

EDIT:

1. I don't have normals of objects.

2. Object can be concave.

3. I can't use shaders(see below why).

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:
Is it possible to get vertices after Primitive Assembly step (after face culling)? I would like to check which vertices will be rendered from direction A (with face culling enabled) and render it from another direction to visualize face culling effect.

I have found information that using Transform Feedback I can received data from vertex or geometry shader. My question is if is it possible to get data from primitive assembly step and use it to render scene from another direction or should I calculate by myself which faces should not be rendered?

Any help and information would be greatly 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:
Accessing variables defined in another .js file in rpgmaker MV I'm coming from C++, diving into JS and enjoying the journey so far but I've been at an en passe for the past 2 days and I'm exhausted.

I need help figuring out how to access variables across plugins.

I tried following the guidance in this posting (and numerous others stating to follow the same syntax): https://forums.rpgmakerweb.com/index.php?threads/mv-syntax-for-variables-in-script-calls.48422/

I set these values in plugin1.js:

var weaponRight = 0;
var weaponHeight = 0;

var a = weaponRight;
var b = weaponHeight;

$gameVariables.setValue(5, a);
$gameVariables.setValue(6, b);

Then try to access them in this script:

var z1 = eval($gameVariables[5]);
var z2 = eval($gameVariables[6]);
...
this.x += (z1 || 0);
...

if I just enter an int, say 5--in place of z1--the transform executes.
In addition, I emulated the parsing logic in the first JS file to the 't', so I'm certain the error is coming from my ignorance.

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 can I constrain the player's movement to horizontal or vertical? This is one of my first coding projects, so apologies for beginner questions....

My player controller script uses the below code, but I want to limit movement to horizontal and vertical only. No diagonal movement.

Here's how it looks:

public class PlayerController : MonoBehaviour
{
    //I’m moving the rigid body to move the player
    public Rigidbody2D theRB;

    //lets me change player's move speed in unity editor
    public float moveSpeed;

    // Update is called once per frame
    void Update()
    {
        theRB.velocity = new Vector2( Input.GetAxisRaw("Horizontal")
                                    , Input.GetAxisRaw("Vertical")) * moveSpeed;

I've tried the below code to only accept one command at a time by using an if statement, however, with this new code, the player doesn't stop walking once the key is no longer pressed.

Just wondering if someone could point me in the direction of what I'm doing wrong?

// Update is called once per frame
void Update()
{
    if (Input.GetAxisRaw("Horizontal") == 1 || Input.GetAxisRaw("Horizontal") == -1)
    {
        theRB.velocity = new Vector2(Input.GetAxisRaw("Horizontal"), 0) * moveSpeed;
    }

    if (Input.GetAxisRaw("Vertical") == 1 || Input.GetAxisRaw("Vertical") == -1)
    {
        theRB.velocity = new Vector2(0, Input.GetAxisRaw("Vertical")) * moveSpeed;
    }

thanks!

sentences:
Should I go with OpenGL to see my future in Game Development industry? Possible Duplicate:
  Should I continue studying OpenGL or just switch to DirectX to  give me a better chance of landing a job in the game industry?

I tried Google but found quite old articles, so I am in search of an answer in context to year 2012.

Hi all, I don't know if you will consider this question appropriate for this community but I am constantly searching for a perfect answer.
What I have seen is that most of the games that are released these days are DirectX 1x based. Except for few games like Starcraft or Diablo which don't have high end graphics are using OpenGL.
So I have few questions to ask.

The platforms i would like to target are PC (windows), Xbox 360 and PS3 (must).

Should I go with learning OpenGL to see my future in game development industry? Or should I shift to Directx?
If I learn OpenGL first, will it be difficult to learn direcx then?
Which API is most suitable for indie development?
Which one of the two API's are better from coder's (programmer's) point of view? Like OOP and style of coding.

Is openGL being cross platform should be the only reason to choose it over Directx? Even when vendors are not providing enough stable drivers for it.

Thanks in advance.

I have read this post, but I have few questions.
Should I continue studying OpenGL or just switch to DirectX to  give me a better chance of landing a job in the game industry?

sentences:
Reading the memory of a N64 I'm looking for a way to read the memory of a N64, while the game is running, in real time.

I have a c# program which hooks into the memory of a running emulator and tracks SSB64 stats. I want to do the same thing with the physical N64. Currently it is possible to read the memory with a gameshark pro, however it's extremely slow, buggy, and not practical for what I am trying to accomplish.

Would it be possible to tap into the gameshark, or the N64 directly, to access the memory in real time?

Thanks!

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:
MMORPG game server data storage performance When writing a MMORPG game server...

Which storage design is better:

Should I only save character data from specific times?

On character log-out.
User disconnect.
From time to time. (every few minutes)

Should I save it immediately? Which would make writing be more extensive.

Other things:

What is the best practice when dealing with data on a real time
MMORPG game?
Which database is best with being multi-platformed in mind?

sentences:
EventSystem first selected not highlighting I'm trying to make a menu and encountered this problem.

protected static EventSystem eventSystem
{
    get { return GameObject.Find("EventSystem").GetComponent<EventSystem>(); }
}

public static void ButtonNavigation(List<GameObject> _listButton, int firstSelected)
{
    eventSystem.SetSelectedGameObject(_listButton[firstSelected]);
    print(eventSystem.currentSelectedGameObject);
}

But when I print out the currentSelectedGameobject it clearly says that "Status" is selected but how come it's not highlighted?

I've read some article on using Co-routines but is it really necessary?

sentences:
LibGDX Drawing sprites when moving orthographic camera I've been having this problem for a long time and I just can't seem to find the exact problem. I have a game where the map is 480x1600 and my camera has a view of 480x800. I have a button that when pressed, allows the user to place a platform on the map, and since the map is too big to fit on the screen, I made it so the user can move the camera up and down the map by dragging.

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    Vector3 pos = new Vector3(screenX, screenY, 0);
    cam.unproject(pos);
    cam.position.y = pos.y;
    return true;
}

Method that controls when the user tries to put a platform down

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Vector3 pos = new Vector3(screenX, screenY, 0);
    cam.unproject(pos);
    Gdx.app.log(Game.LOG, "X Coordinate: " + pos.x + " Y Coordinate: " + pos.y);

    if (GameScreen.createPlatform == true) {
        world.setPlatform(new Vector2(pos.x - 0.6f, pos.y - 0.1f), 1);
        GameScreen.createPlatform = false;
        return true;
    }

    ...
}

Where I render the platform sprites

public void render(float delta) {
    ...
    spriteBatch.setProjectionMatrix(cam.combined);
    spriteBatch.begin();
    for (Sprite platformSprite: world.getPlatformSprites()) {
        platformSprite.draw(spriteBatch);
    }
    spriteBatch.end();
    ...

}

The game works fine when I don't move the camera. But when I do, the platforms aren't placed where I click, they're always either higher or lower where I actually clicked. Also, the platforms are always placed somewhere where the camera was originally looking before anything has been moved.

I think it's doing this is because for some reason, the coordinates never actually change. So wherever I am on the map, the top of the screen is always 120 and the bottom is always 90. This also causes objects on the map to have different coordinates if I move the camera.

This problem has me completely lost and I would appreciate any help.

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:
Looking for a good technique for character movement in hack&slash game I'm making hack&slash game and I want my characters move like for example in Torchlight, Diablo, etc.
Currently I generate set of nodes for all walkable areas of a floor. When I click somewhere player goes there
through interpolated path of nodes. This doesn't look very natural. Player moves like a robot.
Enemies also use this node system for movement and share the same issue but I have one more problem with them.
When enemies detect player they go to him by a shortest path. Sometimes they use the same path and line up
to the player instead of surrounding him. I don't know how to make enemies choose different paths and surround the player.
Do you know how can I solve this problems?
Maybe I should use different approach for character movement?

My current technique:

Torchlight screenshot:

---UPDATE---

I want to know how to deal with these situations:

Situation 1, I have dynamic/static obstalces on my way

Situation 2, Enemies have the sam path to player ( get into queue to fight with us )

sentences:
How to design the AI for a board game like Risk? I am about to develop a web game that is similar to board games like Risk, and iOS games like Lux and Strategery. I am curious to know what the concept behind the AI for such games should be like.

I know it's going to involve a lot of move calculations and and calculating all possible options. But can someone elaborate on this please? I am actually a web programmer who usually develop websites and program logic to them, so game development is something new to me.

Also, my boss would like to implement different difficulty levels for the AI. What are the principles behind something like this? Would the difficulty level correspond with how many steps/turns ahead the AI would calculate for each movement? (Like easiest difficulty would be the AI only calculating all possible moves for this turn, whereas in the next level of difficulty, the AI would calculate all possible moves for this turn and the next turn?)

Thanks!

sentences:
VS2013: Compiling Shaders with Shader Model 5.0 When I try to compile two HLSL files included in my project, the compilation fails with an error:

  Error error X4502: invalid vs_2_0 input semantic 'INSTANCE'

However, I notice it's trying to use shader model 2.0; when I'm trying to use 5.0:

Why is the shader compiler trying to use the 2.0 model when I've told VS to use 5.0? Or have I misunderstood?

sentences:
How do I safely change properties on my skybox? Usually in Unity, when your scripts make changes to something at runtime, those changes are not persisted back to design-time.  This is generally considered a good thing.  But for whatever bizarre technical reason, this does not apply to shader properties on materials.  If you change something while the game is running, it stays changed!
Generally the way to get around this is with a MaterialPropertyBlock, which also helps avoid generating a lot of garbage.  But MaterialPropertyBlocks work with Renderers, which leaves out one rather important material: the skybox.
Right now, I have code that says RenderSettings.skybox.SetFloat("_PropName", value);, and it's incredibly aggravating because it always needs to be reset afterwards.  RenderSettings doesn't have a SkyboxRenderer property that I can use in conjunction with a MaterialPropertyBlock, so how can I change shader settings on my skybox and make them not persist after I exit play mode?

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:
How do I fix objects "popping" or jittering in physics engine? I've got a simple physics engine that solves collisions by simply correcting the position of overlapping bodies (just circles for now) directly, as opposed to just changing the velocity or applying an impulse. Velocity is only changed after impacts are already resolved, or during the integration part.

I've had the problem that in heaps of objects the top objects apply too much pressure (this exists implicitly, there's no pressure modelling in the algorithm) on the objects at the bottom of the heap, which results in them getting pushed through floors, etc.

I wanted to fix this by sorting the objects by their y-coordinate, so the collisions are resolved bottom-up. But now, the engine shows weird popping behavior for objects which should actually be at rest (see gif)

Without just giving you the source code - what could this be?

sentences:
Prevent keyframe interpolation in imported model animation in Unity I made first person model in blender. It also has animations in it.

Most of animation works fine, but in some cases, Unity's keyframe interpolation makes wrong result.

Note that animation was made by 60 frames per second in Blender.

To explain my problem, you have to see my model:

As you can see there are two magazines. Each named Mag1 and Mag2 and Mag1 is the magazine that attached to the gun.

Mag2 is always located very bottom of the screen so that it is impossible to see, except reloading animation.

While reloading, first pull out the mag1 from the gun and put in the mag2 to the gun. And here is the trick, after mag2 is attached to a gun, hand put the mag1 somewhere, maybe magazine pouch.

Anyway as soon as mag1 disappeared from the screen, it switches mag1 and mag2 immediately at only single frame. So mag1 is now move back to the gun and mag2 is also reloated to bottom.

In Blender, it seems nothing wrong but in Unity is quite different. As soon as mag1 disappeared, it doesn't switched immediately and it moves smoothly animated so I can see that magazines were moved. I'm pretty sure that this happens maybe Unity interpolates keyframes.

I already turned off Animation Compression option and resample curves, but still won't worked.

This is the video that I made to explain my situation:
https://www.youtube.com/watch?v=7aew959ejL4&feature=youtu.be

Is there a way to "turn off" that interpolation? I want to disable it only that frame. Unity doesn't allow me to edit animation clip, so I just duplicate animation clip and change the option(I don't know what it called) to "Flat" and use that clip instead, but still have same problem. (Note that it wasn't easy because Unity doesn't show me the animation if I duplicate and modify it)

I struggled this issue almost a year and still figuring out how to fix it, and I think it's time to solve it. Any advice will very appreciate it.

sentences:
Light Map Generation using DirectX I'm trying to build lightmaps for an engine I'm working on. I'm using DirectX 9 w/c++ but my questions are related to the methodology behing the generation of light maps.

I have a scene built from collections of mesh objects. The scene is divided into an octree. I want to generate a light map for each of the octree nodes or possibly 1 light map for a subdivision( 8 nodes ).

I've read the tutorial on flipcode.com(  here  ). For the explanation on "calculating/retrieving light map texture coordinates the tutorial refers the reader to a broken link.

I'd appreciate a list of instructions on 'what' to do in order to complete this process...I've found bits and pieces from different sites that have different implementations and its hard to piece it together. How do I assign a polygon to a specific area of the light map?

sentences:
How to implement a shotgun in a game? Pistols and machine guns are easy - you can just have bullets flying in a certain direction, so I already implemented that. A shotgun, on the other hand, does damage to anything in a certain area that looks like a cone. How should I implement that? I have a couple suggestions here, but I could use some advice:

Split a bullet in multiple little bullets, that do less damage by themselves, but fly in a similar direction (a closer enemy is more likely to be hit)
Not use bullets - just have a particle effect of a shotgun shot and calculate how much damage enemies get based on position/orientation etc.
Have a big invisible bullet (a cube for example) that damages things, as well as a particle effect that will make it look like it's actually a shotgun shot.

Thanks in advance!

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:
Optimization with VBOs I am currently working on a cube engine and am experiencing some issues with CPU optimization.

I store all my quad VBO data inside a Block (at x,y,z of a chunk) class, which is stored inside an array with a length of 6 (the maximum number of cube faces). I would prefer to merge it all inside one VBO. The only issue I am having with this is that I cannot find a way to render 6 different textures on each face.

    GL11.glPushMatrix();
    GL11.glTranslatef(LENGTH.x * origin.x, LENGTH.y * origin.y, LENGTH.z * origin.z);
    for (int z = 0; z < LENGTH.z; z++) {
        for (int y = 0; y < LENGTH.y; y++) {
            for (int x = 0; x < LENGTH.x; x++) {
                Block b = get(x, y, z);
                if (b.getBlockType().isTransparent() || b.getVisibleFaces() == 0)
                    continue;
                GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
                GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
                for (int i=0; i < b.getVertexBuffers().length; i++) {
                    QuadVBO q = b.getVertexBuffers()[i];
                    if (q == null || !q.isValid())
                        continue;
                    Game.GRASS.bind(i);
                    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, QuadVBO.faceHandles[i].get(0));
                    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
                    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, q.getVertexHandle());
                    GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
                    GL11.glNormalPointer(GL11.GL_FLOAT, 0, q.getPointerVerticesBytes());
                    GL11.glDrawArrays(GL11.GL_QUADS, 0, q.getVerticesCount());
                    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
                }
                GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
                GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
            }
        }
    }
    GL11.glPopMatrix();

I am aware that this is a horrible way to do it but I cannot seem to find a better way to render these cubes on a screen, any help would be extremely appreciated!

sentences:
Load a simple text file through asset manager in libgdx It's easy to load a simple text file from the internal:

Gdx.files.internal("data/colors.txt");

But I currently use an AssetManager to load assets that are defined in an array of AssetDescriptor<?>s while a loading screen (with a progress indicator) is shown. So I'd like to use something like this in my array of descriptors:

...
new AssetDescriptor<_type_>(Gdx.files.internal("data/colors.txt"), _type_.class),
...

I'd like to load the file through an asset manager, so the overall progress can be displayed as the data/colors.txt file can get very large and therefore take longer to load (I use an tool to automatically generate a very long list of color definitions: RRR,GGG,BBB,AAA, each in the range of 0-255).

Is there a good way of doing this?

sentences:
Fixed background on a SurfaceView I'm currently working on a top-down twin-stick shooter for Android. I've got my player moving around and shooting, but I'm looking to add a large Bitmap background which is larger than the device screen.

I'm looking for a way to position the background at 0,0 in 'world' co-ordinates, and have the view able to pan across the background with the player. I've tried using SurfaceHolder.Callbacks, but these do not seem to play nicely with my SurfaceView class. The view currently follows the player while keeping it centred, until it reaches an edge, where it will stop and the player will continue until he hits a wall.

My current thoughts are to store an offset from view co-ordinates to world co-ordinates in the update loop, and draw the bitmap using these offsets in the draw loop. Is there a more efficient way to do this, or a different way to think about it?

sentences:
Objective-C to plain c iPhone game performance improvements I'm testing a 2D OpenGL ES based iPhone game on both the iPhone 3G and the iPhone 4.  It runs great on the iPhone 4... and pretty well on the 3G.  The game state is updated at 60 Hz... and the rendering is done at 60 fps.  Would the following conversion from Objective-C to c improve the performance at all?

// current Objective-C function
- (void) updateSomething {
    // simple update like x_position += 2.0;
}

// plain c function
void updateSomething(){
    // simple update like x_position += 2.0;
}

Assume these functions are called at a rate of 60 Hz.  The reason I'm curious is this blog post.  The author mentions substantial performance improvements when making a similar conversion.

Cheers!

Edit:  after running w/ the CPU Sampler instrument in XCode it looks like about 65% of the function calls are to mach_msg_trap.  objc_msgSend apparently takes up a trivial amount of resources.

sentences:
What's the best way to train PID controllers? This is borderline non-gamedev but PIDs are commonly used in games so I thought I'd give it a shot.

I've got a few PID controllers in my game, used for things like steering and throttle control. I'm having trouble tuning them accurately.  It never feels like I'm getting closer to the optimial solution, and it's very tempting to just leave them "good enough" with the odd oscillation or spike I can't get rid of.

The one controller that's driven me to this post with frustration produces minor oscillations for very very small error inputs.  At large inputs it's ok but not very stable.

Does anyone have any tips or resources on how I can train these things more reliably?

sentences:
Java - Finding distance between player and tile in array What is the best way performance wise to do this? When I click a tile I want it to get the distance and if I am close enough I can interact with the tile. One way would be to find the tile by doing mouse / tile width when I click correct? But then how would I get that tiles position? I know how to find the distance I just don't know how to get a certain tiles position from the array when I click it

public void checkDistance(GameContainer gc) {
    Input input = gc.getInput();

    float mouseX = input.getMouseX();
    float mouseY = input.getMouseY();

    double mousetileX = Math.floor(mouseX/tiles.tileWidth);
    double mousetileY = Math.floor(mouseY/tiles.tileHeight);

    //Distance code
    double lengthX = Math.abs(playerX - mousetileX);
    double lengthY = Math.abs(playerY - mousetileY);
    double distance = Math.sqrt((lengthX*lengthX)+(lengthY+lengthY));

    System.out.println(distance);
}

sentences:
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:
Adding gravity to arrival steering behavior I trying to write an autopilot for the classic Lunar Lander or its clones.

According to this paper, the arrival behavior is exactly what I need for a soft landing. In this example, it accelerates at max_speed until it's near the target and decreases near the target to zero. Adding gravity and a engine to decelerate makes this a lot more complicated, at least for me since I couldn't wrap my head around the concept for the past few hours.

Currently my spaceship moves in the right direction but doesn't counter gravity and just throttles the engine, crashing near the target. I know my current position, velocity and the gravity is constant. I need to output thrust-levels (0-4) with a -90° to 90° angle.

Can you give me some pointers as to how I could incorporate gravity into this steering behavior?

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:
Balance in online PvP games I don't know if there's an accepted solution to this wicked problem. I'm thinking about the design of an online PvP game. A key aspect of the game, something that is just a given, and not my choice, is that people will join the game at very different times. New players can still show up after there are already powerful players established.

How is it possible to balance such a game so that latecomers aren't immediately crushed by the powerful players? I've played several games like this, and the only way I've seen to mitigate this is to have regular restarts, where new game worlds are released periodically to give everyone a fair start. In one of my own games, I tried a protection system, where new players were immune from attack for 25 days. This worked, until the 25 days were up, whereby the crushing commenced as normal.

This scenario causes a lot of frustration with new players, and makes many of them quit right away. Are there any genius solutions that might help? One I have in mind is keeping new players more physically distant from old ones so it takes the powerful players a while to find the newbies, giving them time to defend themselves. Thoughts?

sentences:
Question about separating game core engine from game graphics engine Suppose I have a SquareObject class, which implements IDrawable, an interface which contains the method void Draw(). I want to separate drawing logic itself from the game core engine.

My main idea is to create a static class which is responsible to dispatch actions to the graphic engine.

public static class DrawDispatcher<T>
{
    private static Action<T> DrawAction = new Action<T>((ObjectToDraw)=>{});
    public static void SetDrawAction(Action<T> action)
    {
        DrawAction = action;
    }
    public static void Dispatch(this T Obj)
    {
        DrawAction(Obj);
    }
}

public static class Extensions
{
    public static void DispatchDraw<T>(this object Obj)
    {
        DrawDispatcher<T>.DispatchDraw((T)Obj);
    }
}

Then, on the core side:

public class SquareObject: GameObject, IDrawable
{
    #region Interface
    public void Draw()
    {
        this.DispatchDraw<SquareObject>();
    }
    #endregion
}

And on the graphics side:

public static class SquareRender{
    //stuff here
    public static void Initialize(){
        DrawDispatcher<SquareObject>.SetDrawAction((Square)=>{//my square rendering logic});
    }
}

Do this "pattern" follow best practices?

And a plus, I could easily change the render scheme of each object by changing the DispatchDraw parameter, as in:

public class SuperSquareObject: GameObject, IDrawable
{
    #region Interface
    public void Draw()
    {
        this.DispatchDraw<SquareObject>();
    }
    #endregion
}
public class RedSquareObject: GameObject, IDrawable
{
    #region Interface
    public void Draw()
    {
        this.DispatchDraw<RedSquareObject>();
    }
    #endregion
}

RedSquareObject would have its own render method, but SuperSquareObject would render as a normal SquareObject

I'm just asking because i do not want to reinvent the wheel, and there may be a design pattern similar (and better) to this that I may be not acknowledged of.

Thanks in advance!

sentences:
Random Movement for multiple entities I have this code for a arraylist of entities.

All the entities use the same random and so all of them move in the same direction. How can I change it so it generates a new random number for each entity?

public void moveFemale() {
    for(int i = 0; i < 1000; i++){
        random = rand.nextInt(99);
    }

    if (random >= 0 && random <= 25) {
        posX -= enemyWalkSpeed; // right
    }

    if (random >= 26 && random <= 50) {
        posX += enemyWalkSpeed; // left
    }

    if (random >= 51 && random <= 75) {
        posY -= enemyWalkSpeed; // up
    }

    if (random >= 76 && random <= 100) {
        posY += enemyWalkSpeed; // down
    }
}

Is this correct?

public void moveFemale() {
    for (Female female: GameFrame.females){

        female.lastChangedDirectionTime += elapsedTime;

        if (female.lastChangedDirectionTime >= CHANGE_DIRECTION_TIME)
        {
            female.lastChangedDirectionTime = 0;

            random = rand.nextInt(100);

            if (random >= 0 && random <= 25) {
                posX -= enemyWalkSpeed; // right
            }

            if (random >= 26 && random <= 50) {
                posX += enemyWalkSpeed; // left
            }

            if (random >= 51 && random <= 75) {
                posY -= enemyWalkSpeed; // up
            }

            if (random >= 76 && random <= 100) {
                posY += enemyWalkSpeed; // down
            }
        }
        }
    }

sentences:
Vulkan: Unable to render using multiple view ports I have been trying to enable multiple viewports in my Vulkan Pipeline but have been unsucsessfull. I used this code sample as a reference point. The problem is that when I attempt to draw two side by side (splitscreen) views of a scene I am unsuccessful.

Pipeline Initialisation

// Viewport state
VkPipelineViewportStateCreateInfo viewport_state = initializers::PipelineViewportStateCreateInfo(CameraComponent::GetCameraCount(), CameraComponent::GetCameraCount());

// Dynamic shader stages
std::vector<VkDynamicState> dynamic_states = {
    VK_DYNAMIC_STATE_VIEWPORT,
    VK_DYNAMIC_STATE_SCISSOR,
    VK_DYNAMIC_STATE_LINE_WIDTH,
};
VkPipelineDynamicStateCreateInfo dynamic_states_info = initializers::PipelineDynamicStateCreateInfo(dynamic_states);

(Using the debuger shows that CameraComponent::GetCameraCount() is 2)

Command Buffer

vkCmdSetViewport(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetViewports());
vkCmdSetScissor(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetScissors());

(Here CameraComponent::GetCameraCount() is 2 aswell as the viewport and scissor methods returning valid data)

When Using Nvidia NSight we can see that both Scissors and Viewports are detected

As well as there position data existing within the gpu

But when it comes to the result, all that is visible is half of the screen.

When I flip the cameras around within the code, the second half is rendered instead showing that the first camera is being rendered but not the second one.

sentences:
How do I make a character selector? What's the best way to make a character selector similar to DOTA 2 game, but instead of having an unique animation for the hero it just displays the sprite of the character, the game is 2D.

public GameObject[] gCharacters;
private float[] characterScales;
public GameObject Image;
int i = -600;
public Sprite sprite;

void Start()
{
    characterScales = new float[gCharacters.Length];
    for (int x = 1; x <= gCharacters.Length; x++)
    {
        GameObject inst = Instantiate(Image, Image.transform.position, Image.transform.rotation) as GameObject;
        inst.GetComponent<RectTransform>().position = new Vector2(gameObject.GetComponent<RectTransform>().position.x + i, gameObject.GetComponent<RectTransform>().position.y);
        inst.transform.parent = transform;
        sprite = gCharacters[2].GetComponent<SpriteRenderer>().sprite;
        Image.GetComponent<Image>().overrideSprite = sprite;
        i += 200;
    }
}

For the sprites to be displayed which is my main goal here I've used the IMAGE UI.

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:
Prevent collisions between mobs/npcs/units piloted by computer AI : How to avoid mobile obstacles? Lets says we have character a starting at point A and character b starting at point B. character a is headed to point B and character b is headed to point A. There are several simple ways to find the path(I will be using Dijkstra). The question is, how do I take preventative action in the code to stop the two from colliding with one another?

case2: Characters a and b start from the same point in different times. Character b starts later and is the faster of the two. How do I make character b walk around character a without going through it?

case3:Lets say we have m such characters in each side and there is sufficient room to pass through without the characters overlapping with one another. How do I stop the two groups of characters from "walking on top of one another" and allow them pass around one another in a natural organic way.

A correct answer would be any algorithm, that given the path to the destination and a list of mobile objects that block the path, finds an alternative path or stops without stopping all units when there is sufficient room to traverse.

sentences: Instancing effectiviness At about how many instances would instancing become effective? DirectX dynamic buffers seem to take a little more out of the fps than an immutable one would. So obviously you wouldn't want to make a dynamic buffer for one mesh. What about two or three? I realize there's probably many variables to take into account but just to get a grasp on it?

sentences:
Read function outside of code while run-time? Hi it is my first post on this community. So if i was rude or something please let me know :)

So I just started learning game development alone. It's been about 1 year since I begin to learn c and c++.
Recently I started planning to make a game for my own entertainment and future career.

I'm trying to make the game as mod-friendly as possible.
So I thought that I should make abstract classes that have most of the functions for working on run-time. Then when the game starts, the system reads mod files for filling out class information and stores that base object in some data storage made with a singleton(for easy access). And, then use a factory pattern(I hope I'm using it right) to copy the base object that I need, fill it with basic information and store it in the object storage.

The problem is, I can't figure out how I can make it so each object from each mod file acts with its own behavior.

For example:
Core mod(main game) has an abstract class named 'living entity'
'Living entity' has some information like bone structure type, mesh name, entity size, etc...
And a mod file from the core mod makes a 'human' class that has information for 'human bone type','basic human','human size' etc
The human class does not need any special functions because it only uses basic functions that the game provides.

But modder A wants to make a Vampire entity.
Vampire will have information like a human. So modder A fills up or copies the 'human' file and edits the class id value with which the system identifies objects and uses as a name.
Vampire needs new skills, health effects and custom death(leaves an ash pile instead of a corpse)
The game also has skills and health effects as a kind of component or class. So modder A fills up information but one of the skills has a unique projectile effect or one of the health effects has a unique behavior that the game does not provide
So modder A wants to override projectile or health functions only for the vampire's unique skill or health

In this case how would I support them to override functions for their own needs?
One of my idea was to read the dll and store function pointers in data storage and put the code on a base abstract object and then call it if the object has a custom function.
But I am not sure this works and that it is how people do it.
So if there is some kind of information or documentation for that please let me know
I'm arguing with this problem about month D;

sentences: Is storing data via property lists in an iPhone application's documents directory secure? Is storing game state in plists in an iPhone application’s documents directory a secure method?  Meaning, does anything other than the application have access to that directory?

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:
Converting coordinate systems to/from an isometric game world I have tried searching and reading for an answer, but the information I could dig up either didn't fit what I need or was in the form akin to "Just multiply the vectors with the inverse matrix of.." which to my brain (unfortunately) makes just as much sense as someone speaking Mandarin.

The plan is to use requestAnimationFrame and canvas for the drawing, and WebSockets for the communication. I already have a fair grasp of requestAnimationFrame and canvas, and some hacked together code for a php WebSockets server with support for most of the currently-in-use drafts. This is a project for fun and learning so please, no comments on how silly it is to write server software in php

The main hurdle arises when I try to implement movement. I have code for drawing a map both as staggered and diamond shaped. I even had click-to-walk type movement implemented, but I hit a wall when it came time to implement collision detection.

See, my player exists in the coordinate system of the canvas, along with mouse events etc. What I did was draw the character sprite in the middle of the canvas, and animate the offset of the map by the difference between the center of the canvas and a clicked point. Thing is, I would like to keep my "world" (e.g. map, player, objects/entities) in memory as a regular grid map, and just have everything drawn with isometric skewing. This would make implementing collision detection very simple.

As it is right now, adding 32px to the players x-coordinate doesn't move him along the maps x-axis but rather that of the canvas. If increasing the player's x moved him along the maps x-axis then as I said, implementing collision detection would be as simple as checking whether the next tile along that axis is blocking or not, and update my x-position based on that.

Short question is: given the player's x- and y-coordinates, how do I calculate the appropriate map offset so that increasing either coordinate will move the player along the appropriate "in-game" axis?

Thanks, and a link to my hacked together initial test: http://dev.plastbox.org/isoengine/ It's continually being modified though, so it might not work at all every now and then.

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:
Make continuos movements with controllers in LibGDX I've been trying to make the OUYA controlers work with a LibGDX Framework Practice Game.

Everything is working perfectly expected for one thing : The movements are not continuos.

The problem is, when I press the DPAD or the Joystick into the right for example, it moves for the number of pixels I've defined and then stops, I need to release the button and press again.

When I use the Keyboard I put the code on the "render" method, using this method when I press the Right Arrow Key the sprite won't stop movie until I release the button, but since the controller use a ControllerListener I don't really know how to solve this issue.

This is what I have so far :

public class MyOntem extends ApplicationAdapter implements ApplicationListener, ControllerListener {
SpriteBatch batch;
Sprite sprite;

@Override
public void create () {
    batch = new SpriteBatch();
    sprite = new Sprite(new Texture("badlogic.jpg"));
}

@Override
public void render () {
    if (Gdx.input.isKeyPressed(Input.Keys.DPAD_RIGHT))
        sprite.setX(sprite.getX() + 10f);

    if (Gdx.input.isKeyPressed(Input.Keys.DPAD_LEFT))
        sprite.setX(sprite.getX() - 10f);

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    batch.draw(sprite, sprite.getX(), sprite.getY());
    batch.end();
}

@Override
public boolean buttonDown(Controller controller, int buttonCode) {
    if(buttonCode == Ouya.BUTTON_Y)
        sprite.setY(sprite.getY() + 1);
    if(buttonCode == Ouya.BUTTON_O)
        sprite.setY(sprite.getY()-1);
    if(buttonCode == Ouya.BUTTON_U)
        sprite.setX(sprite.getX() - 1);
    if(buttonCode == Ouya.BUTTON_A)
        sprite.setX(sprite.getX() + 1);

    return false;
}

@Override
public boolean axisMoved(Controller controller, int axisCode, float value) {
    // Left Stick
    if(axisCode == Ouya.AXIS_LEFT_X)
        sprite.translateX(10f * value);
    if(axisCode == Ouya.AXIS_LEFT_Y)
        sprite.translateY(-10f * value);

    // Right stick
    if(axisCode == Ouya.AXIS_RIGHT_X)
        sprite.rotate(10f * value);
    return false;
}

Thank you in Advance.

sentences:
What shape should you use for player collision? I'm working on a simple Box2D platformer, and I was wondering, what is the best shape to use for the player's box? I'm currently using a circle with a radius of 10, but that doesn't work well, as when the player collides with a corner, they can get stuck on it, or won't be able to move forwards properly and it feels really awkward. What should I use instead?

I've heard ovals work well for this kind of thing, but there's no easy way to create an oval in B2D without creating 3 circles on top of each other. I've also seen rectangles used, but aren't those less accurate?

sentences:
Most common 3D model format for opengl I'm a novice that is starting to play with OpenGL ES on Android devices. To practice OpenGL I wanted to create a small game engine and so I was wondering what the best 3D model file format would be.

I'm also interested in free models of the same format.

What do you suggest?

sentences:
Detecting a sequence of nodes in a grid Given the image below, I need to detect the most optimal sequence on the board (the green line). The blue/red lines represent possible, but not the best moves.

Here are the rules:

You can move to any tile that is the same, and is your neighbor (diagonal is valid)
Once you have visited a tile, you can't visit it again.

I have thought about looping through each node, and looking at its neighbors, then recursively going through. Once I find a possible move I can put it into a structure. Once all possible moves are found I just pick the move with the highest count of node. It becomes more difficult when a node has more than one neighbor that matches.

So, is there some algorithm that I can use? I was thinking some sort of flood fill, but that doesn't meet rules #2.

As requested, here is a video of similar gameplay. http://youtube.com/watch?v=eumnCTG0AE8

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: V8 JavaScript Engine and Mac App Store If I embed the V8 JavaScript Engine in my game is it still possible to distribute it in the Mac App Store?

sentences:
What game mechanics work best on mobile phones? I teach Swift 3 and Android Studio. My students are always asking why I'm not in the mobile market yet; frankly, I'm migrating my 88 games from flash into native mobile apps ... it takes time. My question is: What game mechanics are most successful in the mobile apps for a profitable endeavor? Puzzle sliders? PacMan-ish chases?

I know there are 7 different methods of input, but which provide fun entertaining games? I could use some advice.

sentences:
Unity override Coroutine Loop I have problem, when i override a Coroutine loop from the base code. But it seems that it only execute once. While on the base code it does what it suppouse to do and that is execute forever.

protected virtual IEnumerator OnThink(float interval)
{
    while (true)
    {
        yield return new WaitForSeconds(interval);
    }
}

protected override IEnumerator OnThink(float interval)
{
    Debug.Log("Execute");
    yield return StartCoroutine(base.OnThink(interval));
}

sentences:
What are some valuable conferences for game developers? Lately I was thinking of visiting a Game Developer Conference and so I search the Internet, but I didn't find a thorough list of available Conferences. Now I know some of them, like the GDC in San Francisco but I was wondering, what other Game Developer Conferences are out there.

So my question is: What Game Dev Conferences do you know, that are valuable for Game Developers and Game Designers? Have you visited one of these Conferences yourself? Is there a skill level needed to appreciate such a Conference?

I am aware, that there is no "true" answer to this question, but I think, that an overview over existing Conferences could be usefull for all levels of game developers.

sentences:
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: 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:
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:
How do I loop my animations seamlessly? I am trying a complete my method, which crops Maya-Animations (from Maya-Models) to specific ones using the SkinnedModelProcessor.

My only problem is, that after one animation-loop completes, the model stays in its last position for about 2-3 seconds until he catches up to the run-cycle again.

My goal is to get rid of that freeze time.
I want to loop it seamlessly.

Here is what I wrote:

public AnimationClip getCurrentAnimation(string clipName, string cropName, float blendTime, int beginFrame, int endFrame, int totalFrames)
{
    //The new list which only has the specific keyframes
    List<Keyframe> region = new List<Keyframe>();

    //The original clip "Take 001" from Maya, which has every
    //animation in one timeline
    AnimationClip clip = _skinningData.AnimationClips[clipName];

    //The new duration of the cropped clip
    int duration = 0;

    //Since XNA makes 7502 frames out of 21, I have to
    //calc the region-keyframes to proper numbers
    if (endFrame == 0)
        endFrame = clip.Keyframes.Count;
    else
        endFrame = ((endFrame * clip.Keyframes.Count) / totalFrames);

        beginFrame = ((beginFrame * clip.Keyframes.Count) / totalFrames);

    //Start to sort out
        for (int i = beginFrame; i < endFrame; i += 1)
        {
           Keyframe k = clip.Keyframes[i];

           //Add duration of 16 (60fps) to overall-length
           //of animation, if this keyframe does some "real"
           //transformation, instead of being a static keyframe of XNA
           if (k.Time.Milliseconds > duration)
                duration += 16;

            k.Time = TimeSpan.FromMilliseconds(duration);
            region.Add(k);
         }

         AnimationClip cropped = new AnimationClip(cropName, TimeSpan.FromMilliseconds(duration), region);
         return cropped;
}

sentences:
Can I change the order of these OpenGL / Win32 calls? I've been adapting the NeHe OpenGL/Win32 code to be more object-oriented and I don't like the way some of the calls are structured.
The example has the following pseudo-structure:

Register window class
Change display settings with a DEVMODE
Adjust window rect
Create window
Get DC
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Show the window
Set it to foreground
Set it to having focus
Resize the GL scene
Init GL

The points in bold are what I want to move into a rendering class (the rest are what I see being pure Win32 calls) but I'm not sure if I can call them after the Win32 calls.
Essentially what I'm aiming for is to encapsulate the Win32 calls into a Platform::Initiate() type method and the rest into a sort of Renderer::Initiate() method.
So my question essentially boils down to: "Would OpenGL allow these methods to be called in this order?"

Register window class
Adjust window rect
Create window
Get DC
Show the window
Set it to foreground
Set it to having focus
Change display settings with a DEVMODE
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Resize the GL scene
Init GL

(obviously passing through the appropriate window handles and device contexts)
Thanks in advance.

sentences:
Networking in real-time strategy games What is the current state-of-the-art to network real-time strategy games?

I seem to recall that a few years ago, some AAA titles only transmitted the player inputs (Starcraft 1, Age of Empires). Since this requires you to keep everything else totally deterministic, is this still a viable option? Synchronizing random number generators seems feasible, but what about subtle differences in FPU implementations etc..?

Or are strategy games using something closer to action-game networking, where individual entities are transmitted instead (with some form of prediction and (delta) compression)?

If so, how are volatile items like projectiles treated?

What about client/server versus peer-to-peer? I'm guessing that all this is strongly interrelated.

Thank you for your time!

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:
2D animation example in pyglet (python) looping through 2 images/sprites every x seconds Suppose you have two images: step1.png and step2.png .

Can anyone show me a very simple example in pyglet how to loop through those 2 images say every 0.5 seconds?

The character doesn't have to move, just a simple black screen with a fixed region wherein the two images continually change every 0.5 secs.

I know how to make a character move, shoot projectiles etc. but I just can't figure out how to control the looping speed of the images.

sentences:
Simple real-time 3D wind simulation I am a 4th-year student in the apply math department. It's my final year, so I am working on my bachelor's thesis. The topic is "Real-time weather effects simulation for grassland". The huge work was done by my tutor, so the grassland simulation itself had been already implemented. Now we decided to limit the work to adding 3d wind modal and snowfall for result presentation. The snow particle system has been implemented recently, however, I've coped with problems while seeking information on how to implement real-time 3d wind field simulation.
There are plenty of quite complex articles on how to simplify real turbulence simulation, but it's too excessive for my work. On the other hand, there are quite simple 2D approaches using Perlin Noise, but I can't find something like that for the 3-dimensional scene.
Summing up, Could someone share some typical solution for my issue, or just post a good link?
Thank's a lot in advance and sorry for my poor English.
UPD Screenshot of the scene for whatever it may be worth

sentences:
How can I distribute a native executable for a Python program? Lately all of my work has been in Python (and Ruby), and I'm in love with those two languages. There are many libraries for game development on Python but the problem I see is that many of those frameworks don't cover the "distribution" aspect of game creation. I'd like to code my game on Python (and any other pure Python extra libraries I need) and be able to distribute an executable for the main PC platforms (Windows, Mac and Linux).

Any options out there or what are the best combinations for this? (maybe pyglet + cx_freeze)

sentences:
What should I do if my text exceeds my text render target boundaries? I have a method for drawing strings in 3D that does the following:

Set a render target
Draw each character as a quadrangle using a orthographic projection to the render target
Unset the render target
Draw the render target texture using a perspective projection and a world transform

My problem is how to deal with strings whose characters length exceeds that of the render target dimensions?  For example if I have string "This is a reallllllllllly long string" and the render target can't accommodate it, it will only capture "This is a realllll".

The render target (and its size) could be set each frame but wouldn't that be far too costly?

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:
"Walking" along a rotating surface in LimeJS I'm trying to have a character walk along a plank (a long, thin rectangle) that works like a seesaw, being rotated around a central point by box2d physics (falling objects). I want the left and right arrow keys to move the player up and down the plank, regardless of it's slope, and I don't want to use real physics for the player movement.

My idea for achieving this was to compute the coordinate based on the rotation of the plank and the current location "up" or "down" the board.

My math is derived from here:
https://math.stackexchange.com/questions/143932/calculate-point-given-x-y-angle-and-distance

Here's the code I have so far:

movement = 0;
if(keys[37]){ // Left
    movement = -3;
}

if(keys[39]){ // Right
    movement = 3;
}

// this.plank is a LimeJS sprite.
// getRotation() Should return an angle in degrees
var rotation = this.plank.getRotation();

// this.current_plank_location is initialized as 0
this.current_plank_location += movement;

var x_difference = this.current_plank_location * Math.cos(rotation);
var y_difference = this.current_plank_location * Math.sin(rotation);

this.setPosition(seesaw.PLANK_CENTER_X + x_difference, seesaw.PLANK_CENTER_Y + y_difference);

This code causes the player to swing around in a circle when they are out of the center of the plank given a slight change in rotation of the plank.

Any ideas on how I can get the player position to follow the board position?

sentences:
Smoothen line on linerender I've created a square using linerenderer but my problem now is that the line is not smooth. see below picture. I've tried enabling anti-aliasing and setting lr.numCapVertices to no avail.

 private void DrawLine()
{
GameObject myLine = new GameObject();
myLine.transform.position = start;
myLine.AddComponent<LineRenderer>();
lr = myLine.GetComponent<LineRenderer>();
lr.material = new Material(Shader.Find("Sprites/Default"));
lr.positionCount = 4;
lr.startWidth = .1f;
lr.endWidth = .1f;

lr.SetPosition(0, new Vector3(1, 0, 0));
lr.SetPosition(1, new Vector3(2, 0, 0));
lr.SetPosition(2, new Vector3(2, -1, 0));
lr.SetPosition(3, new Vector3(1, -1, 0));
lr.loop = true;

Gradient gradient = new Gradient();
gradient.SetKeys(
    new GradientColorKey[]
    {
        new GradientColorKey(Color.red, 0.25f),
        new GradientColorKey(Color.green, 0.50f),
        new GradientColorKey(Color.blue, 0.75f),
        new GradientColorKey(Color.yellow, 1f),
    },
        new GradientAlphaKey[] { new GradientAlphaKey(1f, 0.0f)

    }
    );
lr.colorGradient = gradient;

}

sentences:
How to get an AbstractClientPlayer for all players? I'm working on an minecraft forge mod (1.8.8). I have en custom (ownable) entity and want to set its texture to the texture of its owner, because it's a mini version of the owner.

I found out that i can get the texture of players with AbstractClientPlayer#getLocationSkin(), but i can't figure out how to access either EntityOtherPlayerMP or EntityPlayerSP, which implement AbstractClientPlayer, in my custom renderer. Is there a way to get all AbstractClientPlayer, regardless of SP or MP? I can access the GameProfile and i have the EntityPlayer of the owner.

sentences:
Simulating Physics - dt vs formula I was just wondering, when simulating physics is it usually a good idea to get the time delta from the last frame and apply the relevant motion equations?

Something like:

void simulate(float dt)
{
    vel += (force / m) * dt;
}

In this case wouldn't there be an accumulated error over time due to precision? For example when trying to simulate a circular motion?

Or would it be better to get the entire elapsed time from the beginning, and then apply the motion:

void simulate(float elapsedTime)
{
    vel = vel0 + (force/m)*elapsedTime;
}

And since this doesn't depend on the previous simulate() steps, it's less likely to cause precision errors?

Thanks!

sentences:
How can I render from a buffer that exists and was created on on the GPU? I'm looking for a unity API or function call to allow me to do the following ...

I wrote some really complex functions that are compute shaders. These compute shaders  manage a huge compute buffer containing voxel information. I then take portions of (or the entire) voxel buffer in another compute shader and produce a vertex buffer. All of this is done on the GPU with only compute shader calls from the CPU.

Now I want to render that vertex buffer but I must be looking in the wrong place because I can't find any information on how this is done within unity despite there being other examples on how to do this using raw DX or openGL approaches.

Can anyone point me in the right direction to determine how I can render using a specified shader a buffer already in graphics RAM (and ideally give it some textures too)?

sentences: Is a programmer liable for copyright infringement in other people's mods to his games? If a programmer (P) releases a game, and a modder (M) releases a game modification which includes copyrighted content, can P be held liable for the copyright infringement in the mod?

sentences:
Given a point on a 2D grid of discrete points, and a normalized direction vector, how to I find the next point in that direction? Say you have a point on a grid, lets call it P and your have a direction vector called V, how do i find the closest point from P in V's direction ?

Example:

1|2|3
4|P|5
6|7|8

V = (0.5 , 0.5)

In this basic example the next point is 3.
How do I make a general algoritm for more complex cases, say V = ( 0.44, -0.56) ?

EDIT:  Just to clarify something in my question. The next point has to be a neighbor to point P.

sentences:
How can I manipulate a static 2D sprite so that it looks alive? I've got a stick figure in the corner of my UI, but I don't like the way he's just standing there, without moving. I'm stuck without additional frames of animation, so my only recourse is the manually move the sprite up and down, left to right, rotation, or whatever else you can think of. Basically I can do everything besides drawing another sprite of animation.

I've tried things like have it subtly bounce or rotate a bit to give it a little bit of dynamism, but I don't believe its the best approach.

I've got a static sprite of a stick figure, how do I give it a bit of life?

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:
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:
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:
What type does one cast the result of "get_function_address" to in order to call the function within a C++ DLL? According to the game maker documentation for dll manipulation:

  get_function_address('function_name')

  Returns the address of a GameMaker function. This can be passed to
  DLL's so the can call directly into GameMaker.

  This feature is unsuported, so care must be taken when using this
  function.

  Please Note: These functions use Delphi 2010 PASCAL calling convention and string formats.

Let's assume one writes a C++ dll and wants to use those function pointers to make game maker function calls within the dll code.

What does one cast the function pointer to? I am familiar with passing a C function pointer to a C++ dll (it is blatantly obvious what you cast the pointer to; the same thing as what you would within the C code). However, I do not know what I would cast functions to coming from game maker. I imagine it is a relatively "simple" thing to do once you know the magic dance. It just doesn't say anywhere what to do.

I think the page might be trying to tell me that this is equivalent to passing a pascal function pointer to a C++ dll. I don't really know. I can't be the only guy with this problem.

sentences:
Setting 4 different enemy spawn zones off screen This is my first game, so I really appreciate all the help.

I want to create four enemy spawn zones for enemies and this areas are off screen. The enemies are coming from left, right, up and down, and their destination is a sprite on the center of the screen. And there are 4 types of enemies (only thing that changes is color).

Current code I have only makes the enemies come from the right direction into the screen. I don't really know the reason of this, I am really new to game making and some of this methods.

Relevant code I have for enemies if the following:

private void createEnemies() {
    listP.add(regionA);
    listP.add(regionV);
    listP.add(regionAm);
    listP.add(regionR);
    Random ran = new Random();
    int z = ran.nextInt(3 - 0 + 1) + 0;
    Sprite ship = loadSprite(100, 100, listP.get(z));
    attachChild(ship);
    Enemies enemy = new Enemies(ship);

}

 @Override
protected void onManagedUpdate(float pSecondsElapsed)   {
    listP.add(regionA);
    listP.add(regionV);
    listP.add(regionAm);
    listP.add(regionR);
    Random ran = new Random();
    int z = ran.nextInt(3 - 0 + 1) + 0;
    super.onManagedUpdate(pSecondsElapsed);
    timeEnemies +=  pSecondsElapsed;        //  Acumulates time
    if  (timeEnemies>TIME_LIMIT)    {   //  Time has completed
        timeEnemies =   0;
        Sprite spriteEnemy  =   loadsprite(GameControl.CAMARA_WIDTH+listP.get(z).getWidth(),
                (float)(Math.random()*GameControl.CAMARA_HEIGHT-listP.get(z).getHeight())   +
                        listP.get(z).getHeight(),listP.get(z));

        Enemigos newEnemy = new Enemies(spriteEnemy);
        //newEnemy.mover(0,10);
        listEnemies.add(newEenemy); //  Adds it to the scene
        attachChild(newEnemy.getEnemySprite()); //  adds to list

    }

    //  Updates enemies and checks if any has gone offscreen
    for (int    i=listEnemies.size()-1; i>=0;   i--)    {
        Enemies enemy   =   listEnemies.get(i);
        enemy.getEnemySprite().setPosition(GameControl.CAMARA_WIDTH,0); // <-- Was experimenting with this code, but doesn't really help now
        enemy.mover(-10,0);
        if  (enemy.getEnemySprite().getX()<-enemy.getEnemySprite().getWidth())  {
            detachChild(enemy.getEnemySprite());        //  Eliminates from scene
            listEnemies.remove(enemy);                                                                  //  Eliminates from the list
        }
        //  Checks collision with center sprite

        if  (spriteCenter.collidesWith(enemy.getEnemySprite())) {
            detachChild(enemy.getEmemySprite());

        }
    }
}

Enemies class:

public class Enemies {

private Sprite sprite;

public Enemies(Sprite sprite) {

    this.sprite = sprite;
}

public Sprite getEnemySprite() {
    return sprite;
}

public void setSprite(Sprite sprite) {
    this.sprite = sprite;
}

public void mover(int dx, int dy) {

    sprite.setPosition( sprite.getX()+dx, sprite.getY()+dy );
}

}

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:
Which coordinate space is the canonical default for each shader pipeline stage? I'm working with Direct3D 11 and HLSL. I use four different shaders (vertex, hull, domain and pixel).

I always have troubles using the right coordinate space in my shaders. Could somebody identify the appropriate space for the vertex, hull, domain and pixel shader stages?

sentences:
Achieving 1 pixel outline around sprites which changes colour depending on the background? Here's an example of what I mean:

In this gif, when the character is on the dark background, his outline is almost black, whilst it retains more colour if the background he's on is the sky one. How can I achieve this in Unity? I don't think it's individual sprites

sentences:
Cross Game Engine Compatibility - Multiple Game Engines for one Game I am new to Game Development, infact getting started with it, so reading as much as I can. I came across game engines. Now atleast I have an idea of what a game engine is, and what it does.

In order of reading about game engines, I came across various game engines - Paid, Freeware, OpenSource. Some are good for physics, some are good for loading images, some for sound. At last, it always comes to performance.

Now what comes to my mind, can I use various game engines to develop one game? I mean, one for loading graphics one for animation one for physics. Is this possible?

I know, game engine is like a CPU, and what I am talking about is using various CPUs to work on one PC.

But whatever it is, can this be done? Cross Game Engine Compatibility?

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 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:
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 to control a 2d charter in an top-down android game with the standard joystick? So I'm building a 2d top-down game and I need to control my character using unity cross-platform standard asset single joystick.
The problem is with the rotation, I don't want to use the dual-stick for some idea related reasons and the designs and the game mechanics that was considered for this game.
So I want the character to have the same rotation as the joystick and since the joystick only has the horizontal and the vertical axies it's hard to get a descent rotation.
So any ideas how to do this? if you need further clarification let me know.

sentences:
Freeglut: Functions missing I'm currently learning OpenGL (in class) and we're using freeglut 2.8.2, which works just fine (using Visual Studio 2012). As an additional learning resource I'm reading the "OpenGL Superbible, 5h Edition". However, I've noticed that there are some functions that aren't available using the freeglut library.

For example, gluGenerateMipmap or setting anisotropic filtering doesn't work:

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, fLargest);
void glGenerateMipmap(GLenum target);

It simply does not know these functions (glTexParameterf is known, GL_TEXTURE_MAX_ANISOTROPY_EXT is not). I've googled a bit but didn't really find anything. And since glGenerateMipmap seems to belong to the standard openGL Library (and not glu/glut), it should be available (I hope).

Is there anything I'm missing?

sentences:
How does one calculate the surface normal, in 2D collisions? I have a ball, which should bounce when it collides with a surface. I know the formula for reflections;
$$ v_1 - 2n(v_1 \cdot n) $$

However, I cannot obtain the required information. I know:

the ball position,
the ball velocity,
the ball radius,
the polygon center
the polgygon width and height
the polgyon corner coordinates

How does one calculate the surface normal, in 2D collisions?

sentences:
How do I know my VRAM upload is ready to be used? Previosuly in Direct3D 9 and 11, if I wanted to update a resource in a Default heap, for example, a Vertex Buffer, I would lock the memory of the buffer, copy the data to the returned pointer, and then unlock the buffer. It is my understanding that unlocking the buffer committed the data to VRAM, and I could be certain that the buffer would be ready to be used by any draw commands.

With Direct3D 12, we now have the concept of upload heaps, and instead of locking the buffer each time I want to modify it, I can just get a mapped pointer to the VRAM area with ID3DResource::Map(). This is pretty cool, because I understand that in most cases, the write is performed with write combining, so I don't have to wait until the entire data is committed to VRAM to keep on doing work on the CPU.

Now the question is, how can I ensure that when I execute a GPU command that references that memory, the memory is already committed, and the GPU can safely read it?

sentences:
How do i put XMMATRIX inside XMFLOAT4X4 I'm currently trying to move my weapon with the camera. To do this i'm creating a vector (tempVect) where i load how much the camera has moved compared to the weapon (in the code behind is just filled with random values to test it). TempTranslation is the XMMATRIX where the translation is stored. result is the XMMATRIX that comes out from the multiplication of tempMatrix and tempTranslation. mPistolWorld is an XMFLOAT4X4 that is going to be loaded into the "world" variable to make the world * view * proj matrix. Now that i have result how can i load it into mPistolWorld ?

XMVECTOR tempVect = XMVectorSet(0.2f, 0.2f, 0.2f, 0);

    tempTranslation = XMMatrixTranslationFromVector(tempVect);

    XMMATRIX tempMatrix = XMLoadFloat4x4(&mPistolWorld);

    XMMATRIX result = XMMatrixMultiply(tempMatrix, tempTranslation);

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:
Problem with collisions with tiles, using AABB After having a little look around about collisions. I can't seem to find what i'm doing wrong every time i touch the bottom of the tile it send's me through it and throws me out to the right of the tiles. I maybe going about this the wrong way if someone could help i'd be very grateful i'll copy all the relevant code down below.

void Game::update(float dt)
{
//check collision with world
vector<Tile>* world = level.getLevel();
for (int i = 0; i < (int)world->size(); i++)
{
    if ((*world)[i].isAlive())
    {
        //if "alive" check collision
        //world tile that are not alive don't do checks
        if (checkCollision(&mario, &(*world)[i]))
        {
            mario.collisionResponse(&(*world)[i]);
        }
    }

}

bool Game::checkCollision(MySprite* sprite, MySprite* sprite2)
{
 if (sprite->getAABB().left + sprite->getAABB().width <sprite2->getAABB().left)
    return false;
 if (sprite->getAABB().left > sprite2->getAABB().left + sprite2->getAABB().width)
    return false;
 if (sprite->getAABB().top + sprite->getAABB().height < sprite2->getAABB().top)
    return false;
 if (sprite->getAABB().top > sprite2->getAABB().top + sprite2->getAABB().height)
    return false;

return true;

}

Mario Class

void Mario::collisionResponse(MySprite* sp)
{

    //setPosition(getPosition().x, sp->getPosition().y - getSize().y);
    //velocity.y = 0;
    sf::Vector2f collide(getPosition().x - sp->getPosition().x, getPosition().y - sp->getPosition().y);

    //check left side
    if (abs(collide.x) > abs(collide.y))
    {

        if (collide.x < -5)
        {
            //right side
            setPosition(sp->getPosition().x - getSize().x-1, getPosition().y);
            velocity.x = 0;
        }
        if (collide.x > 5)
        {
            //left side
            setPosition(sp->getPosition().x + sp->getSize().x + 1, getPosition().y);
            velocity.x = 0;
        }
    }
    else
    {
        if (collide.y < -5)
        {
            setPosition(getPosition().x, sp->getPosition().y - getSize().y);
            velocity.y = 0;

        }
        else if (collide.y > 5)
        {
            setPosition(getPosition().x, sp->getPosition().y  + getSize().y);
            velocity.y = 0;
            falling = false;
        }
    }

}

sentences: how to follow(center) a box inside canvas element If inside a canvas I draw a box, and the I add arrows to move it, the box will eventually be out of my reach since it goes out the border and I cant see it. How could I follow the box so that it is always in the center?

sentences:
How do I define spawn patterns for a Fruit Ninja-esque game? I'm creating a game somewhat similar to Fruit Ninja and others, where bombs are thrown up on the screen and you click or touch them to defuse (here is an example of the game).

There are four bomb spawn points and I want to pre-define launch patterns that are interesting and challenging to the player. I'm struggling to think of a good way of defining this data.

How can I pre-define launch times for up-to 4 spawn points in a way that the data is human-readable (so that I don't have to spend too long tweaking each value)?

sentences:
Categorize contact & overlap cases for 2D & 3D axis-aligned bounding boxes My question is similar to this one. I want to determine whether two axis-aligned boxes are not only intersecting, but if they are intersecting and just touching on one edge or face, or if they are overlapping in some way.

Below is an example of these two options.

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:
Synchronizing over UDP I have two apps communicating over UDP. One of the apps is a remote control and the other is a robot.

When the robot has some new data, for example a new sensor reading or GPS coordinate, I simply put this in an UDP packet on it's way to the remote for display and that is that. Since the sensor data has a short time span of validity it does not matter when the packet is lost, because a new one will follow with more updated data shortly anyways.

Similarly when the remote wants the robot to change behavior, I put the new desired behavior in an UDP  packet on its way to the remote for execution. The only difference now is that this time I also send an "acknowlegement" packet back to the remote so that it will know that the  the command was well received. Still this is a simple case.

However in the case where there is a state in the robot that BOTH the robot itself and the remote may change, for example if there is a "panic button" that can both be operated from the remote and the robot, how can the state be kept in sync? Since there is no guarantee the UDP packets will reach their destinations, I imagine there needs to be set up some kind of acknowledgement scheme that does not effectuate a command unless it knows that both remote and robot know what is about to happen. But to me this seems impossible to accomplish.

sentences:
What are the dangers of setting rigidbody velocity directly for movement and what are the alternatives I'm playing around with Unity, trying to make a neat 3rd person platformer movement system using rigidbodies so that I may in the future implement things like pushing boxes/physics objects, grappling hooks, etc... as well as I'm not really knowledgeable in terms of math and physics to be able to code them from scratch using CharacterController
What I've done is I've implemented some basic movement by setting velocity directly
Vector2 input = GetInput();
bool hasInput = Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon;
bool isDashing = dashCounter > 0f;
if (hasInput && !isDashing)
{
    Vector3 direction = GetDirection(); // get camera direction scaled by forward & right vectors
    transform.localRotation = Quaternion.LookRotation(direction);

    UpdateTargetSpeed(input); // update target speed based on movement direction
    Vector3 movementVector = new Vector3(input.x * TargetSpeed, 0f, input.y * TargetSpeed); // add speed to input vector
    movementVector = transform.localRotation * movementVector; // rotate the vector to where the character is facing
    movementVector = Vector3.ClampMagnitude(movementVector, TargetSpeed); // clamp magnitude to avoid faster speed on diagonals

    body.velocity = new Vector3(movementVector.x, Velocity.y, movementVector.z);
}

And I'm also projecting velocity on ground normal for slopes so that the character doesn't fly off when moving down slopes
if (wasPreviouslyGrounded && !jumping && groundCheck.CanStick)
{
    float slopeAngle = Mathf.Abs(Vector3.Angle(groundCheck.StickyContactNormal, Vector3.up));
    if (slopeAngle < 85f)
    {
        body.velocity = Vector3.ProjectOnPlane(Velocity, groundCheck.StickyContactNormal);
    }
}

I have implemented jumping and dashing using AddForce
body.AddForce(0f, movementSettings.JumpForce, 0f, ForceMode.Impulse);

This all works okay but everywhere I looked people are always claiming that setting velocity directly is a bad practice and should be avoided. I've seen suggestions to use AddForce instead, but I haven't been able to get the same movement with it, no matter which force mode I used. I am also lost on how to control the amount of force I'm giving to the body during continuous movement. The thing I did is to check the magnitude of body's current velocity and if it's at or above the target speed then forgo applying the force but that just makes the body continuously accelerate and decelerate giving off jittery movement
if (body.velocity.sqrMagnitude < TargetSpeed * TargetSpeed)
{
    body.AddForce(force, ForceMode.VelocityChange);
}

Can anyone ELI5 me the answers to the following questions:

Why exactly is setting velocity directly a "bad practice"?
What is the preferred alternative?
How can I get snappy and responsive movement without setting the velocity directly?
How can I accomplish sticking to the ground when going down slopes without projecting and setting the velocity directly?

sentences:
How can I correct an unwanted fisheye effect when drawing a scene with raycasting? Hello I have a game using raycasting for the TI Nspire in Lua, and when the player faces a wall so that their degree they are facing is perpendicular to the length of the wall, I am having what is described as the fishbowl/fisheye effect.

How can I fix this? I have already looked here, and none of that makes sense to me. Here is my code:

map = {{0, 0, 50, 0},{50, 0, 50, 50},{50, 50, 0, 50},{0, 50, 0, 0}}

facing = 45 --"player rotation"
rays = {}
x, y = 25, 25

function raycast()
    for i,v in pairs(rays) do
        rays[i] = nil
    end

    rayf = facing + 30

    for i = 1, 320, 1 do --64, 5
        x_ray, y_ray = x, y
        ray()
        table.insert(rays, radius)
        rayf = rayf - (60/320)
    end
    platform.window:invalidate()
end

function ray()
    radius = 1
    for n = 1, 50, 1 do -- increase of testdot
        x_ray = math.floor(x + (radius * math.cos(rayf * 3.141592653/180)))
        y_ray = math.floor(y - (radius * math.sin(rayf * 3.141592653/180)))
        for k,v in pairs(map) do
            if (
                math.min(v[1],v[3]) <= x_ray and x_ray <= math.max(v[1],v[3])
            ) and (
                math.min(v[2],v[4]) <= y_ray and y_ray <= math.max(v[2],v[4])
            ) then
                --print("Collision")
                return true
            end
        end
        radius = n
    end
end

function on.paint(gc)
    gc:setColorRGB(0,200,255)
    gc:fillRect(0, 0, 320, 108)
    gc:setColorRGB(100,100,100)
    gc:fillRect(0, 109, 320, 109)
    gc:setColorRGB(100,0,100)
    for i,v in ipairs(rays) do
        gc:drawLine(i, 108.5 - ((100/v * 20)/2), i, 108.5 + ((100/v * 20)/2))
    end
end

function on.arrowKey(key)
    if key == 'left' then
        facing = facing + 3
    elseif key == 'right' then
        facing = facing - 3
    end
    if key == 'up' then
        y = y - 1
    elseif key == 'down' then
        y = y + 1
    end
    raycast()
end

I have also tried it like this:

map = {{0, 0, 50, 0},{50, 0, 50, 50},{50, 50, 0, 50},{0, 50, 0, 0}}

facing = 45 --"player rotation"
rays = {}
x, y = 25, 25

function raycast()
    for i,v in pairs(rays) do
        rays[i] = nil
    end

    rayf = facing + 30

    for i = 1, 320, 1 do --64, 5
        x_ray, y_ray = x, y
        ray()
        ----------------
        fisheyeradius = radius / (math.cos(rayf - facing))
        table.insert(rays, fisheyeradius)
        ----------------
        rayf = rayf - (60/320)
    end
    platform.window:invalidate()
end

function ray()
    radius = 1
    for n = 1, 50, 1 do -- increase of testdot
        x_ray = math.floor(x + (radius * math.cos(rayf * 3.141592653/180)))
        y_ray = math.floor(y - (radius * math.sin(rayf * 3.141592653/180)))
        for k,v in pairs(map) do
            if (
                math.min(v[1],v[3]) <= x_ray and x_ray <= math.max(v[1],v[3])
            ) and (
                math.min(v[2],v[4]) <= y_ray and y_ray <= math.max(v[2],v[4])
            ) then
                --print("Collision")
                return true
            end
        end
        radius = n
    end
end

function on.paint(gc)
    gc:setColorRGB(0,200,255)
    gc:fillRect(0, 0, 320, 106)
    gc:setColorRGB(100,100,100)
    gc:fillRect(0, 106, 320, 106)
    gc:setColorRGB(100,0,100)
    for i,v in ipairs(rays) do
        gc:drawLine(i, 108.5 - ((100/v * 20)/2), i, 108.5 + ((100/v * 20)/2))
    end
end

function on.arrowKey(key)
    if key == 'left' then
        facing = facing + 3
    elseif key == 'right' then
        facing = facing - 3
    end
    if key == 'up' then
        y = y - 1
    elseif key == 'down' then
        y = y + 1
    end
    raycast()
end

The wall originally looked like this:

But I have made changes around the ---------------, and now the wall looks like this:

I this supposed to occur?

sentences:
XNA- Add a content reference to a library? Making a Game library with XNA, and I'd like to bundle it with some stock effects, if possible.  But I'm having no luck attaching a Content project to the Library, so is it possible to use the Content Processor to load effects this way?

If not, how should the bundling be done?  I would like the "user" (that is, someone building something with the library) not to have to deal with loading the effect, other than calling some library function with no arguments.

sentences:
UDK problem with kismet and unreal code interfacing Couple of questions that I really have looked for the answer to before posting.

I want to create enemies in a game (iOS - tower defense like) I am making them follow a path and do other things like die etc..

I created a simple piece of code to make a place-able enemy in my level but this is the thing I don't know what the best way to continue is. I want to create enemies in code rather than placing in game and therefore I do not know how to assign the kismet path to each one?

My mobile material isn't working even though I made the material have a mobile texture? Works in PC not in mobile preview.

Thanks in advance.
Mike

Class BlobzEnemyGround1 extends BlobzEnemy
placeable;

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    `log("Blobz Enemy Ground 1 spawned!");
}

defaultproperties
{
    bBlockActors=True
    bCollideActors=True

Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
    bEnabled=TRUE
End Object
Components.Add(MyLightEnvironment)

Begin Object Class=StaticMeshComponent Name=PickupMesh
    StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
    Materials(0)=Material'Level1.TestEnemyMat'
    LightEnvironment=MyLightEnvironment
    Scale3D=(X=0.25,Y=0.25,Z=0.5)
End Object
Components.Add(PickupMesh)

Begin Object Class=CylinderComponent Name=CollisionCylinder
    CollisionRadius=32.0
    CollisionHeight=64.0
    BlockNonZeroExtent=true
    BlockZeroExtent=true
    BlockActors=true
    CollideActors=true
End Object
CollisionComponent=CollisionCylinder
Components.Add(CollisionCylinder)
//bSupportedOnMobile=true;

}

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 can I take screenshots with two cameras simultaneously in Unity? I am trying to capture different parts of a scene created in Unity. I have two cameras capturing different parts of the scene. Now, I need to take screenshots using these two cameras simultaneously. Right now, every time take a screenshot, it only captures scene from one camera.
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: How can I detect a long press then activate an animation? How can I detect a long press on a touch screen then activate an animation? And when the finger is released, play another animation smoothly? Let's take for example the main character in Crossy Road: when the user presses down, the chicken "squats" and when the user releases their finger, the chicken jumps. Same concept. C#.

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:
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:
Libgdx SpriteBatch won't position correctly on Screen I have been trying to position my spritebatch correctly regardless of screen size but it simply wont scale..This is what I want to achieve on every screen size..I want my Sprite Object to be positioned at the center of the x-axis on every screen size and on the first half of the screen (above dotted line) and have it scale as well..I have also noticed that spritebatch doesn't respect my gameheight and gamewidth instead opting for screenwidth and screenheight. The dimensions for my sprite anim are 900 by 700 and I am hoping it can scale for lower resolutions

Code :

batch.draw(animation.getKeyFrame(elapsedTime, true), 20, app.midPointY + 350, app.screenWidth, 465);

sentences:
Point Light shows black box & rect (PointLight not working) - libgdx 3D I am creating a 3d scene currently a box and rect, and trying to enable lighting.

  When i create a PointLight and add it to Environment everything turns to  black color?

all i want to do is create a 3d scene and enable point light, like a sun or rays coming from a point and shading the objects.

Code:

environment = new Environment();
environment.add(new PointLight().set(1f, 1f, 1f, 0, 0, 20f, 100f));

modelBatch=new ModelBatch();

..

square=new ModelBuilder().createBox(300,300,300,new Material(ColorAttribute.createDiffuse(Color.GREEN)),
                VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
squareinst=new ModelInstance(square);
squareinst.transform.setTranslation(-500,0,0);

--

sprites.get(0).setRotationY(sprites.get(0).getRotationY() + 1f);
sprites.get(1).setRotationY(sprites.get(1).getRotationY() - 1f);
squareinst.transform.rotate(1,0,0,1);

modelBatch.begin(camera);
for(Sprite3D sp:sprites)// has 3d rect models
     sp.draw(modelBatch,environment);
modelBatch.render(squareinst,environment);
modelBatch.end();

PointLight turning everything black

Without using environment or lights

as per my investigation, here if pointlight is not working then everything should be black as currently, because the environment needs light, it works fine with Directional light (only the backface of rect is black even after rotations, i don't know why)

libgdx version 1.6.1 - android studio
i checked it on both android device and desktop

please i really need to get this PointLight working, i don't know if it will take a custom shader, if so please guide me to some links because i am not experienced in shaders. I also read about PointLight not working on some device or not working in opengl 2.0 enabled, but i am not sure.

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:
HLSL registers and slots I'm learning DirectX11 and since I'm beginning to write some shader code I don't understand the difference between binding slots and HLSL registers. The shader model 5.0 introduced the keyword register, that I assumed is a synonym for slot but it's not.

What I know:
I know that a register is 4 floats (16 bytes), and that a variable cannot straddle two registers so padding is added according to HLSL packing rules.
I also know that if I compile two shaders (say, vertex and pixel shader) in from the same file the register specified are by shader usage so if I use register b0 two times everything compiles fine if resources are accessed by each shader indipendently.

but what about this:

cbuffer Transform : register(b0)
{
    float4x4 worldMatrix;
};

cbuffer clipPlane : register(b1)
{
    float4 clipPlane;
};

I bind my resources to the shader like this:

Game::GetInstance()->GetDeviceContext()->PSSetConstantBuffers(0, 1, &mCameraConstantBuffer);
Game::GetInstance()->GetDeviceContext()->PSSetConstantBuffers(1, 1, &mLightsConstantBuffer);

But if a register is 4 floats shouldn't the two resource overlap?
What about sampler and shader resource registers?

Can someone provide me with a reference about the structure of these registers? MSDN documentation is really of no help sometimes.

sentences:
Generating shaders from fragments / HLSL Dynamic Linking in older shader models In shader model 5 is a feature called dynamic linking which separates hlsl fragments by using interfaces and their methods implemented in classes.

I don't have any experience with this technique, my program uses about 10 shaders (10 separated files *.hlsl) and there are some identical parts in different shaders. So it will be good for me to separate a common logic (light for example) to its own file and just use it from other shaders.

I was always fascinated by modern game engines and their development kits capable of composing these shader fragments together by simple clicking in some internal editor. So a developer can create very complex scenes this way - choose materials, lights, particles, animations, etc. and it's very cool and productive I guess. If I omit some graphical editor and a sophisticated logic behind it, it is pretty what I want to achieve, isn't it? Just on a code level.

So with hlsl's dynamic linking in shader model 5 I have some idea how it can be done, but what about older shader models? When there was no shader model 5, what technique did engines use?

sentences:
Adding a short delay between bullets I'm having some trouble simulating bullets in my 2D shooter. I want similar mechanics to Megaman, where the user can hold down the shoot button and a continues stream of bullets are fired but with a slight delay. Currently, when the user fires a bullet in my game a get an almost laser like effect. Below is a screen shot of some bullets being fired while running and jumping.

In my update method I have the following:

if(gc.getInput().isKeyDown(Input.KEY_SPACE) ){
    bullets.add(new Bullet(player.getPos().getX() + 30,player.getPos().getY() +  17));
}

Then I simply iterate through the array list increasing its x value on each update.

Moreover, pressing the shoot button (Space bar) creates multiple bullets instead of just creating one even though I am adding only one new bullet to my array list. What would be the best way to solve this problem?

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:
Best way to handle events for a turn base game? I'm looking for the best way to handle events for a tactic game in Unity. Every unit may need to react to different events (turn start, end, on damage to self, on damage to other, on kill, etc...).
At the moment I'm just cycling all units for any event from a central manager class, but I'm looking for a more elegant and easy-to-extend solution. I'm not worried about performance since the involved number of units will be low.
Any advice?

sentences:
OpenGL datatypes conversion overhead In my project, certain data is stored in floating point datatypes (C's native float, double). Before sending the data in a VBO to OpenGL I have to convert this data to GLfloat with some pretty silly code.

float data[DATA_SIZE];
GLfloat *new_data;

new_data = malloc(sizeof(data));
for (i = 0; i < DATA_SIZE; i++)
    new_data[i] = (GLfloat) data[i];

upload_to_gpu(new_data);

free(new_data);

Of course, since I know float is equal to GLfloat on my platform, I can just ignore this but then my code won't be properly platform-independent. I could also store the data in my program in OpenGL native datatypes but this is unacceptable as I don't want to fixate my code only on OpenGL (DirectX or a software renderer are possibilities I don't want to exclude).

How can I solve this? Is the conversion step unavoidable? Or am I obligated to store my geometry in GLfloat's?

sentences:
Composite 3-D and 2-D using Anamorphic Projection? I'm working on a game which takes place on a two dimensional grid similar to the fluid background grid in Geometry Wars. It is implemented as a procedurally drawn spring system which may have force applied to the intersection points resulting in a primitive fluid dynamic simulation.

Let's say I want to elevate the grid into three-space. One way would be to upgrade the whole world to 3-d. Then I could render the grid to a texture and map it onto a plane which could be placed in three dimensions. What I am more interested in, however, is how I might 'fake' it by simulating perspective using 2-D. For example, its easy to vary the horizontal grid spacing based on the cell's row in the grid. By squeezing it at the top I can create a visually convincing vanishing point, but the physics and interaction with the grid is not right.

I'd like to be able to layer the 2-D grid over a separate 3-D layer such that they appear to be one. Have y'all seen the impressive demonstrations of anamorphic projection recently featured on YouTube?

Intrigued, I found another tutorial video which shows how to draw anamorphically using pencil and paper.

Anyone have an idea of how to approach the problem of creating an anamorphic projection space in 2-D that would line up with a given perspective projection as that of a typical 3-D Camera?

I envision that this would manifest as an array of weightings applied to each point in the 2-dimensional grid which I could use to modulate the physics forces that drive the grid, creating a more realistic spring system than is possible with a simple faked perspective.

sentences:
Goal oriented Action Planning with multiple Agents I'm a little bit stuck:

I implemented an AI with GOAP (Goal oriented Action Planning, http://alumni.media.mit.edu/~jorkin/gdc2006_orkin_jeff_fear.pdf) for a simulation game. That works fine.

Now I want that the agents can cooperate (e.g. doing actions together). What is in this case the best AI-Design that the GoapActions keep loose couplet?

Should they plan together? (what is in this case the "worldstate"?)Or Should they share their plans? some kind of message-system?

Example
Agent1:
Worldstate Agent 1: isLonely= true
Goal Agent1: isLonely = false

Plan Agent1: AskAgent2ToTalk -> TalkToAgent2

Agent2
Worldstate Agent 2: hasWood = false
Goal hasWood = true

Plan Agent2: GetAxe -> ChopWood -> BringWoodToSupply

How I get this constellation?

Agent1 Plan: TalkToAgent2
Agent2 Plan: TalkToAgent1 -> GetAxe -> ChopWood -> BringWoodToSupply

Or if they are talking and one of the agents is interrupted (e.g. by an attacking enemy) the other agent must know that his TalktoAgent2 Action has ended.

sentences:
libgdx - creating static HUD/widgets on screen I'm having problems with creating static HUD/buttons on the game screen.
Currently my game has a character moving on the tiled map, with OrthographicCamera put on, everything works fine.
I wanted to add button on the screen:

...
Stage stage;
ImageButton imageButton;

@Override
public void create() {
        stage = new Stage(viewport);
        Texture texture = new Texture("bagbutton.png");
        Drawable drawable = new TextureRegionDrawable(new TextureRegion(texture));
        imageButton = new ImageButton(drawable);
        imageButton.setPosition(200, 200);
        imageButton.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent inputEvent, float x, float y) {
                System.out.println("clicked");
            }
        });

        Gdx.input.setInputProcessor(stage);
        stage.addActor(imageButton);
}
...

And then in render() method I got

stage.draw();

button appears, indeed, and it's even clickable. However, my player image (drawn by spritebatch.draw with texture) disappeared. Moreover, button is in the same position on map, and I'd like it to be somewhere on the bottom of the screen. It should be there statically, too, always in the same place, so when players moves, the button is always in the same place on screen. Next I'd like to make the same thing with some text and image, let's say on the top of screen. How to make it so?

sentences:
Glass Material for Unity 5 Anyone know how to make a glass material in Unity 5?

I can do metal and image textures, but not sure how to create a glass material.

A search on Google would not get me anything for Unity 5 so it must be fairly easy to do.

It's for a shower door and plane glass like this:

sentences:
How to get pixel coordinates between 0,1 from SV_POSITION I am new to HLSL and Directx. I was trying to write a simple gradient Shader by modifying one of Microsoft samples.

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

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

Fist code (Of course it should not work):

float4 VS( float4 Pos : POSITION ) : SV_POSITION
{

    return Pos;
}

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

The second one :

float4 VS( float4 Pos : POSITION ) : SV_POSITION
{

    return Pos;
}

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

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

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

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 to install Unreal Engine 4? As soon as I found out that Unreal Engine 4 is now free, I decided to get it in order to tinker with it.

So I clicked on the blue "Get Unreal" button, signed up, and downloaded (and installed) the MSI installer (working on Windows here).

After the installation completed, the "Epic Games Launcher" launched, asking me to log in. Once logged in, I selected the "Unreal Engine" tab and was greeted by a page with several tutorials and demo projects for download, while the left side offered an orange button saying "No engine installed" and no option to click on it to install one.

After some time, I found this Unreal documentation explaining how to install the engine. According to it, the engine should start downloading the moment I log in to the launcher, which didn't happen.

What am I doing wrong? How can I install the Unreal Engine?

sentences:
Record video and sound from device camera and show it as a texture I need to record and show video from a real camera device in iOS/Unity and show that video as a texture in RawImage (Image of what I want)

What I have tried so far:

Unity WebCamTexture API: It shows the camera in a texture but it has two problems! It does not record audio and does not have an API to save video!
Camera Capture Plugin: I bought this plugin but unfortunately it does not have the feature to show video in a texture; it just opens the camera device's application.
EverPlay plugin: I tried this plugin and it seems that it just creates a video from the screen and not the camera
Unity Video Capture API: There is also this API for recording video with sound but unfortunately it is part of Windows Mixed Reality and does not support iOS
Using Objective C: I tried to write the video recording section directly in Objective C, I did it but I could not find a way to embed that in the Unity scene -- I'm not sure it's even possible! (
what I tried)

I appreciate any other solutions that can help.

sentences: Can I sell a game made with OpenGL? I love creating games, and I've always made games using OpenGL and not with game engines such as Unity or Unreal. Can I legally sell the games I made with OpenGL?

sentences:
OpenGL ES - read content of VBO Is it possible to read back content of VBO in OpenGL ES 2.0 ?
I have tried glMapBufferOES, but there is no READ flag.

I dont want any answers, like "you shouldnt do it" or "keep copy of geometry in ram".

sentences:
Storing game objects in multiple containers In the light of DRY, it seems desirable to store a collection of related game objects in one container only.
However, one might need sub-collections of these objects in various contexts. It might be sensible store these specific sub-sets in specific more suitable containers.
This increases the effort to track objects across containers, for instance when objects are removed from the game world.

What are possibilities to simplify such a design and what are the typical trade-offs?

To illustrate:

In a multiplayer role playing game, the server might hold a collection of game characters in a map suitable for lookup by id.

world
    map<id, Character> allCharacters

A character may also reside in a certain game level. In order to identify all characters being present in a level it may seem suitable to introduce a container for each level which holds the characters currently present on it. This way you can execute common logic for all characters in that level.

world
    map<id, Character> allCharacters

    [levels]
        level1
           vector<Character> charactersOnPlayfield
        level2
           vector<Character> charactersOnPlayfield
        ...

Going even further, when a character interacts with the world messages should only be routed to characters in range. This interest management could be achieved by dividing the each level into a grid of cells each of which in turn store the characters currently standing on it.

world
    map<id, Character> allCharacters

    [levels]
        level1
           vector<Character> charactersOnPlayfield
           [cells]
               cell1
                   vector<Character> charactersOnCell
               cell2
                   vector<Character> charactersOnCell
               ...
        level2
           vector<Character> charactersOnPlayfield
           [cells]
               cell1
                   vector<Character> charactersOnCell
               cell2
                   vector<Character> charactersOnCell
               ...
        ...

The Character objects at different levels of abstraction introduce the need to think carefully about object ownership and life-time.

Note that the Character objects stored in the containers would naturally be references, not copies.
Also, I am assuming that no garbage collection is in place.

sentences:
Transfer my UDK 2 project to UDK 3? Is it possible to export my UDK 2 project to UDK 3 ?
What kinds of things aren't transferable?

sentences:
Questions for QueryAABB I'm currently having trouble getting my head around QueryAABB, and hope to find some answers here.

The LowerBound of an AABB the upper-left corner (and vice versa). Why is that and what idea is behind that?
When exactly does an object count as inside the AABB and is therefor found by a query?

sentences:
Player fly's off of canvas when key pressed I am fairly new to game development. I am programming a basic JavaScript canvas game. Whenever I press a key my player goes flying off of the canvas. Here is the controller code

document.onkeydown = function(event){
    if(event.keyCode === 87){
        player.up = true;
    }
    else if(event.keyCode === 83){
        player.down = true;
    }
    else if(event.keyCode === 65){
        player.left = true;
    }
    else if(event.keyCode === 68){
        player.right = true;
    }
}

document.onkeyup = function(e){
    if(e.keyCode === 87){
        player.up = false;
    }
    else if(e.keyCode === 83){
        player.down = false;
    }
    else if(e.keyCode === 65){
        player.left = false;
    }
    else if(e.keyCode === 68){
        player.right = false;
    }
}

if(game.keys && game.keys[87]){
        player.speedY += -0.4;
        if(player.speedY > player.maxSpeed){
            player.speedY = player.maxSpeed;
        }
    }
    if(game.keys && game.keys[83]){
        player.speedY += 0.4;
        if(player.speedY > player.maxSpeed){
            player.speedY = player.maxSpeed;
        }
    }
    if(game.keys && game.keys[65]){
        player.speedX += -0.4;
        if(player.speedX > player.maxSpeed){
            player.speedX = player.maxSpeed;
        }
    }
    if(game.keys && game.keys[68]){
        player.speedX += 0.4;
        if(player.speedX > player.maxSpeed){
            player.speedX = player.maxSpeed;
        }
    }

The above is the controller code... What improvements should be made on the above code.

edit
I realize you may need to see the entity creation code

function square(width, height, color, x, y) {
  this.width = width;
  this.height = height;
  this.x = x;
  this.y = y;
  this.speedX = 0;
  this.speedY = 0;
  this.right = false;
  this.left = false;
  this.up = false;
  this.down = false;
  this.rend = function(){
    ctx = game.context;
    ctx.fillStyle = color;
    ctx.fillRect(this.x, this.y, this.width, this.height);
  }
  this.movement = function() {
    this.x += this.speedX;
    this.y += this.speedY;
  }
}

edit max speed integration.

  var now = Date.now();
  var delta = now - lastUpdate;
  lastUpdate = now;
  this.width = width;
  this.height = height;
  this.x = x;
  this.y = y;
  this.angle = 0;
  this.maxSpeed = 3;
  this.speedX = 0;
  this.speedY = 0;
  this.rend = function(){
    ctx = game.context;
    ctx.fillStyle = color;
    ctx.globalAlpha = 1;
    ctx.fillRect(this.x, this.y, this.width, this.height);
  }
  this.movement = function() {
    this.x += this.speedX;
    this.y += this.speedY;
}
}

editadded player making function.

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:
What do game designers do for the game? One day I asked me: "How do game designers work?". I knew what the "main mission" of their work, but I didn't know: "How to do it?" and "What do they need to write?"

I want to know full "list" of terms with examples that they need to write.

For example:

Genre - Action

Setting - Retrofuturism etc...

Please answer me :)

sentences:
Can I use the inclinometer and accelerometer on every Windows Phone device? I want to do a little game that uses the Windows Phone inclinometer to control an object's pitch, roll and yaw. In addition, I need the accelerometer in another project to let an object jump.

Can I use the inclinometer and accelerometer on every Windows Phone device or are there older devices that don't support the inclinometer and accelerometer? Can I use the inclinometer and accelerometer on Windows Tablets like the surface?

sentences: How to get started with Unreal Engine for iPhone? OK i have decent amount of knowledge of C++. I want to make cool games for iPhone using unreal engine and I have access to UDN. But everything seems cluttered on UDN. I have downloaded source from there. It would be great if someone can provide information about How to get started and list of resources. Thanks!

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:
Looking for a good actionscript 3 book I've been looking for a book on actionscript3 development, but while there's tons of books out there, nobody seems to want to recommend any specific one.

One book I've been pointed towards is the cookbook by o'reilly, but it, like most books out there, seems to be based on the assumption that I'm using flexbuilder or flash. Instead, I'm "just" using flashdevelop, or the free SDK directly.

I've also been told to just go with the api reference and live with it. I could do that, I suppose, but I'd rather have a book that gives me the big picture. Kind of like with cocoa, there's the hillegrass' book, or the red book of OpenGL.

So, what would be the actionscript3 book out there?

sentences:
Easily split up a ripped spritesheet with no downloads? So, I'm new and all to game development, and I use the free version of Construct 3.

I want to make a Mother 3 fan game, as it's one of my favourite games of all time and seems like fun practice for a top down RPG.

I downloaded a ripped sheet of Lucas, but the background is green, and also it's in one image.

Is there an easy way to split the sheet into multiple images, without any downloads? I'm using someone else's computer and I can't download anything.

It's a windows 7 computer, with like nothing but chrome

sentences:
How do you manage your game resources in XNA? In the past I have used Content.Load<type>("filename"); all over the place. This quickly becomes a nightmare to manage and worse you start having multiple copies of the same asset loaded in several different places.

Then I moved on to using a Resources class which basically looked like the following:

public class Resources
{
    public static Texture2D particle01;
    ...
    public static Texture2D particle93;

    public static Effect shader01;
    ...
    public static Effect shader32;

    public static Load(ContentManager content, GraphicsDevice device)
    { //load all the resources }

    public static Unload()
    { //unload all the resources }
}

Then I could simply use Resources.particle01 to get a reference to the resource from anywhere within the same namespace.

This was a nice approach because it eliminated the duplicates that I had in the past. Also all loading was done in a single class, so it was easy to keep track of the resources. And finally, I could simply right click, for example, particle93 and click find all references to find all the places that used that texture.

However, there are issues with this approach and I would like to know if there is a better solution out there.

sentences:
My frustum culling is culling from the wrong point I'm having problems with my frustum being in the wrong origin.
It follows the rotation of my camera but not the position.

In my camera class I'm generating a view-matrix:

void Camera::Update()
{
    UpdateViewMatrix();

    glMatrixMode(GL_MODELVIEW);
    //glLoadIdentity();
    glLoadMatrixf(GetViewMatrix().m);
}

Then extracting the planes using the projection matrix and modelview matrix:

void UpdateFrustum()
{
    Matrix4x4 projection, model, clip;

    glGetFloatv(GL_PROJECTION_MATRIX, projection.m);
    glGetFloatv(GL_MODELVIEW_MATRIX, model.m);

    clip = model * projection;

    m_Planes[RIGHT][0] = clip.m[ 3] - clip.m[ 0];
    m_Planes[RIGHT][1] = clip.m[ 7] - clip.m[ 4];
    m_Planes[RIGHT][2] = clip.m[11] - clip.m[ 8];
    m_Planes[RIGHT][3] = clip.m[15] - clip.m[12];
    NormalizePlane(RIGHT);

    m_Planes[LEFT][0] = clip.m[ 3] + clip.m[ 0];
    m_Planes[LEFT][1] = clip.m[ 7] + clip.m[ 4];
    m_Planes[LEFT][2] = clip.m[11] + clip.m[ 8];
    m_Planes[LEFT][3] = clip.m[15] + clip.m[12];
    NormalizePlane(LEFT);

    m_Planes[BOTTOM][0] = clip.m[ 3] + clip.m[ 1];
    m_Planes[BOTTOM][1] = clip.m[ 7] + clip.m[ 5];
    m_Planes[BOTTOM][2] = clip.m[11] + clip.m[ 9];
    m_Planes[BOTTOM][3] = clip.m[15] + clip.m[13];
    NormalizePlane(BOTTOM);

    m_Planes[TOP][0] = clip.m[ 3] - clip.m[ 1];
    m_Planes[TOP][1] = clip.m[ 7] - clip.m[ 5];
    m_Planes[TOP][2] = clip.m[11] - clip.m[ 9];
    m_Planes[TOP][3] = clip.m[15] - clip.m[13];
    NormalizePlane(TOP);

    m_Planes[NEAR][0] = clip.m[ 3] + clip.m[ 2];
    m_Planes[NEAR][1] = clip.m[ 7] + clip.m[ 6];
    m_Planes[NEAR][2] = clip.m[11] + clip.m[10];
    m_Planes[NEAR][3] = clip.m[15] + clip.m[14];
    NormalizePlane(NEAR);

    m_Planes[FAR][0] = clip.m[ 3] - clip.m[ 2];
    m_Planes[FAR][1] = clip.m[ 7] - clip.m[ 6];
    m_Planes[FAR][2] = clip.m[11] - clip.m[10];
    m_Planes[FAR][3] = clip.m[15] - clip.m[14];
    NormalizePlane(FAR);
}

void NormalizePlane(int side)
{
    float length =  1.0/(float)sqrt(m_Planes[side][0] * m_Planes[side][0] +
                                m_Planes[side][1] * m_Planes[side][1] +
                                m_Planes[side][2] * m_Planes[side][2]);

    m_Planes[side][0] *= length;
    m_Planes[side][1] *= length;
    m_Planes[side][2] *= length;
    m_Planes[side][3] *= length;
}

And check against it with:

bool PointInFrustum(float x, float y, float z)
{
    for(int i = 0; i < 6; i++)
    {
        if( m_Planes[i][0] * x + m_Planes[i][1] * y + m_Planes[i][2] * z + m_Planes[i][3] <= 0 )
        return false;
    }
    return true;
}

Then i render using:

camera->Update();
UpdateFrustum();

int numCulled = 0;

for(int i = 0; i < (int)meshes.size(); i++)
{
    if(!PointInFrustum(meshCenter.x, meshCenter.y, meshCenter.z))
    {
        meshes[i]->SetDraw(false);
        numCulled++;
    }
    else
        meshes[i]->SetDraw(true);
}

Matrices look like (Camera is at (5, 0, 0)):

ModelView
[0,0,0.99,0] [0,1,0,0] [-0.99,0,0,0] [0,0,-5,1]

Projection
[0.814,0,0,0] [0,1.303,0,0] [0,0,-1,0] [0,0,-0.02,0]

Clip
[0,0,-1,-0.999] [0,1.30,0,0] [-0.814,0,0,0] [0,0,4.98,4.99]

What am I doing wrong?

sentences:
XNA 4.0, Combining model draw calls I have the following problem: The levels in my game are made up of a Large Quantity of small Models and because of that I am experiencing frame rate problems. I already did some research and came to the conclusion that the amount of draw calls I am making must be the root of my problems.

I've looked around for a while now and couldn't quite find a satisfying solution. I can't cull any of those models, in a worst case scenario there could be 1000 of them visible at the same time.

I also looked at Hardware geometry Instancing, but I don't think that's quite what I'm looking for, because the level consists of a lot of different parts.

So, what I'd like to do is combining 100 or 200 of these Models into a single large one and draw it as a whole 'chunk'. The whole geometry is static so it wouldn't have to be changed after combining, but different parts of it would have to use different textures (I think I can accomplish that with a texture atlas). But I have no idea how to to that, so does anybody have any suggestions?

sentences: Where can I get people to test my game? I've just finished making the core aspects of my HTML5 game. I have a server and all that, but is there a site where I can find people that would test my game? I figured that getting my friends to do it wouldn't be a good option because they are probably biased, so I need people that I never met before, complete strangers. Also, would the people at gamedev forums be willing to do that? Would it be considered as advertising?

sentences:
How can I locate empty space next to polygon regions? Let's say I have the following area in a top-down map:

The circle is the player, the black square is an obstacle, and the grey polygons with red borders are walk-able areas that will be used as a navigation mesh for enemies.  Obstacles and grey polygons are always convex.

The grey regions were defined using an algorithm when the world was generated at runtime.

Notice the little white column.  I need to figure out where any empty space like this is, if at all, after the algorithm builds the grey regions, so that I can fill the space with another region.

Basically what I'm hoping for is an algorithm that can detect empty space next to a polygon.

sentences:
Can't give my pictures the right location in libGDX I have this code here

 sb.draw(title, (PPlane.WIDTH / 2) - (title.getWidth() / 2), (float) (PPlane.HEIGHT / 10));
 sb.draw(playBtn, (PPlane.WIDTH / 2) - (playBtn.getWidth() / 2), PPlane.HEIGHT / 2);

This gives me a picture in the middle (playBtn) and a picture beneath it (title). But I want the picture title to be above picture playBtn. So what i did was:

 sb.draw(title, (PPlane.WIDTH / 2) - (title.getWidth() / 2), (float) (PPlane.HEIGHT / 1.2));
 sb.draw(playBtn, (PPlane.WIDTH / 2) - (playBtn.getWidth() / 2), PPlane.HEIGHT / 2);

I changed the number that divide PPlane.HEIGHT in draw.title so it would appear above playBtn, but instead it just dissapeared.

I also tried to change the cam.setOrtho to True with the first code but that didn't work either.

What should I do to fix this?

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:
Lerp performance for camera movement In my current script responsible for camera movement, I use Mathf.Lerp to smoothly move the camera to the desired position (with WASD movement, panning with MMB, and zooming with the scrollwheel).
However, due to the nature of the Lerp method, I have performance concerns. Does it ever stop calculating the distance and slightly moving the camera towards the location, or do I have to have an if statement that checks if a distance is < 0.0005f, then stop lerping? If so, which is more performant / better practice?
As a bonus question, I've seen there are other smoothing functions such as MoveTowards, Slerp, SmoothDamp... is there any benefit to using any of those over lerp? My main priority is the camera movement being as performant as possible, and I don't understand how these functions work behind the scenes, despite doing much research.
The entire code to my CameraController is here (the lerping is done in LateUpdate): https://pastebin.com/URZhq3MA

sentences:
render with const depth value This is a question that may have an answer that differs for vanilla desktop GL and GL ES 2.0 (and wishful thinking is that ES 3.0 would have the same answer as vanilla GL).

What I'm doing is rendering a cubemap with a FS quad and I'd like to know if there's a way to specify a constant depth value for an entire render call rather than to get involved at the fragment shader level, in hopes of chasing a little bit of performance as well as flexibility in that I can use the same shader for drawing to different const depth values.

As for why it might benefit performance, the note at the bottom here offers some ideas, such as early-z testing... I suppose realistically if I emit a constant distant fragment depth, then early-z can still happen while maintaining the flexibility of pixel-programmable depth in general (necessary for proper impostors as shown). In this case I may be splitting hairs unnecessarily at this point. However that note does mention that if I can avoid specifying gl_FragDepth, I should, but it'd be up to the driver whether it will do something smart if I e.g. set gl_FragDepth to a constant.

As an example I could render my 3D scene, then set depth draw value to maximum, keep depth test on, and then render a fullscreen quad for my cubemap skybox, and it would just do the right thing.

Otherwise, choices include:

render skybox first with depth testing switched off, then render scene
use a fragment shader for the skybox that specifies the requisite depth value (this may very well just be the answer)

sentences:
Vulkan Error: cmd buffer submit cant use image because of layout I've been coding a Vulkan rendering engine for the past few weeks.
My code still continues to execute and I get the desired output, but I am getting an error.

I'm fairly certain that my error is a mistake in my code somewhere. My code is 1000+ lines, so I'm not going to ask anyone to debug it. I guess my question is what typically causes the error I'm getting, and how can I fix it?

I've been pretty closely following this (if this helps anyone): https://software.intel.com/en-us/articles/api-without-secrets-introduction-to-vulkan-part-3#_Toc445674490

My code draws the desired triangle from the tutorial, but I get an error for the first 3 frames:

VKDBG: ERROR: @[DS]: Cannot submit cmd buffer using image (0x6) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
VKDBG: ERROR: @[DS]: Cannot submit cmd buffer using image (0x7) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
VKDBG: ERROR: @[DS]: Cannot submit cmd buffer using image (0x8) [sub-resource: aspectMask 0x1 array layer 0, mip level 0], with layout VK_IMAGE_LAYOUT_UNDEFINED when first use is VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.

I suppose I could just ignore this, because I get a desired output and the error doesn't seem to break anything, but I would guess that it's bad practice to leave this unfixed.

Thank you for anyone helping!

sentences:
How to instantiate a sprite from a sprite sheet using script in unity? We are creating a 2D top down rpg, and we have multiple textures, and we need to be able to change which sprite sheet its reading from in order to change the look of the walls and floor in each room. It has the same basic tiles just they need to look different. Like the corner of a cabin, to the corner of an office building.

At the moment we are taking the sprite sheet, splitting it up, and making prefabs out of it for placement by script in the game. Is there a way to do this automatically because we have a lot of textures, and its too many to make into prefabs.

sentences:
Time series for creating new events in a PVP game This is more like a mathematical problem, but I guess this is the best place to ask it.

I am working on a PVP concept and I have the following problem. There is a "battle" between two players that both have set their moves before the match starts. So, during the battle, they just watch the screen and text describing the events.

This battle takes 30 min and attacking/defending text events are appearing during this time. In average, I have about 5 main events and 3 secondary events. When the battle start, the code is aware of the number of main events, but not the secondary. They are calculated on the fly.

The process is like,

newEventTime = previousEventTime + formulaForRandomTimeInterval

What I try to do is to build that formula and avoid having big empty time gaps on the battle and also avoid having a lot of them in a small period.

Also, I want to have slightly more events as the time pass to increase the interest.

Was thinking something such as:

formulaForRandomTimeInterval = (battle_time*2/main_events)*random(0,1)

where battle_time = 30 and main_events the number for that battle.

Any idea for a better solution?

Edit

Sorry for the confusion. Here are a couple of more details about it.

An example of events:

At 3' Player A attacked and made 45 damage. (Main event)
At 8' Player B attacked with a sword and made 110 damage. (Main event)
At 12' the weather changed and started raining. Both players had issues with the mud. (Secondary event)
At 19' Player A made a move but player B dodged the attack. (Main event)
...
...

There is another part of the code that decide which event will be the next and what exactly would be. The battle will be over only when the main events are finished. As I said, each battle has different number of main events of average 5, but the code know this number as the battle starts. But doesn't know the number of secondary events which are created by random.

So, when the code does the loop on the events and decide the type of the next event, the time code is called to decide in what minute it will be appeared.

sentences:
Fitting tilemap to any screen resolution My game is a 2D Single-Screen (i.e. non-scrolling) platformer for Android, but the question here doesn't require a code-specific answer.

Basically it's easier for me to show the problem using a graphic, which I've attached below.

My game screen consists of a grid of 25 x 12 tiles.  I am already scaling my viewport so that my ratio stays consistent (by introducing letterboxing / pillarboxing when required) - this works correctly.  I am also scaling my tile sizes by the current viewport dimensions so they appear the same size relative to the current display.

However, clearly, dividing my screen width by 25 to get the tile size will produce a slightly different gap at the right hand side.  (if the starting position is 0 (left edge)).

I get this problem also vertically but this isn't so much of an issue as I can just keep the gap - see the first 2 graphics below.

So, horizontally, what would be the best method to 'cover' this gap up.

I know I can make it more 'symmetrical' by moving all the tiles to the right by 1/2 of the gap width.  But then I would just have smaller gaps on both sides.

Another solution would be to simply draw an extra tile to the right (make my grid 26x12) but this would mean that I would be drawing extra tiles that weren't needed on some screen resolutions (where screen width divided by 25 didn't produce a noticeable remainder / gap).  So I'm all out of ideas and really have no clue how to proceed.  How are these issues dealt with?

I know questions regarding the scaling of graphics are in abundance here on GDS but they do not answer this question.  This question is specific to fitting a tile-grid onto multiple screens in an aesthetically pleasing way.

Help would be appreciated.

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:
Libgdx - changing tiledmap smoothly, Tween engine maybe? First question here, so bare with me if I make a mistake or two. Long story short I'm currently developing a side scroller game in java with libgdx, which uses tiledmaps from the tiledmap creator software. When the player has run for some time the map is automaticly changed to a new one, using some code which looks similar to this:

void changeMap() {
Gdx.app.postRunnable(() -> {
 testMap = new TmxMapLoader().load("someMap.tmx"); renderer.getMap().dispose(); renderer.setMap(testMap);
 }); }

My problem is that the map is changed instantly with no smooth transition at all, like one sec the player is on the old map, the next he starts instantly on the new one, which is quilte unprofessional in My opinion. I would like to create some smooth transition between the two. Maybe just a simple fade in, fade out. Any thing is Better than how it is now.

I have searched google, tried different "solutions" using the tween engine, tried Making a transition screen which first fades in over the playscreen, but when i try to fade back the playscreen is just stoppede etc. I'm really emptied for ideas, so it would be awesome if one of you experts could point me in the right direction. Or maybe Come up with a simple solution. I am experienced with java so any idea here will be apriciated.

This is written from a phone, so sorry for any spelling mistakes.

sentences:
Suitable interpolation for animating explosions Is there a standard interpolation function for animating explosions? Like there is with smoothstep or smootherstep for walking animations or cars going from point A to B.

I'm assuming the explosion needs to grow very fast at the beginning and then slow down - how much in relation to the default linear interpolation, I don't know.

I've tried inverse smoothstep and inverse squared from this article: Interpolation Tricks, but none quite cuts it, maybe I'm applying them wrong.

sentences: Unity - how to remove standard sky but keep the lighting? How can I remove the standard Unity sky (to have an empty space with no texture around my scene), but keep all the lighting effects from it?

sentences:
What is the utility of squared radius and inverse squared radius for lighting computations? On one of the slides from "DirectX 11 Rendering in Battlefield 3" PowerPoint I noticed the folowing code:

struct Light {
    float3 pos; float sqrRadius;
    float3 color; float invSqrRadius;
}

I don't understand why would they store the squared radius and even the inverse squared (which I believe is simply 1-squared radius) instead of simply storing the radius? How are they using this data in their computations? Moreover, what about cone and line lights? This struct must be only for the point lights, I can't see it working for other types - there is not enought data. Still I would love to know how they use that square and invSquare.

UPDATE: Ok I finally got it.

Here is the classic light attenuation equation, easily found on the net:

float3 lightVector = lightPosition - surfacePosition;

float attenuation = saturate(1 - length(lightVector)/lightRadius);

It is relatively costly as length(lightVector) is actually doing this:

length(lightVector) = sqrt(dot(lightVector, lightVector);

moreover division operation (/lightRadius) is also quite costly.

Instead of computing light attenuation this way, you can compute it the following way, which would be much faster:

attenuation = saturate(1 - dot(lightVector, lightVector)*invRadiusSqr);

where invRadiusSqr can be pre-computed at CPU level and passed as a shader constant.

Moreover, you get a quadratic light attenuation as a result (instead of linear in the former case), which is even better, as IRL light has shown to have quadratic falloff.

Thanks everyone for your help!

sentences:
Does anyone know where I can find wp7 indie game sales data? I am curious about whether to develop an xna game for the windows phone 7. It would be nice to know how the games are doing on that platform sales wise.

Something like this would be very helpful:
http://www.xboxist.com/xbox-360/games/xna-community-games-is-a-failed-experiment-010122.php

sentences:
Quality Current Free UDK Tutorials? I'm just getting started with the UDK, with experience in Unity, and would like a good tutorial series about getting to know my way around the basics of level design and a touch on programming. I have found some basic tutorials on level creation, but they are pretty old, and would like to know more.

Thank you!

sentences:
Functions in the game loop I'm learning about the game development. No i'm on the total basics - writting a proper game loop. As i've searched over the Web i'v found that simple but good working pattern using so called fixed time step:
double previous = getCurrentTime();
double lag = 0.0;
while (true)
{
  double current = getCurrentTime();
  double elapsed = current - previous;
  previous = current;
  lag += elapsed;

  processInput();

  while (lag >= MS_PER_UPDATE)
  {
    update();
    lag -= MS_PER_UPDATE;
  }

  render();
}

I roughly understand the logic behind this piece of code but i have the question regarding the game composition.
What exactly the update function do and what the render function. What's their responsibility? Am i assuming right that in the super simple 2D game the update function can for e.g. calculate the distance in pixels the object (e.g. a Car) should move in the next frame and the render function in such a case just takes this calculated position and draws the Car on the screen?
Correct me if i'm wrong and please provide some example/s.
Thx.
PS.
Sorry for such a basic question but i'm really beginner.

sentences:
Can someone explain me how rayCast works? Im learning libgdx and one of the things that really confuses me its raycasting. I read a tutorial of how to use it and I understand it but I really want to know what's in the back. I searched for the source code of this method.

public void rayCast (final RayCastCallback callback, float point1X, float point1Y, float point2X, float point2Y) {   // FIXME pool RayCastCallback?
    world.raycast(new org.jbox2d.callbacks.RayCastCallback() {
    @Override
    public float reportFixture (org.jbox2d.dynamics.Fixture f, Vec2 p, Vec2 n, float fraction) {
        return callback.reportRayFixture(fixtures.get(f), point.set(p.x, p.y), normal.set(n.x, n.y), fraction);
    }
}, this.point1.set(point1X, point1Y), this.point2.set(point2X, point2Y));

}
How we can see this method calls itself recursively and returns a call to reportRayFixture of the callback variable. The thing that really confused me it's from where the code select the Fixture, and how its checks every fixture. Can someone explain me really how its works.

This its the source code page https://github.com/libgdx/libgdx/blob/master/extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/com/badlogic/gdx/physics/box2d/World.java

I will appreciate it!

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:
Load SpriteFont in XNA I'm planning on my game using multiple backgrounds so I'm trying to use spritefonts to draw the text. Every time I load my spritefont I get a error.

Line1 = content.Load<SpriteFont>("Courier New");
Line2 = content.Load<SpriteFont>("Courier New");

This is the error I get.

Error loading "Courier New". File not found.

Although this was the font listed on the official microsoft website http://msdn.microsoft.com/en-us/library/bb447673.aspx.

sentences:
Rotate a Polygon node in Shader Graph I have a hexagon in the Polygon node I would like to rotate so the pointy side is upwards. Applying the rotation nodes, however, simply changes the color of the hexagon from white to a color in the rainbow.
What does the Vector1 of the Polygon output represent and is there a way I can rotate it as if it were a texture?

sentences: Changing the hit box position in melonjs I'm trying to follow the platformer tutorial from the melonJS website, but using assets from kenney.nl instead of the tutorial assets. My problem is that the hit box is always centered at the center of the entity, and I need to move it. I've looked through the docs, and I can not figure out how to do it.

sentences:
Horizontal lines between vertices do not render Good day,

I am using LibGDX to try to render a mesh for a hexagon board. I can render the triangles, which is great, but I am having an issue rendering all of the line segments for the mesh and I can't figure out why.

Pictures

Here is an image of what it renders with the primitive type set to GL_TRIANGLES. The colours are just to help me troubleshoot/identify which triangles are where.

.

Here is an image of what it renders with the primitive type set to GL_LINES. Whether there is 1 triangle being rendered or 1 million, the horizontal lines do not get rendered.

.

Code

How I create the mesh:

mesh = new Mesh(true, MAX_VERTS, 0,
                new VertexAttribute(Usage.Position, POSITION_COMPONENTS, "a_position"),
                new VertexAttribute(Usage.ColorUnpacked, COLOR_COMPONENTS, "a_color"));

mesh.setVertices(verts);

renderable = new Renderable();
renderable.mesh = mesh;
renderable.primitiveType = GL20.GL_TRIANGLES;
renderable.meshPartSize = mesh.getNumVertices();
renderable.meshPartOffset = 0;

When I switch the renderable.primitiveType to GL20.GL_LINES I get the 2nd picture from above.

I've tried to set the renderable.meshPartSize a couple of different ways:

renderable.primitiveType = GL20.GL_LINES;

renderable.meshPartSize = mesh.getNumVertices(); // Doesn't work
renderable.meshPartSize = MAX_VERTS * 2;         // Doesn't work

Here is how I make a triangle:

void drawTriangle(float x, float y, float z, float width, float height, Color color) {
    // Counter-clockwise winding

    // Vertex 1: Top Left
    verts[idx++] = x;
    verts[idx++] = y;
    verts[idx++] = z;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;

    // Vertex 2: Bottom Left
    verts[idx++] = x;
    verts[idx++] = y;
    verts[idx++] = z + height;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;

    // Vertex 3: Top Right
    verts[idx++] = x + width;
    verts[idx++] = y;
    verts[idx++] = z;
    verts[idx++] = color.r;
    verts[idx++] = color.g;
    verts[idx++] = color.b;
    verts[idx++] = color.a;
}

Any help would be appreciated.

Thanks.

sentences:
Calculating/Predicting a way I'm just starting with physics, so I'm not always sure about what I'm doing. It's a 2D project but I'm using 3D physical objects like SphereCollider etc..

What I have:

Objects floating in space and affecting each other through gravity:

protected virtual IEnumerator OnTriggerStay(Collider other) {
    yield return new WaitForFixedUpdate();

    if(other.attachedRigidbody) {
        Vector3 offsetVector = this.transform.position - other.transform.position;
        float distance = offsetVector.magnitude;
        float gravityForce = (other.rigidbody.mass * mass) / Mathf.Pow(distance, 2);
        // Clamp gravity.
        if(gravityForce > 1.0F) {
            gravityForce = 1.0F;
        }
        other.attachedRigidbody.constantForce.force = offsetVector.normalized * gravityForce;
    }
}

There are controllable objects on which the player can click and drag a line away from the object in order to give it a force (shoot) in the opposite direction.

What I want to achieve:

The player should see a rough prediction of the way while aiming. That means that the way-prediction needs to take in account the current velocity, the force which would be applied when the player release the mouse button and the gravity of the surrounding objects.

What I have tried so far:

For testing purposes I just save the computed/predicted positions in an array and draw those positions in OnDrawGizmos().

I wrote a method which returns the gravity influence for a certain position called computeGravityForPosition(Vector3 position).

And thats how I try to calculate the positions:

private void drawWayPrediction() {
    Vector3 pos = this.transform.position;
    // The offsetVector for the shooting action.
    Vector3 forceVector = pos - Camera.main.ScreenToWorldPoint(Input.mousePosition);
    forceVector.z = 0.0F;

    // The predicted momentum scaled up to increase the strength.
    Vector3 force = (forceVector.normalized * forceVector.magnitude);

    // 1. I guess that this is wrong, but don't know how to do it properly.
    momentum = this.rigidbody.velocity + force;

    for(int i = 0; i < predictionPoints.Length; i++) {
        float t = i * Time.fixedDeltaTime;
        momentum += computeGravityForPosition(pos);
        pos += momentum * t * t;
        predictionPoints[i] = pos;
    }
}

At the beginning, when the objects just slowly approaching each other it looks okay. After the first shot, the prediction is completely wrong. I guess it is because of 1. in the code. Just adding the force to the velocity is probably horrible wrong.

Thank you very much for your time.

EDIT:

I removed seemingly unnessecary parts.

I still think that the main problem lays in 1. in the code. I just don't know how to mix up the current movement of the object (from which I only have the current velocity as far as I know the physics engine of unity) with the new created force:

Vector3 forceVector = pos - Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3 force = (forceVector.normalized * forceVector.magnitude);

sentences:
Why does Unity heavily blur edges of a single cube despite 8x antialisaing I was messing around a random project and everything was working perfectly, when all of a sudden jagged edges appeared on all objects. I've been trying to resolve this issue for the past two dails, only to no avail. I have tried changing various settings, when at last I've uninstalled unity and removed all projects. After re-installing it, however, the problem still persists:

What I've tried:

changing settings in Nvidia Control Panel (for example, settingantialisaing mode to application-controlled)
changing the Quality settings inside Unity
removing any normal/texture maps
changing metallic and smooothness of the material and removing specular highlights
reinstalling Unity

These pictures depict current settings/object properties:

Properties of material added to the cube

Camera properties:

Quality settings:

Graphics settings:

sentences:
Camera that pivots in the direction that the player is moving I'm trying to recreate Rocket League's freeform (non ball-locked) camera, which basically is a camera that follows the player but pivots to allows face the direction the player is moving in (not necessarily facing). Here's a video of Rocket League's implementation for reference: https://www.youtube.com/watch?v=RSpB6ocrIX8&t=37s

What are the main things needed to accomplish this?

sentences:
OpenGL Learning Material (that's up to date) Possible Duplicate:
  What are some good learning resources for OpenGL?
  Good resources for learning modern OpenGL (3.0 or later)?

So im sure there are topics on this, but alot of them list older material. And the last book:
http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321712617/ref=sr_1_1?ie=UTF8&qid=1346116133&sr=8-1&keywords=opengl

REALLY REALLY disappointed me. I DO NOT want to use someone else's library to learn this stuff, that bothers me SOOO much.

So I was hoping there was a newer book that goes into detail, and doesn't use some sort of library "Hiding" everything from you.

Or should I just look at older material? If so....anything thats not "too" out of date. Terrain tutorials are a plus (that's kinda my "goal").

Thanks

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: How can i create a 2 player turn-based board game on a separate android device using unity? im trying to make a 2 player turn-based board game, i have already made the connection between 2 device. I used photon. They both connect but i don't know how to sync them both to the game. can any one help me? i hope my question is right.

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:
btBvhTriangleMeshShape useQuantizedAabbCompression Crash I use btBvhTriangleMeshShape for static world collision. Generally this works fine, but recently I have encountered situations where the construction of btBvhTriangleMeshShape would crash.

In debug builds I get an assert from:

btQuantizedBvh::quantize(unsigned short *,class btVector3 const &,int)
btQuantizedBvh::mergeInternalNodeAabb(int,class btVector3 const &,class btVector3 const &)
btQuantizedBvh::buildTree(int,int)
btOptimizedBvh::build(class btStridingMeshInterface *,bool,class btVector3 const &,class btVector3 const &)
btBvhTriangleMeshShape::buildOptimizedBvh(void)
btBvhTriangleMeshShape::btBvhTriangleMeshShape(class btStridingMeshInterface *,bool,bool)

If I disable useQuantizedAabbCompression during construction the issue does not occur and all appears to work well.

Are there some requirements for the mesh geometry that I am missing?

sentences:
C# Unity3D FPS apply damage to an enemy (Weapon bullet) I am kindly new to Unity3d and c# and I don't understand how I could let a bullet deal damage to an other object. I've seen a lot of JS tutorials but no for C#. I've tried to use them, but it wont work. My code I've tried: For the Bullet (Prefab)

   using UnityEngine;
using System.Collections;

public class MoveBullet : MonoBehaviour {

    public float speed = 10.0F;
    public float damage = 10.0f;

    // Use this for initialization
    void Start () {

    }

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

        transform.Translate (0, 0, speed);

    }

    void OnCollisionEnter(Collision col){

        col.gameObject.BroadcastMessage("ApplyDamage", damage);

    }
}

And the one for the Enemy:

public class enemyhealth : MonoBehaviour {

  public int health = 100;

  // Use this for initialization
  void Start () {
  }
  // Update is called once per frame
  void Update () {
  }

  void OnDamage(){
    health--;
    if (health <= 0) {
      Destroy(gameObject);
    }
  }
}

What's not clear to me as well is, what type of Collider I should use (Box Collider, CapsuleCollider...) Or doesn't it makes a difference?

As I understood, Rigidbody is used for an other "technique" to make damage, am I right?

sentences:
Cannot find GameController script - causing errors with logging and references I am learning the Unity engine and have been practicing with various tutorials, but there is a curious error I am experiencing with the space shooter tutorial. Collisions with the player ship do not destroy asteroids or the player, while collisions with bolts fired by the player will destroy the asteroids but not increase the score at all.

The error being logged is "Cannot find GameController script" which makes me think there is a problem with my code below, specifically the void Start() function that checks if GameController != null.

Is there something about Unity 5 that differs from Unity 4 that I would need to change? Or have I made a mistake in this code attempting to reference the GameController script?

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

public class DestroyByContact : MonoBehaviour {

    public GameObject explosion;
    public GameObject playerExplosion;
    public int scoreValue;
    private GameController gameController;

    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        if (gameController != null)
        {
            gameController = gameControllerObject.GetComponent<GameController>();
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }
    }

    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            return;
        }
        Instantiate(explosion, transform.position, transform.rotation);
        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.GameOver();
        }

        Debug.Log(other.name);
        Destroy(other.gameObject);
        Destroy(gameObject);
        gameController.AddScore(scoreValue);
    }
}

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:
Use of solid brushes and CSG in level building Since Quake 1 (I think it was the first), level design tools for FPS games have used solid brushes and CSG operations to define level geometry instead of more conventional poly modeling tools you see in general purpose 3d applications like 3DS MAX.

Why is this? Is it:

More productive for the level designer?
More likely to lead to closed geometry that won't screw up potentially visible set pre-calc?
Results in lower poly count (more cumbersome tools dissuade designers from adding too much detail)?
...

sentences:
Collision Detection and Bounding Box Creation I am trying to create bounding boxes. My goal is not to create them with giving x,y and z coordinates. But rather, I will be loading a model or else rendering a shape - say an aeroplane. The algorithm then should be able to create efficient bounding boxes around it. I am coding in opengl.

Can you help me out with the same?

sentences: 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:
I am trying to create a plugin and upload it online.But I do not want the users to be able to edit any of the content.Is that possible? I am trying to create a plugin that can be uploaded into the unity asset store.I do not want the users to be able to edit the content.Functions should not be editable,just the variables should be editable.Is that possible? Or it would be still better if i could just hide the entire script.Any suggestions please ?The scripts are to be attached to the gameobject that will be active in the scene.
Thanks

sentences:
How to make Line Renderer lines stay flat? I've noticed that as I add more vertexes to a Line Renderer line the line twists and stops being a smooth line.

.GIF Here: http://i.imgur.com/hRAhCXM.gif

All lines are on the same z level, even if I remove the materials the lines still seem to twist.

I have no idea why it does this, or how to go about resolving it, any suggestions?C#

sentences:
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:
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:
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:
GuiSan | SDL2 - Setting colour key of render target results in having an black screen At the moment i am experimenting with guisan within my little project. Everything is done sofar with SDL_Texture except Guisan which utilize SDL_Surfaces instead SDL_Texture for rendering itself.

Per sé this is absolutly fine. When guisan has finished rendering stuff on its SDL_Surface target I simply convert this Surface into an SDL_Texture or to be more precise I Update an pre-existing SDL_Texture and then Render this specific SDL_Texture. This works perfectly.

Till here everything is fine. I can interact with my GUI and the rest of my application. Then i thought at some point why not use an colour key (0xff00ff) to make the target of guisan transparent except for the parts it is drawing his stuff.

So i started calling:

 SDL_FillRect(guisanTarget,NULL,*0xff00ff*);

To Fill my Target with the colour key i am about to hide away, with this call:

SDL_SetColorKey(guisanTarget,SDL_TRUE,SDL_MapRGB(guisanTarget->format,0xff,0x00,0xff));

And here is where my problem occurs... if i try to set my colour key the result will be a black screen. No visible GUI to interact with. If I DO NOT set the colour key via SDL_SetColorKey then i get my GUI with the background colour i filled my Target via SDL_FillRect.

I have no clue why... If anyone has an idea what the reason for this behaviour is please let me know i would appreciate it a lot. see my issue

sentences:
Best resources for Canvas Html 5 development I am at a competition at work for who can make the best canvas game.  Theme is a top down shooter... Winner gets dinner for free.

Anyways I have been looking around looking for some good resources on game deving on the canvas.  Any body got any good ones?

sentences:
How best to handle ID3D11InputLayout in rendering code? I'm looking for an elegant way to handle input layouts in my directx11 code.

The problem I have that I have an Effect class and a Element class. The effect class encapsulates shaders and similar settings, and the Element class contains something that can be drawn (3d model, lanscape etc)

My drawing code sets the device shaders etc using the effect specified and then calls the draw function of the Element to draw the actual geometry contained in it.

The problem is this - I need to create an D3D11InputLayout somewhere. This really belongs in the Element class as it's no business of the rest of the system how that element chooses to represent it's vertex layout. But in order to create the object the API requires the vertex shader bytecode for the vertex shader that will be used to draw the object. In directx9 it was easy, there was no dependency so my element could contain it's own input layout structures and set them without the effect being involved.

But the Element shouldn't really have to know anything about the effect that it's being drawn with, that's just render settings, and the Element is there to provide geometry.

So I don't really know where to store and how to select the InputLayout for each draw call. I mean, I've made something work but it seems very ugly.

This makes me thing I've either missed something obvious, or else my design of having all the render settings in an Effect, the Geometry in an Element, and a 3rd party that draws it all is just flawed.

Just wondering how anyone else handles their input layouts in directx11 in a elegant way?

sentences:
Implementing A* with Heap tree I'm trying to implement Heap into my A* algorithm, However I'm having trouble with implementing one method. The Contains method. Which checks if the heap array has a specific node in it or not. I don't know how to implement that. If I just make a for loop and check every item in the heap that would be very very slow and defeat the purpose of a heap.

So my question is, How do you check if an item exist in a OpenSet of type Heap? What is the fastest way to do it?

This is my heap code:

namespace AI
{
public interface IHeapItem<T> : IComparable<T>
{
    int HeapIndex { get; set; }
}

class Heap<T> where T : IHeapItem<T>
{
    T[] Items;
    int count;
    public int Count { get { return count; } }

    public Heap(int MaxSize)
    {
        Items = new T[MaxSize];
    }

    public T this[int Index]
    {
        get
        {
            if (Index > count)
                Index = count - 1;

            return Items[Index];
        }

        set { Items[Index] = value; }
    }

    public void Push(T Item)
    {
        Item.HeapIndex = count;
        Items[count] = Item;
        SortUp(Item);
        count++;
    }

    public T Pop()
    {
        T FirstItem = Items[0];
        count--;
        Items[0] = Items[count];
        Items[0].HeapIndex = 0;
        SortDown(Items[0]);
        return FirstItem;
    }

    public bool Contains(T Item)
    {

    }

    void SortDown(T Item)
    {
        while (true)
        {
            int LeftChildIndex = Item.HeapIndex * 2 + 1;
            int RightChildIndex = Item.HeapIndex * 2 + 2;
            int swapIndex = 0;

            if (LeftChildIndex < count)
            {
                swapIndex = LeftChildIndex;

                if (RightChildIndex < count)
                    if (Items[LeftChildIndex].CompareTo(Items[RightChildIndex]) < 0)
                        swapIndex = RightChildIndex;

                if (Item.CompareTo(Items[swapIndex]) < 0)
                    Swap(Item, Items[swapIndex]);
                else
                    return;
            }
            else
                return;
        }
    }

    void SortUp(T Item)
    {
        int ParentIndex = (Item.HeapIndex - 1) / 2;

        while (true)
        {
            T ParentItem = Items[ParentIndex];
            if (Item.CompareTo(ParentItem) > 0)
                Swap(Item, ParentItem);
            else
                break;

            ParentIndex = (Item.HeapIndex - 1) / 2;
        }
    }

    void Swap(T ItemA, T ItemB)
    {
        Items[ItemA.HeapIndex] = ItemB;
        Items[ItemB.HeapIndex] = ItemA;
        int itemAIndex = ItemA.HeapIndex;
        ItemA.HeapIndex = ItemB.HeapIndex;
        ItemB.HeapIndex = itemAIndex;
    }
}
}

sentences:
Steering in top-down racer with Libgdx I'm a beginner in game development and as a little project I thought I should try to do a top-down racer game much like the good old Slicks n Slide.

I've seen several tutorials and questions about steering and car physics but most is more complicated than what I need and uses box2d with wheels turning and so on.

I want it to keep simple and only want three buttons. Accelerate, turn left and turn right.
And my "car" is for now just a circle :-)

My question is how to do the steering. If someone can explain it simple to me I would be very thankful.
I know I need to use sin and cos to get the steering angle but I haven't figured out how.

sentences:
Why are spherical worlds so rare? I remember back in the 90s when X-Com came out, being really impressed by the way its world map was an actual world: a map of Earth drawn on a spherical surface.  That was pretty cool, because I had never seen it before.  And now, thinking back... I can't recall just off the top of my head ever seeing it again, with the obvious exception of X-Com: Terror From The Deep, which used the same engine.

Most games that have an entire-planet world map either use a rectangle that wraps around at the sides but not the top and bottom (a cylinder), or a rectangle that wraps around at all four edges (an impossible geometry that some people call a "torus", even though it can't actually represent a real torus.)  And that makes me wonder why.

What difficulties does attempting to build a spherical world map for a video game raise, that it's so incredibly rare to actually see it done?

sentences:
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:
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: XNA seams between 3d primitives in tiled terrain Every time I draw two primitives side by side, in this case two quads, I always get this seam-like tearing effect right along the sides of them. I'd like to think there is just an easy fix, but the only way I can think of would be reworking my indices, which I think would compromise my ability to draw textures. If anyone reading this can think of any fix, that would be great. Thanks in advance.

sentences:
Weird warping with per-vertex normals I've had this little problem for a while now, where for some reason my calculations for per-vertex normals results in a weird distortion or warping, skewing my lighting, shading, and reflection passes.

In spherical geometry, it noticeably distorts at the beginning and end, resulting in an imperfect transition in a cubemap reflection:

In rectangular geometry, normals are quite warped and skewed on an angle:

Same perspective (top down), but switched over to the normal map:

My approach for calculating per-vertex normals is to cycle through all the vertices in a mesh, while also looping through each triangle in the mesh (inner loop). I check if the desired vertex exists in the triangle, and if so I sum that triangle's normal into the normal for that vertex. After all the normal's have been summed together for a given vertex, I normalize it.

My implementation of the above is as follows:

QVector<GLushort> *i = getIndices();
QVector<QVector3D> *n = getNormals();
int total = i->size();
n->resize(total);

if ( total > 0 )
{
    // Loop through each vertex in mesh
    for (int x = 0; x < total; x++)
    {
        QVector3D normal = QVector3D(0,0,0);

        // Loop through each triangle in mesh
        for (int y = 0; y < total; y+=3)
            if (doesTriangleContainVertex( i->at(y), i->at(y+1), i->at(y+2), i->at(x)) )
                normal += calculateTriangleNormal( i->at(y), i->at(y+1), i->at(y+2) );

        n->replace(x,normal.normalized());
    }
}

My calculation for a normal for a given triangle is just the cross product of (vertex2-vertex1 and vertex3-vertex1).

Does anyone have any ideas as to why this is happening? The underlying shading methods work fine,  at least with per face normals,  but that obviously gives a faceted look, which I'm trying to avoid.

sentences:
UE4 "get" and "set" component without using an actor specific reference i'm using Unreal Engine 4 and I want to get the variable mode from some actors by referencing them but the only option that i can find in the menu is actor specific like this.

So what i want is a version of the component in my image that is not "Target H1" specific. And i also need the same thing for the "set" component please. and if this is not possble can someone tell me please.

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: If I save some information with PlayerPrefs, they will remain saved even if the game is online? If I make a game in unity and I use the PlayerPrefs function to save the progress and load it in another play, that information will be stored even if the game is loaded on an online platform? I mean: I save a number: 4. Then i close the web page, and enter again and hit load. That number will be saved and loaded properly for every user that plays the game?

sentences:
Inverse Kinematics using Pseudoinverse Jacobian I'm having problems solving IK with Jacobian Pseudoinverse method.

What I do is:

At each local joint frame q_i of the chain q calculate the cross product between rotation axis (taken from local transform) and joint-to-end-effector vector (end-effector is transformed to q_i coordinates):

// for each joint q_i -> to parent iteration

// Get Local Joint Position and Rotation Axis
lTransform = ... // local transform of i-th joint
if (lTransform.Decompose(s, q, t)) {
    q.AxisAngle(lRotationAxis, angle); // quaternion, XMQuaternionToAxisAngle
}

// Transform End-Effector To Local Joint Coordinates
lEndPosition = Vector3::Transform(lEndPosition, lTransform); // each iteration is updated to-parent
lJointToEnd = lEndPosition - lTransform.Translation();
lResultAxis = lRotationAxis.Cross(lJointToEnd);

jacobian(0, i) = lResultAxis.x;
jacobian(1, i) = lResultAxis.y;
jacobian(2, i) = lResultAxis.z;
jacobian(3, i) = lRotationAxis.x;
jacobian(4, i) = lRotationAxis.y;
jacobian(5, i) = lRotationAxis.z;

Set up desired change in position dX = globalObjective - globalEndPosition (fill the rest with zeros [orientations]).
Calculate configuration dQ with jacobian pseudoinverse:

jT = jacobian.transpose();
inv = (jacobian * jT).inverse();
jpinv = jT * inv;

dQ = jpinv * dX;

So what exactly is dQ? Each value should represents a local change in i-th joint.

Is it the angle of rotation around rotation axis in local joint frame?
Or maybe translation value along cross product?

I tried applying both variations above updating local joint transform with simple matrix multiplication and none of this works. The end-effector position seems to be moving very randomly - at each iteration it's very different.

sentences: Is there an alternative to decals that will let me put bullet holes on a complicated object? I'm trying to figure out a way to do "bullet holes" but actually apply the texture at the shader level?  If I'm dealing with a model which doesn't have a "flat" face I'd like to be able to wrap the "decal" across the model.  Anyone point me at a tutorial that will do something similar to this.

sentences:
Unity 5 Command not being sent I have a client server build in Unity 5. I want to send a command from the client to the server with a GUI button click, this is for testing purposes. So on my client all I want is to click a button and then have the server display a message on its console window. Reading through http://docs.unity3d.com/Manual/UNetActions.html this seems to require a player object. With the demo I am trying to create there is no player. So I created an empty game object and called it player and assigned it a player script:

public class Player : NetworkBehaviour {

void Update ()
{   //receive message from camera follow script to run command from client to server
    if (isServer)
        return;

    if (GameObject.Find("Main Camera").GetComponent<CameraFollow>().sendCommand)
    {
        CmdTurnOnNetworkTransformOnServer ();
    }
}

[Command]
void CmdTurnOnNetworkTransformOnServer()
{
    UnityEngine.Debug.Log ("Received");
}
}

This script checks if a boolean is true on another script (the script that contains the GUI button that when clicked sets the bool to true). if it is true then I would like the server to display "Received" on the console in the editor. However I get the error "Trying to send command for non-local player." From what I can see I am following the above link properly to just display a simple message. I realise there is another route with http://docs.unity3d.com/Manual/UNetMessages.html however I would like to see if I can get a command working instead.

Full Error: Trying to send command for non-local player.
UnityEngine.Networking.NetworkBehaviour:SendCommandInternal(NetworkWriter, Int32, String)
Player:CallCmdTurnOnNetworkTransformOnServer()
Player:Update() (at Assets/Player.cs:37)

How come I am getting this error?

This error appears in the client console window

sentences:
Accounting for waves when doing planar reflections I've been studying Nvidia's examples from the SDK, in particular the Island11 project and I've found something curious about a piece of HLSL code which corrects the reflections up and down depending on the state of the wave's height.

Naturally, after examining the brief paragraph of code:

// calculating correction that shifts reflection up/down according to water wave Y position
float4 projected_waveheight = mul(float4(input.positionWS.x,input.positionWS.y,input.positionWS.z,1),g_ModelViewProjectionMatrix);
float waveheight_correction=-0.5*projected_waveheight.y/projected_waveheight.w;
projected_waveheight = mul(float4(input.positionWS.x,-0.8,input.positionWS.z,1),g_ModelViewProjectionMatrix);
waveheight_correction+=0.5*projected_waveheight.y/projected_waveheight.w;
reflection_disturbance.y=max(-0.15,waveheight_correction+reflection_disturbance.y);

My first guess was that it compensates for the planar reflection when it is subjected to vertical perturbation (the waves), shifting the reflected geometry to a point where is nothing and the water is just rendered as if there is nothing there or just the sky:

Now, that's the sky reflecting where we should see the terrain's green/grey/yellowish reflection lerped with the water's baseline. My problem is now that I cannot really pinpoint what is the logic behind it. Projecting the actual world space position of a point of the wave/water geometry and then multiplying by -.5f, only to take another projection of the same point, this time with its y coordinate changed to -0.8 (why -0.8?).

Clues in the code seem to indicate it was derived with trial and error because there is redundancy. For example, the author takes the negative half of the projected y coordinate (after the w divide):

float waveheight_correction=-0.5*projected_waveheight.y/projected_waveheight.w;

And then does  the same for the second point (only positive, to get a difference of some sort, I presume) and combines them:

waveheight_correction+=0.5*projected_waveheight.y/projected_waveheight.w;

By removing the divide by 2, I see no difference in quality improvement (if someone cares to correct me, please do). The crux of it seems to be the difference in the projected y, why is that? This redundancy and the seemingly arbitrary selection of -.8f and -0.15f lead me to conclude that this might be a combination of heuristics/guess work. Is there a logical underpinning to this or is it just a desperate hack?

Here is an exaggeration of the initial problem which the code fragment fixes, observe on the lowest tessellation level. Hopefully, it might spark an idea I'm missing. The -.8f might be a reference height from which to deduce how much to disturb the texture coordinate sampling the planarly reflected geometry render and -.15f might be the lower bound, a security measure.

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:
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:
Swap limbs of a skinned mesh If I have a model, such as a robot, I am able to swap its limb meshes out and replace them with other robot limb meshes by merely removing the limb mesh from the skeleton and attaching the new one to the appropriate bone.

Now I want to essentially do the same thing but with a skinned mesh, say a human/monster character. For example I want to swap a normal human arm for some bad-ass demon arm. How do I go about doing this as I believe I need to take into account skin/bone weights etc.

Didn't Spore do something similar? Although my skeleton would be predefined as opposed to the ones created in Spore.

sentences:
Traversing a pre-defined path with a delay in SFML - C++ I want the player to move smoothly & slowly through a vector of co-ordinates that define a path, below is an illustration of what i mean.

[P][ ][ ][ ][ ]
[.][ ][ ][ ][ ]
[.][ ][ ][ ][ ]
[.][ ][ ][ ][ ]
[.][.][E][ ][ ]

Once the path has been found the player should move between each tile with a visual delay, i have tried to code this behavior in a variety of ways but it seems that this a problem created by running Update/Render on the same thread, i think?

Here is what i tried

 if (pathFound)
 {
    for (auto path : waypoint_queue)
    {
        Move(this->character.getPosition(), path)
    }
    waypoint_queue.clear();
    pathFound = false;
} else {  }

Running this without a delay in an attempt to lerp between the co-ordinates of each "Next Tile" essentially teleports the player to the final node.

Running this with a delay of 1s for 10 tiles halts the program for 10 seconds then teleports the player to the final node.

How do i go about producing C#-like co-routine behavior that can update variables with a timed delay whilst also rendering them?

Thanks

sentences: How Would I Design Realistic Fluid Handling? I'm making a game that is like a mix of many other games (Minecraft, Factorio, Don't Starve, Terraria, etc). I want to make pipes and fluid handling like it works in Factorio. I can't seem to find much information on it. I thought about making fluid even out across all connect pipes with less fluid than this pipe, but the order in which I processed pipes would matter a lot. So, how exactly does Factorio work? I also want pumps, if that changes anything.

sentences:
Poly Count in Unity games. 3d Asset detail I've begun making my own characters for my games. These are just tests that I copied from other references (ie. Cartoons TV etc). I used Maya with the 'Convert Smooth Preview To Polygons' to make the mesh nice and smooth.
However upon importing to Unity, perhaps I am wrong, but the number of polys looks way higher than models I just downloaded from Unity Store etc.
If I continue making ALL my assets in this detail, would the game run ok. (I'm targeting PC, not mobile phones. And I don't mind if low end pcs struggle but anything mid-range and up.)
Should this detail be ok and I can focus on my game dev? Or should I spend some more time trying to reduce the poly count on my models (without compromising too much detail)?
Thanks

sentences:
How does rendering with Swing compare to rendering with openGL? [summary: Is the performance of Swing at least in the same dimension as openGL [through LWJGL]? If yes, what percentage would you give it? What  possible other problems can I expect from Swing in the long run, that I would avoid with openGL?]

So for quite some time I wanted to make my own simple java 2D game engine.

On my first try I was following a tutorial that used openGL (through LWJGL)
Because said tutorial wasn't complete I was kind of lost at the end, which caused me to use code that was so inefficient that a simple pong game crashed after 10 seconds because the jvm ran out of memory.

On my second try I, quite successfully, used Swing to render to a jPanel, which significantly reduced the complexity involved (Why can't lwjgl have ANYTHING similar to JPanel.render(Image)?) and allowed me to create some simple games that so far don't seem to take up excessive memory / cpu.

Now my question is whether this could bite me in the ass in the long run, or if it eventually only comes down to a negligible performance hit that I would trade for a more intutive way to code.
(Note that I don't care about 3D for now)

sentences:
GLX/X11 Changing the rendering resolution I have made a simple application that creates a window with an OpenGL 4.2 context and takes user input.

I have implemented making the window go fullscreen with XRandR and can change the display resolution.

I would like to change this so that I don't have to set the displays resolution and only the window/contexts so that it renders at a lower resolution but the display stays at its default.

How could I implement this? Which extensions provide this or can I do this with XRandR and just manipulating the window rather than the root window(dektop)?

Thanks.

sentences:
Puzzle game: clipping of non-convex polygons on the figures I have an original figure in the SVG file. I need to break it randomly on parts, an example of which is specified below:
I have an idea, to use for partitioning Voronoi diagram (Fortune's algorithm). Can I then change the line of intersection of figures to give them a curvature? Can be obtained to identify each shape as a path?
To create a game I'll be using cocos2d-x.

sentences:
Why is this Mono Behavior in the animator? I'm looking through the 3D Game Kit from the asset store to accustom myself with the animator, and I'm just wondering what this is referring to.
I was looking into controlling MonoBehaviors through the animation controller the other day and thought I had come to the conclusion that it couldn't be done directly, so what's this?

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:
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:
Fb.Feed dialog closes before saving I'm having trouble with the Facebook UnitySDK when I use the FB.Feed() method for posting on user's timeline. The share dialog closes before the post is completed, Right after i press the "Post" button. This only happens when I test the app on the iOS Device since on the Unity Editor it works fine and I can post on the user's wall. User Login and getting username and profile pic, for example, work fine. The problem is when I try to share the user's score on facebook. Here's my code for the method:

public void Share_Score(){
        FB.Feed (
            toId: "",
            link: "http://www.facebook.com/appname",
            linkName: "App Name",
            linkCaption: "I just scored " + " points",
            linkDescription: "Playing this game is awesome!",
            actionLink:"http://www.facebook.com/appname",
            actionName: "Appname Fan Page"
                );
    }

The only error that appears on XCode is the following: 2015-02-11 10:13:07.025 hotdogcontest[749:224865] FBSDKLog: FBLinkShareParams: only "http" or "https" schemes are supported for link thumbnails

sentences: How do I make someone walk in Skyrim? I'm coding a mod for Skyrim with Papyrus and the Creation Kit. I can't seem to get an Actor to move from point A to point B. I know there's a function to teleport an actor, but how can I make them walk or run using Papyrus?

sentences:
Unity3D C# Drag object smoothly on it's x axis that's already bouncing In my scene, I have a bouncing ball that collides with a cube. On each collision the ball returns to the same height. How can I get the ball to smoothly move along the x-axis by dragging my finger across the screen, while at the same time having no effect on the y or z values?

The y position is changing every frame depending on the state of the jump, so setting it's y position to transform.position.y in the Update function causes the movement to be jittery if the frame renders when it isn't caught up with the position of the ball.

Also, I set the interpolate value of the rigidbody to interpolate to get a smoother jumping motion, not sure if this is relevant to my problem or not.

Here is where I am at so far with little success. A few mobile games that replicate what I'm trying to achieve in terms of ball movement are Hop, Color Hop, and Splashy!

void Update()
{
    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
    {
        // Control sliding using touch input.
        Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
        transform.Translate(touchDeltaPosition.x * slidingSpeed, 0, 0);
    }
    transform.position = new Vector3 (Mathf.Clamp(transform.position.x, - xPosLimit, xPosLimit), transform.position.y, transform.position.z);
}

sentences:
Phone complains that identical GLSL struct definition differs in vert/frag programs When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant / Android 2.2) complains that the definition differs.

struct Light {
    mediump vec3 _position;
    lowp vec4 _ambient;
    lowp vec4 _diffuse;
    lowp vec4 _specular;
    bool _isDirectional;
    mediump vec3 _attenuation; // constant, linear, and quadratic components
};

uniform Light u_light;

I know the struct is identical because its included from another file. These shaders work on a linux implementation and on my Android 3.0 tablet. Both shaders declare "precision mediump float;"

The exact error is:

Uniform variable u_light type/precision does not match in vertex and fragment shader

Am I doing anything wrong here, or is my phone's implementation broken? Any advice (other than file a bug report?)

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:
Same game logic on two separate graphic libraries What code philosophy/structure of abstraction/program design would allow a game to be used with both 2D and 3D graphics (separately) WITHOUT having to re-code the Game logic?

We're talking taking the same code, changing a minimum of things (for example, exchange filenames for 2D assets with filenames for 3D assets), and maybe plugging in a few specialisations of a base class per generics/templates.

To put it in a real context where it makes sense: imagine a LAN-multiplayer game where there is one top-notch, performance-hungry 3D client for the players with some really good gamer rigs, and a more humble 2D client for the old dusty boxes that someone found in their attic. But it's still the same game - the same events are registered (someone picked up a coin), the same Network protocol is used, the worlds are proportional, etc.

To put it in a MVC context: The Controllers are the exact same (pressing the "Up" key will set the players acceleration at 3.5 units/second), the Views are totally different (2D versus 3D), and the Model is the same except for anything directly related to graphics (a collision check for the environment is performed every 5 seconds, and it uses the same algorithm. Note that this would mean there IS a Z-coordinate for all the Game Objects in the 2D version, but it's just ignored or displayed to the user in another way, for example by a shadow that is displayed further left when the player is in the air).

What makes this such a fascinating topic is that it would FORCE the developer to have a very clear idea of how his data is structured and how control flows. Note that this does not imply using anything other than a graphics library like SDL, D3DX or OpenGL. No game engines!

Since this is a mostly theoretical question, I'll leave programming languages out of it, but if you want to give an example you can use any language you like, C++ if you want to go the whole hog, or even Brainfuck if you feel up to the challenge (Any concrete answers will be appreciated, as well as any abstract ones!).

sentences:
Saving an array in GameMaker with DS Maps I have the following issue. I'm creating a game with different levels. When the level is generated, an array of random number is generated for later use.

If the player leaves the game and come back later, I would like the array to be the same. So I'm trying to save the array when the level is generated. I was thinking about using the function ds_map_add_list(id, key, value).

I'm digging through the documentation, but I'm a bit lost and I have a few questions:

How do I create a list from a GML array?
If I create a DS Map with the following function inventory = ds_map_create();, what's the scope of the DS Map? Can I use it only in the object holding the code where it was created?

sentences:
Calculating and detecting curves How can I detect the 'steepness' of a curve? For example, if the user swipes their finger across the screen in a curve, what's the best way of detecting whether the curve is almost a semi-circle, or whether it's straight?

Is it also possible to extend this to possibly recognise multiple curves (e.g. a sigmoidal shape)?

Thanks for any advice

sentences:
Project collision shapes to plane for 2.5D collision detection I am working on a top down 2.5D game. In the game anything that overlaps on the screen should be 'colliding' with each other regardless of whether they are on the same plane in the 3D world. This is illustrated below from a side-ways view:

The orange and green circles are spheres floating in the 3D world. They are projected onto a plane parallel to the viewport plane (y = 0 in the image) and if they overlap there is a collision event between them. These spheres are attached to other meshes to represent the sphere bounding boxes for collisions.

The way I plan to implement this at the moment is the following:

Get the 3D world position at the center of the sphere.
Use Camera.WorldToViewportPoint to project the point to the viewport plane.
Move a Sphere Collider with the radius of the sphere to that point.
Test for collisions using unity colliders.

My question is how to extend this to work for rotated cuboids. For instance if I have two rotated cuboids, if I follow the logic above it would not work as intended as the cuboids may not collide but they could still be intersected on the view plane. An example is below:

In the example above the cuboids are overlapping from the view of the player, but not colliding when they should be.

Is there a way to project a cuboid that would be aligned with the plane? Would it be a valid cuboid for all rotations if I did this?

EDIT: Corrected the images, before they were incorrectly projecting onto the y=0 plane at 0 rotation, not the plane parallel to the viewport plane.

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:
How can I modify the GUI of a default Unity window? How can I modify the GUI of a default Unity window?
E.g. I am trying to modify the Animation window. Here is what I am trying to do for the beginning:
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(Animation))]
public class AnimationExtended : Editor
{
    public override void OnInspectorGUI()
    {

    }
}

I would expect the code above to hide the content of the Animation window completely, but it does not. Why?
Here is what I mean by the Animation window.

Question which made me want to add a custom feature to the Animation tab.

sentences:
Under what circumstances will a PIX 'Render' be different to the actual 'render'? I am trying to implement dual-pass alpha sorting using Ogre material scripts, as part of my debugging attempts I want to compare two PIX captures, but when I attempt to debug a pixel in PIX, previously working 'geometry' is not displayed correctly.

My 'reference' blended geometry which works consistently, consists of a simple box with a translucent material, sitting over a set of opaque primitives. In my app this displays fine with the 'smoked' box tinting the objects/pixels behind it.
When I load up my app starting through PIX this continues to work, but once I load a capture taken from this in PIX, it no longer blends the pixels and instead culls them.

I know it is PIX because in the debugger tab, I see the initial value of the pixel I am debugging is the correct blended colour, but the final frame buffer value is the darker incorrect colour - its as if PIX is 're-rendering' the shot and doing it wrong!

Could anyone suggest a reason for this behaviour?

sentences:
Why do the order of struct members between vertex and pixel shader must be reversed? This has been driving me crazy for the last two days but it is finally working, however I really don't see why the order of struct members should be reversed.

Why do members of PS_INPUT must be reversed compared to VS_INPUT for this shader to work ?

Texture2D<float4> Texture;

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

// A constant buffer that stores the three basic column-major matrices for composing geometry.
cbuffer ModelViewProjectionConstantBuffer : register(b0)
{
    matrix model;
    matrix view;
    matrix projection;
};

struct VS_INPUT
{
    float4 Position : SV_Position;
    float4 Color    : COLOR0;
    float2 TexCoord : TEXCOORD0;
};

struct PS_INPUT
{
    float2 TexCoord : TEXCOORD0;
    float4 Color    : COLOR0;
    float4 Position : Position;
};

PS_INPUT mainVS(VS_INPUT vs_input)
{
    float4 pos = float4(vs_input.Position);
    pos.w = 1.0f;
    pos = mul(pos, model);
    pos = mul(pos, view);
    pos = mul(pos, projection);

    PS_INPUT output;
    output.Position = pos;
    output.Color = vs_input.Color;
    output.TexCoord = vs_input.TexCoord;
    return output;
}

float4 mainPS(PS_INPUT ps_input) : SV_TARGET
{
    float4 value = Texture.Sample(linearSampler, ps_input.TexCoord);
    value.rgb = 1 - value.rgb;
    return value;
}

float4 main(float2 uv : TEXCOORD0) : SV_TARGET
{
    float4 value = Texture.Sample(linearSampler, uv);
    value.rgb = 1 - value.rgb;
    return value;
}

technique Technique1
{
    pass Pass1
    {
        EffectName = "TextureEffect";
        VertexShader = compile vs_4_0 mainVS();
        PixelShader = compile ps_4_0 mainPS();
    }
}

Note that I am still getting the following even though things are being drawn:

D3D11 ERROR: ID3D11DeviceContext::DrawIndexed: Rasterization Unit is enabled (PixelShader is not NULL or Depth/Stencil test is enabled and RasterizedStream is not D3D11_SO_NO_RASTERIZED_STREAM) but position is not provided by the last shader before the Rasterization Unit. [ EXECUTION ERROR #362: DEVICE_DRAW_POSITION_NOT_PRESENT]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (COLOR,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (Position,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]

Can you explain why it does that and how can I fix it ?

sentences:
Can DDS be used in OpenGL in Linux without license/patent issue? Is there a 'standard' for OpenGL game creation intended for both Windows and Linux? I understand DDS is the DirectX standard (or, at least, it appears to be). Is there one that does not have potential patent/license issue or does it really not matter?

I am asking as I would like to avoid focusing on DDS as the format to use, only to have that kick me in the teeth later when some license/patent/??? issue requires me to remove and replace DDS with [texture format here]. This is not about what is better or an opinion post, but what is (relatively) safe from the constraints mentioned earlier?

sentences:
How do I expose a variable from a class in Unreal Engine 4 to blueprints? I would like to expose to blueprints the variable CurrentTouchInterface in the class APlayerController, just like the method APlayerController::ActivateTouchInterface.

So, I'm guessing I have to change the header file PlayerController.h from this

/** The currently set touch interface */
UPROPERTY()
class UTouchInterface* CurrentTouchInterface;

To something like this

/** The currently set touch interface */
UPROPERTY(BlueprintReadOnly, Category="Game|Player")
class UTouchInterface* CurrentTouchInterface;

The point is, what do I need to do for the engine's editor to start showing the exposed variable CurrentTouchInterface in blueprints?

I'm working with UE 4.9 downloaded from the Epic Games Launcher application.

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:
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:
Non-rectangular hitbox methods in XNA I'm creating a 2D top-down RPG, and many of my buildings/scenery have non-rectangular corners to the textures. Does anyone know a good way to create circular/triangular/polygonal hitboxes, or is too intensive too be worth it?

P.S. If it is too intensive, I can stick with rectangular hitboxes, no big deal.

sentences:
Storing coordinates of every object in server side in MMOs In an MMORPG:

Is it typical or feasible to store the coordinates of every tree, bush rock.. etc in the server side for collision detection?

If so, what would be a feasible way to store such a huge number of coordinates (data structures and such, performance issues handling)?

If not, is this type of collision detection done entirely in the client side, with the server not checking at all?

Or is there a middle ground, with the client checking collision and server verifying? If so, how would the server verify the same without keeping the coordinates in the server as well?

sentences:
I want to make a racing game.Can I have licensed cars without paying for licenses? My idea was something similar to rFactor, but very easy to mod. There will be a step by step tutorial.

If I or somebody from the developers make the mods and publish them, do I still need licensing? Now it's just an idea, but I plan to make at least 1000-1500 cars from at least 150 manufacturers, and that would cost a fortune. A lot of the cars would be converted from other games like Forza or GT6 and others modeled by my team.

sentences:
Java High-Resolution Timer for a simple game I want to work on a model of some kind of simple shape shooter game I would develop for either the desktop or the Android, using the libGDX library. There's something I want to incorporate into the game, and that is a countdown timer with the smallest unit in centiseconds.

The trouble I'm having is which resource to use to incorporate a fully-accurate game timer where it is in sync with real time, meaning that every second on the game timer, when the game is running at full speed, is equal to one second in real time. (I should understand what is a high-resolution timer)

Java's Swing Timer class won't do, and so are the two methods from the static System class. And I'm not very confident about the timer classes I've looked up online, unless I accidentally ran into one of them and never realized it's completely accurate.

I have practiced implementing my own countdown timer except that it ain't synchronized because I'm doing an update for every 10 milliseconds. I asked a similar question on StackOverflow, but I am getting a little too obsessed in trying to find a perfectly good timer.

sentences:
RTS: Unit sight in fog of war I am making an RTS game, and like most RTSs, you can see what's going on in a part of a map only if you have a unit over there.

I have few ideas how to accomplish this, but there are problems with them.

Problems are:

Algorithm must be efficient.
I need to notify players (over network), when an enemy comes into sight.
How do I account for obstacles obstructing sight (such as cliffs).

Naïve approach would be like this:

// pseudocode
func calculate_visibility:
   vector<Bitfield> visible;

   for all units on map:
        let unit = enumerated unit

        for all human players:
             let player = enumerated player

             for all units of player:
                  let player_unit = enumerated unit

                  if player_unit sees unit
                       visible[unit.id][player.id] = true
                       process next player

And then run this calculation each frame, compare results with previous frame and send out events, like “enemy unit detected”.

I did some benchmarking, and using approach like this may take up to 2/3 of a frame, which is unacceptable.

I figured out a better way to calculate which units are visible. This approach is to use a visibility map.

Subdivide the map into N×M cells.
Each cell is marked by IDs of players that can see the cell.
To determine which players can see an unit, I need only to check cells that contain given unit.

However, I don't know how to fill the map in the first place. I could iterate through all units and use a circle-drawing algorithm.

But I'll have to redraw the visibility map every frame, so this doesn't look much more efficient than the first approach. Unless I update it at a lower rate, but then there's a problem with fast-moving units.

And how do I detect when unit comes in player's sight, except than iterating through every unit and comparing with previous frame?

How is this done in modern RTS, such as StarCraft 2?

sentences:
elements of list are changing their values I'm making an app that's similar to an alarm, the user enters time and days, for days I'm using toggles,and storing the values of toggles states in a list which is stored in a list that contain all the inputs of the type days, then the user could edit any of his inputs, his old input are supposed to be shown there , but the problem is even when I'm storing them, old values are changing when I add new elements,(that's when currentToggle is changing) so when he press edit values aren't the same as he entered them

I think it has something to do with nested lists but I can't figure out how, ( assigning hours and minutes is perfectly working and both are normal lists)

the confirm method is for when the user confirm his choice, and there's edit button that open a panel ,its values are the same as the user entered them before

the index gives the number of the selected group of input, dayholder is the gameobject that contains all the toggles , and that's the part of the code that's related to what I've said

Toggle[] toggles;
List<bool> currentToggle = new List<bool>();
List <List<bool>> daysAll = new List<List<bool>>();

void Start () {
    toggles = dayHolder.GetComponentsInChildren<Toggle>();
}
public void confirm()
{

    checkON();
    daysAll.Add(currentToggle);
}
 public void editBut()
{
    GameObject panelC = EventSystem.current.currentSelectedGameObject.gameObject.transform.parent.gameObject;
    int index = panelC.transform.parent.gameObject.transform.GetSiblingIndex();
    assignDays(index);
}
void assignDays(int index)
{
    for (int i = 0; i < daysAll[index].Count; i++)
    {
        if (daysAll[index][i] == true)
            toggles[i].isOn = true;
    }
}
public void checkON()
{
    currentToggle.RemoveAll(item => item != null);
    for (int i = 0; i < toggles.Length; i++)
    {
        if (toggles[i].isOn)
            currentToggle.Add(true);
        else
            currentToggle.Add(false);
    }

}

sentences:
How do I determine a device's default orientation? I am developing a game with accelerometer controls. This works well on all the mobile phones I've tested it on. However, when testing on a tablet, the y and x axes are reversed, presumably because the device's default orientation is landscape.

How can I identify the default orientation of the device, to set my axes accordingly?

(I'm using Android SDK 1.5 - 1.7.)

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:
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 can I get the vector3's names to gameobject name? void DrawBox()
    {
        SpawnLineGenerator(v3FrontTopLeft, v3FrontTopRight, color);
        SpawnLineGenerator(v3FrontTopRight, v3FrontBottomRight, color);
        SpawnLineGenerator(v3FrontBottomRight, v3FrontBottomLeft, color);
        SpawnLineGenerator(v3FrontBottomLeft, v3FrontTopLeft, color);

        SpawnLineGenerator(v3BackTopLeft, v3BackTopRight, color);
        SpawnLineGenerator(v3BackTopRight, v3BackBottomRight, color);
        SpawnLineGenerator(v3BackBottomRight, v3BackBottomLeft, color);
        SpawnLineGenerator(v3BackBottomLeft, v3BackTopLeft, color);

        SpawnLineGenerator(v3FrontTopLeft, v3BackTopLeft, color);
        SpawnLineGenerator(v3FrontTopRight, v3BackTopRight, color);
        SpawnLineGenerator(v3FrontBottomRight, v3BackBottomRight, color);
        SpawnLineGenerator(v3FrontBottomLeft, v3BackBottomLeft, color);
    }

And the gameobjects name:

    void SpawnLineGenerator(Vector3 start, Vector3 end, Color color)
    {
        GameObject myLine = new GameObject();
        myLine.name = start.ToString();

        myLine.transform.position = start;
        myLine.AddComponent<LineRenderer>();
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
        lr.startColor = color;
        lr.endColor = color;
        lr.startWidth = 0.03f;
        lr.endWidth = 0.03f;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);
    }

The method SpawnLineGenerator get two vector3 and a color:

SpawnLineGenerator(v3FrontTopLeft, v3FrontTopRight, color);

In the SpawnLineGenerator i'm setting a name for each gameobject:

 myLine.name = start.ToString();

This give me the name for example: (-2.1, 3.4, 4.9)
Nut I want it be the name like this format:

v3FrontTopLeft (-2.1, 3.4, 4.9)
v3FrontTopRight (-1.1, 3.4, 4.9)

The problem is if there is a easy way to get the names v3FrontTopLeft and v3FrontTopRight and the rest from the method DrawBox instead typing each one.

I want to know that (-2.1, 3.4, 4.9) are the coordinates for v3FrontTopLeft

sentences:
Why does this Unity code work as expected only with the while loop? In unity, in C#, I have the following code in Awake():

Awake()
{
    Transform obj = InstantiateTarget();
    //the bizarrely required and "working" loop
    while (transform.childCount > 0)
    {
        //assign all current children to the replacement object
        foreach (Transform t in transform)
        {
            t.parent = obj;
        }
    }

    Destroy(gameObject);
}

Without the while loop, some random set of the transforms children are destroyed by that end Destroy. With the while, it works exactly as expected (all transform's children become obj's children).

Also, surely with it, there should be an infinite loop (if nothing is changing in another thread, as implied by unity docs). This is in Unity 3.5.

Why does it only work with the while loop? And why doesn't unity get stuck in an infinite loop?

sentences:
Which free HTML5-based game engine meets these requirements? I am experienced with traditional JS and HTML but new to HTML5. I want to develop games in HTML5 so that it can work on all devices and browsers, including IE. Additionally, I require the following features:

Physics Engine
Animation
Some AI
Vector drawing and manipulation
Better user/player controls, et cetera

I know there are many options, but just want some one that can give most flexibility... so I want some thing that can also be compiled to achieve maximum functionality.

One that is in my mind is GameKit; but please tell what you guys would suggest that meets my requirements.

sentences:
Generating vertices for group of hexagons I'm working on the map editor of a game, where you can create a grid of hexagons to paint. An example of a grid of radius 6:

What I want

Once map creation is done, I would like to generate a mesh for each of these islands of color, with the least possible number of vertices.

What I have so far

My approach gives me a list of outer vertices for an island and a list of inner edges, which represent holes in the mesh. Outer and inner edges never overlap.

The gray area on the right of the image above has 3 holes, so what my code gives me is a list of vertices around the gray area and 3 lists of vertices for each hole inside it.

Problems I'm having

While I can already triangulate islands without holes, I can't find a way to turn the ones with holes into meshs. How should I approach solving this problem?

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:
Artificial Intelligence - when to update pathfind? Right now I have a pathfind algorithm A* so I'm already using it to move the player around.
My problem comes to the NPC'S. They find the path to the player but if the player change the position they have to find a new path all the time? or there's something I can do to avoid so many calculations?

Example
I have an enemy 5 units of distance from the player.
He moves to 4 units of distance based in the path he already found and then search the path again? or does he make half of the path until he search for a new path?

I imagine making that for 5 or more enemies may make the game slow? (I never tested it before)
Any toughs?

sentences:
Square collision: Detect which side of the wall it collided I'm using a standard square collision in my 2D game. The player shoots little balls, and when they hit any wall it should bounce.

The problem is that I know when it hits a wall but I don't know if the collision happened on the side or top/bottom of the wall.

Here's my collision algorithm (pseudo code):

If
A.x < (B.x + B.width) AND
B.x < (A.x + A.width) AND
A.y < (B.y + B.height) AND
B.y < (A.y + A.height)
Then a collision happened

Is it easy to detect if the collision happened on a side or top/bottom? If yes how should I do it?

sentences:
HTML5 Canvas 2D lighting and normal maps How using the HTML5 Canvas can I create a 2D game with light sources and also add an extra depth using normal maps.  I have never really done lighting in 2D before and I'm not sure where to start.
Something like this:

or

(source: wholehog-games.com)

sentences:
Generate a 2D field-of-view cone I have a bunch of randomly generated boids flying around on my screen, but I want a function that can give them a field-of-view where they can "see" other boids or obstacles.
The code I wrote gets all the pixels around the boid in a circle of some size. Then I try to filter through them to find only the ones in front of the boid within a 30 degree cone-shaped field of view.
I am making this project in Unity using compute shaders written in HLSL.
For each boid, I gave a float2 position and a float angle. In my kernel, I run a function that tries to set the color of all the pixels inside my cone to red. Here's the code:
for(int x = -viewDistance; x <= viewDistance; x++){
    for(int y = -viewDistance; y <= viewDistance; y++){
        float2 sample = float2(x, y);
        float d = length(sample);

        if(d <= viewDistance && d > 0){
            // sensorAngle is an angle in radians defining the "view margins" of my cone.
            float minAngle = boid.angle - sensorAngle;
            float maxAngle = boid.angle + sensorAngle;

            float theta = acos(sample.x / d);
            if(theta >= minAngle && theta <= maxAngle){
                float2 p = sample + boid.position;
                Result[int2(p.x, p.y)] = float4(1, 0, 0, 1);
            }
        }
    }
}

As you can see I get all the pixels within a certain boundary and filter out ones that are too far away. This works perfectly in retrieving all pixels within a circle around my boid. My problem is with checking if the pixel is within my boid's view-cone.
I tried following this explanation for that code. This works perfectly, but it seems to "mirror" my cone over the x-axis like this:
Also, my boids get generated with a random number between 0 and 360 as their angle. I multiply this angle with PI / 180 to convert degrees to radians (This all happens on my C# side and then I send a ComputeBuffer through to my Compute Shader). However, I noticed that when the angle is generated larger than 180 degrees, the cone doesn't even render at all.
What might be a better method to go about calculating this FOV cone for each of my boids?

sentences:
How to include moai in lua code for running it using luajit? I'm running moai from ubuntu for some simulation purposes.

I have a lua script that is executed using luaJIT.

Now I want to run a simulation written based on moai from within this script.

As of now, i can run the simulation like this : moai sim.lua

I want to see if i can do it lie this : luajit sim.lua ?

Is there a way to include moai just like other modules (require 'moai') and start using it ?

Thanks.

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: Wall Jump for 2D Platformer I've been looking for a way to implement wall-jump in my xna game, but I can't find any information about it, can someone could someone please help me out ?

sentences:
Non-square Isometric tiled maps I'm beginning to make a tile-based 4x game, but I ran into a conceptual issue: My inspiration for this game are the Civilization games, particularly Civ 2, and I noticed something I was interested in mimicking, but I was wondering how it was done.

This is that while the map is isometric, it is not square. I was wondering how it does this. My first thought would be to use an array, but then you have the corners being basically unused space.

To give an example of what I'm talking about:

One idea I have is that there are really two arrays, and whenever a diagonal is made (which would be up, down, left, and right to the player), it moves on one array, and any non-diagonal movement (which to the player is diagonal) moves to the other array.

This is illustrated by this picture (the mountains are one array and the hills are another array):

sentences:
What broad-phase collision algorithms are suited to a static tiled world with dynamic objects of different sizes? Sorry for this routine question, but I can't think of what broad-phase collision algorithms really work in the following, reasonably standard, setup:

2D tile based world, consisting of objects that do not move but might be altered/changed in some ways (not too often).
Significant amount of dynamic objects, interacting with eachother and with the static tiles. These objects can be of variable size, possibly much larger than the tile size.

I started thinking about using just a grid to store the static tiles, but that has its issues. One example would be a level which is a long corridor following the edges of a square; I'm anxious about creating a whole nxn grid when there is a huge amount of irrelevant space in the middle. Also I'm not sure a grid is going to be helpful when figuring out what needs to be considered for collision, or needs to be drawn on screen; a quadtree seems more appropriate.

So far, I'm thinking of:

using a quadtree to store the static tiles (to account for the possibility of large empty spaces in the middle of the grid for instance); hopefully that won't be prohibitively expensive when I need to modify some tiles (this shouldn't happen excessively often);
using some other data structure (I'm undecided which is most suited) to store the dynamic objects, which might have very different sizes;
once that's done, from the tile map I determine which tile edges are empty, solid or need further investigation for collisions; then I would use axis aligned bounding boxes for the dynamic objects to see if there is a possible collision with the static world, and some other algorithm (depending on the data structure for the dynamic objects) to model collisions between dynamic objects.

Maybe something slightly different would be more suited for the tiles, I'm thinking some sort of grid but with "off limits" regions that can be dismissed.
I'm also somewhat anxious about fast-moving dynamic objects; so maybe those could belong to yet another data structure. I wouldn't expect them to be of large size (so they should fit inside tiles nicely), but I'd like to keep my options open in case I make some design changes.

(One thing I am completely neglecting is what generally happens with off-screen dynamic objects; I'm ignoring that problem for now and assuming everything is to be simulated together, but that might be a blunder.)

sentences:
Rotate an object given only by its points? I was recently writing a simple 3D maze FPP game. Once I was done fiddling with planes in OpenGL, I wanted to add support for importing Blender objects. The approach I used was triangulization of the object, then using Three.js to export the points to plaintext and then parsing the result JSON in my app.

The example file can be seen here:
https://github.com/d33tah/tinyfpp/blob/master/Data/Models/cross.txt
The numbers represent x,y,z,u,v of a single vertex, which combined in three make a triangle.

Then I rendered such an object triangle-by-triangle and played with it. I could move it back and forth and sideways, but I still have no idea how to rotate it by some axis. Let's say I'd like to rotate all the points by five degrees to the left, how would a code doing it look like?

sentences: Side of collision with rotation I have 2 rectangles and I want to know if its a length collision or a breadth collision. I will also need to know the rectangle that's acting as pivot. I have made a small illustration. Here, V2 is the pivoting rectangle.

sentences:
How to iterate through the frames of an AnimationClip in editor mode I'm working on a 2D game, using spritesheets as the basis for four AnimationClips. (Every frame from the spritesheet is a keyframe in the animation.) I'm trying to step through the frames of these AnimationClips and programmatically create Collider2Ds which fit the dimensions of each frame.

The problem is, I'm having an impossible time actually iterating through the frames. My character has an Animator component, with 4 different states. I've tried various inputs to my editor script, but the closest I've gotten has an AnimationClip as input:

private AnimationClip clip; // set in inspector
private GameObject targetForColliders; // set in inspector

void createColliders() {
    Animation animation = new Animation();
    AnimationUtility.SetAnimationClips(animation, new AnimationClip[] { clip });

    foreach (AnimationState state in animation) {
        // do useful things here
    }
}

Unfortunately, somehow the animation local variable is null, crazy as that sounds. I've confirmed that by both logging it and attempting to use it, which causes a NullReferenceException every time.

I can't access the Sprite containing the spritesheet directly, because I've made manual adjustments within Unity to the keyframes (removing some, duplicating others) and I don't want to have to manually sync my colliders with the modified assets.

Has anyone attempted to do something similar to this before? tl;dr: What's the easiest way to iterate through the frames of a 2D animation in an editor script?

sentences:
How do 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:
Is there a practical reason for saving game data in %UserProfile%\Documents instead of %AppData%? My documents folder is flooded with subfolders of various games, including those of some very recent AAA titles.
As a professional application developer with no experience in the gaming industry this is just plain wrong, these files belong into %APPDATA% or %LOCALAPDATA%.

My question is, is there a conscious decision to put these files in %UserProfile%\Documents to gain some specific benefits, or is this just legacy behavior that carried over from the days of Windows XP? Or is there an even better reason like, e.g. Steam requiring or recommending this, or a popular engine doing this by default?

Related: In which directory to write game save files/data? (to avoid pointless discussions)

sentences:
2D and 3D Perlin Noise Terrain Generation I'm using 2d perlin noise to generate a heightmap and then adding 3d perlin noise to the heightmap to create overhangs and ridges. But it's not turning out like I would like it to. There are too many hills that don't look good and lots of different places where it's flat. This is the perlin noise function I'm using for both the 2d and 3d (in LUA):

function noise(x, y, z)
  local X = math.floor(x % 255)
  local Y = math.floor(y % 255)
  local Z = math.floor(z % 255)
  x = x - math.floor(x)
  y = y - math.floor(y)
  z = z - math.floor(z)
  local u = fade(x)
  local v = fade(y)
  local w = fade(z)

  A   = p[X  ]+Y
  AA  = p[A]+Z
  AB  = p[A+1]+Z
  B   = p[X+1]+Y
  BA  = p[B]+Z
  BB  = p[B+1]+Z

  return lerp(w, lerp(v, lerp(u, grad(p[AA  ], x  , y  , z   ),
                                 grad(p[BA  ], x-1, y  , z   )),
                         lerp(u, grad(p[AB  ], x  , y-1, z   ),
                                 grad(p[BB  ], x-1, y-1, z   ))),
                 lerp(v, lerp(u, grad(p[AA+1], x  , y  , z-1 ),
                                 grad(p[BA+1], x-1, y  , z-1 )),
                         lerp(u, grad(p[AB+1], x  , y-1, z-1 ),
                                 grad(p[BB+1], x-1, y-1, z-1 )))
  )
end

function fade(t)
  return t * t * t * (t * (t * 6 - 15) + 10)
end

function lerp(t,a,b)
  return a + t * (b - a)
end

function 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

p = {}
local permutation = {151,160,137,91,90,15,
  131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
  190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
  88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
  77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
  102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
  135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
  5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
  223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
  129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
  251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
  49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
  138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
}

for i=0,255 do
  p[i] = permutation[i+1]
  p[256+i] = permutation[i+1]
end

You can also find the implementation, written by Perlin himself, here: http://mrl.nyu.edu/~perlin/noise/

And this is how my loop looks like:

local smoothness = math.random(20, 30)
    for x = 1, mapScale do
        wait()
        for z = 1, mapScale do
            local height = noise(x/smoothness, z/smoothness, 0) --Find out the height
            for y = 1, (height*mapHeight)+10 do
                local density = noise(x/smoothness, y/smoothness, z/smoothness) --Find out the density
                if y > waterLvl then
                    if density*10 > 0 then
                        t:setCell(x, y, z, 1, 0, 0) --Sets cell at position x, y, z
                    end
                else
                    t:setCell(x, y, z, 1, 0, 0)
            end
        end
    end
end

This is how it turns out to be:

How would I change the frequency, number of octaves, and persistence with this function since it doesn't take any parameters for them?

sentences:
GPU instancing vs combining meshes for performance I have a relatively low poly procedurally generated scene in which I reuse a bunch of the same objects (walls, floors, etc). I've been writing some code to combine a room's floor tiles into one mesh, its wall tiles into another mesh, etc. However I came across this tutorial (http://www.habrador.com/tutorials/unity-mesh-combining-tutorial/) in which the author says that GPU instancing is essentially the same as mesh combining, but in fewer lines of code. Is this accurate? I tried GPU instancing and got a massive reduction on the GPU, but the CPU still spends a lot of time drawing. Will mesh combining provide more balanced performance for the CPU? I haven't finished my implementation yet and don't want to bother if it's effectively the same.

Thanks for the help!

sentences: Unity3D: Rigidbody2D not colliding with BoxCollider2D In Unity3D (Version 5.3.1f1 Personal) I have a scene with a sprite with a Rigidbody2D and some sprites with a BoxCollider2D. The BoxColliders don't have the Is Trigger enabled and the RigidBody is not Kinematic, but they are not colliding. What am I doing wrong?

sentences:
How to generate texture coordinates for a rectangle? I've got a function which generates geometry data for a rectangle. So far I've got the vertex, indices and the normals nailed, but I have no idea how to generate the texture coordinates - so far I've only used textures with imported 3d models, but now I want to generate my own rectangle on the fly and so need to generate the texcoords aswell.

So how do I make the texcoords? I am not sure how the mapping works.

bool CreateRectangleData(const float sizeX, const float sizeY, const float sizeZ, std::vector<float>& vertexData, std::vector<float>& normalData, std::vector<float>& texcoordData, std::vector<uint32_t>& indiceData)
{
    if (sizeX <= 0 || sizeY <= 0 || sizeZ <= 0)
        return false;

    const float X = sizeX / 2.0f;
    const float Y = sizeY / 2.0f;
    const float Z = sizeZ / 2.0f;

    float cubeVertices[] = {-X, -Y, -Z, -X, -Y, Z, X, -Y, Z,
                            X, -Y, -Z, -X, Y, -Z, -X, Y, Z,
                            X, Y, Z, X, Y, -Z, -X, -Y, -Z,
                            -X, Y, -Z, X, Y, -Z, X, -Y, -Z,
                            -X, -Y, Z, -X, Y, Z, X, Y, Z,
                            X, -Y, Z, -X, -Y, -Z, -X, -Y, Z,
                            -X, Y, Z, -X, Y, -Z, X, -Y, -Z,
                            X, -Y, Z, X, Y, Z, X, Y, -Z};

    float cubeNormals[] = {0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
                           0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
                           0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f,
                           0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f,
                           0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
                           0.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
                           -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
                           1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};

    float cubeTexCoords[] = {};  // ???

    uint32_t cubeIndices[] = {0, 2, 1, 0, 3, 2, 4, 5, 6,
                              4, 6, 7, 8, 9, 10, 8, 10, 11,
                              12, 15, 14, 12, 14, 13, 16, 17, 18,
                              16, 18, 19, 20, 23, 22, 20, 22, 21};

    vertexData.insert(vertexData.begin(), cubeVertices, cubeVertices + (sizeof(cubeVertices) / sizeof(float)));
    normalData.insert(normalData.begin(), cubeNormals, cubeNormals + (sizeof(cubeNormals) / sizeof(float)));
    texcoordData.insert(texcoordData.begin(), cubeTexCoords, cubeTexCoords + (sizeof(cubeTexCoords) / sizeof(float)));
    indiceData.insert(indiceData.begin(), cubeIndices, cubeIndices + (sizeof(cubeIndices) / sizeof(uint32_t)));

    return true;
}

Thanks

sentences:
Grid/cell based light system I am working on a top-down, 2d cell-based RPG game. I would like to implement a cell based lighting system, something like this and this.

I basically have several light sources and light deteriorates on every cell in every direction. Something like the below (numbers represent the level of light in each cell):

1 1 1 1 1 0 0 0 0 0 0
1 2 2 2 1 0 0 1 1 1 0
1 2 3 2 1 0 0 1 2 1 0
1 2 2 2 1 0 0 1 1 1 0
1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 1 2 1 0 0 0 0
0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0

So basically I insert a source of light of "strength" x at a given spot. I then set the surrounding cells' light strength to x-1 and so on until I reach zero (or a set global minimum value). I am looking for an efficient algorithm to implement and generate such a lightning grid based on my light sources and any tips regarding such implementation.

I am currently not looking into field of view algorithms, just an efficient way of generating the above. Any help will be much appreciated.

EDIT: Just to clarify, this should handle movement of light sources (e.g. player walking with a torch).

EDIT2: Ok, I've solved my problem myself based on the simple distance suggestion by Jari (thus I'll accept his answer although I'm still looking for a more efficient way of generating such array). If anyone's interested here is a demo of what I came up with (multiple light sources with alpha compositing)

sentences: Parallax effect for layers in Unity2D I have a simple game scene where i have put a number of images. I combined these images into layers (SortinLayer, to be specific). So now I have 3 layers. I have read a few tutorials, but in them was described how to make parallax effect for the certain bitmap, not for a group of images that were grouped under one layer.  But I need to make a parallax effect for the whole layer. Is it possible to do this in Unity2D?

sentences:
Why do objects interpenetrate in this simple collision solver? The code below is from a Microsoft XNA sample here.
This is quite a simple rigid body simulation that ignores many physical effects (such as angular momentum), but it does try to push objects (spheres) apart so that they are not penetrating one-another.

However, the simulation allows spheres not only to penetrate, but when many spheres are stacked on top of each other, small spheres can be almost completely inside of larger spheres. If I make all spheres have the same radius and mass, then the simulation performs reasonably well (with minimal interpenetration).

Can someone explain why there is any interpenetration at all? Since it moves the positions of the spheres, it seems like interpenetration should be impossible.

For each sphere in the simulation, this method is called on every other sphere.

/// <summary>
// Given 2 spheres with velocity, mass and size, evaluate whether
// a collision occured, and if so, excatly where, and move sphere 2
// at the contact point with sphere 1, and generate new velocities.
/// </summary>
private void SphereCollisionImplicit(Sphere sphere1, Sphere sphere2)
{
    const float K_ELASTIC = 0.75f;

    Vector3 relativepos = sphere2.Position - sphere1.Position;
    float distance = relativepos.Length();
    float radii = sphere1.Radius + sphere2.Radius;
    if (distance >= radii)
    {
        return; // No collision
    }

    // Add epsilon to avoid NaN.
    distance += 0.000001f;

    Vector3 relativeUnit = relativepos * (1.0f / distance);
    Vector3 penetration = relativeUnit * (radii - distance);

    // Adjust the spheres' relative positions
    float mass1 = sphere1.Mass;
    float mass2 = sphere2.Mass;

    float m_inv = 1.0f / (mass1 + mass2);
    float weight1 = mass1 * m_inv; // relative weight of sphere 1
    float weight2 = mass2 * m_inv; // relative weight of sphere 2. w1+w2==1.0

    sphere1.Position -= weight2 * penetration;
    sphere2.Position += weight1 * penetration;

    // Adjust the objects’ relative velocities, if they are
    // moving toward each other.
    //
    // Note that we're assuming no friction, or equivalently, no angular momentum.
    //
    // velocityTotal = velocity of v2 in v1 stationary ref. frame
    // get reference frame of common center of mass
    Vector3 velocity1 = sphere1.Velocity;
    Vector3 velocity2 = sphere2.Velocity;

    Vector3 velocityTotal = velocity1 * weight1 + velocity2 * weight2;
    Vector3 i2 = (velocity2 - velocityTotal) * mass2;
    if (Vector3.Dot(i2, relativeUnit) < 0)
    {
        // i1+i2 == 0, approx
        Vector3 di = Vector3.Dot(i2, relativeUnit) * relativeUnit;
        i2 -= di * (K_ELASTIC + 1);
        sphere1.Velocity = (-i2) / mass1 + velocityTotal;
        sphere2.Velocity = i2 / mass2 + velocityTotal;
    }
}

In particular, I though that this:

sphere1.Position -= weight2 * penetration;
sphere2.Position += weight1 * penetration;

Should completely disallow any interpenetration, why doesn't it?

sentences:
Detecting walls or floors in pygame I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet hits the bottom, top or sides, its vector is adjusted accordingly. However, sometimes when I shoot, the bullet doesn't bounce, I think it's when I shoot at a border between two blocks.

Here is the update method for my Bullet class:

def update(self, dt):
    if self.can_bounce:
        #if the bullet hasnt bounced find its vector using the mousclick pos and player pos
        speed = -10.
        range = 200
        distance = [self.mouse_x - self.player[0], self.mouse_y - self.player[1]]
        norm = math.sqrt(distance[0] ** 2 + distance[1] ** 2)
        direction = [distance[0] / norm, distance[1 ] / norm]
        bullet_vector = [direction[0] * speed, direction[1] * speed]

        self.dx = bullet_vector[0]
        self.dy = bullet_vector[1]

    #check each block for collision
    for block in self.game.solid_blocks:
        last = self.rect.copy()
        if self.rect.colliderect(block):
            topcheck = self.rect.top < block.rect.bottom and self.rect.top > block.rect.top
            bottomcheck = self.rect.bottom > block.rect.top and self.rect.bottom < block.rect.bottom
            rightcheck = self.rect.right > block.rect.left and self.rect.right < block.rect.right
            leftcheck = self.rect.left < block.rect.right and self.rect.left > block.rect.left
            each test tests if it hit the top bottom left or right side of the block its colliding with
            if self.can_bounce:
                if topcheck:
                    self.rect = last
                    self.dy  *= -1
                    self.can_bounce = False
                    print "top"

                if bottomcheck:
                    self.rect = last
                    self.dy  *= -1 #Bottom check
                    self.can_bounce = False
                    print "bottom"

                if rightcheck:
                    self.rect = last
                    self.dx  *= -1 #right check
                    self.can_bounce = False
                    print "right"

                if leftcheck:
                    self.rect = last
                    self.dx  *= -1 #left check
                    self.can_bounce = False
                    print "left"

            else:
                # if it has already bounced and colliding again kill it
                self.kill()

    for enemy in self.game.enemies_list:
        if self.rect.colliderect(enemy):
            self.kill()
    #update position
    self.rect.x -= self.dx
    self.rect.y -= self.dy

This definitely isn't the best way to do it but I can't think of another way. If anyone has done this or can help that would be awesome!

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:
Shader to render objects with distance independent size I am trying to find a way to render certain objects in my 3d scene without the effects of the perspective projection. E.g. I want them to have the same pixel dimension independent of distance to the camera or the dimensions of the viewport.

Here is what I tried in the vertex shader so far

uniform vec2 screen_size;

varying float camera_distance;

void main() {
    mat4 mvp = projectionMatrix * modelViewMatrix;

    float scaleFactor = 2.0 * 50.0 / screen_size.x;
    float w = (mvp * vec4(0.0, 0.0, 0.0, 1.0)).w;
    w = w * scaleFactor;

    gl_Position = mvp * vec4(position.xyz * w, 1.0);
}

So far no luck.

sentences:
optimizing collision detection with stationary objects (walls, floors, obstacles, etc.) For detecting collisions between sprites, I know a 2D spatial hash is a way to optimize the number of collision checks that need to happen. But is there a way to optimize even further for objects that we know won't be moving in the scene? My sensibilities tell me that there should be because:

We know exactly where the object is at all times.
(At least in my game) there are bound to be a lot of floor/wall/ceiling tiles, far more than would be efficient to include in the spatial hash.

So, is there a way to optimize collision detection for this use case?

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:
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:
Ways to track time and character ages across many years of game time? I'm working on a system to track large numbers of characters across long periods of time. Characters grow old and die, give birth to new characters, etc. It's a grand-strategy game, with warring nations and long scenarios.

Of course, this means I need to track the passage of years. My first idea was to create a class Calendar, with methods like increment_year() that would go through the list of every person, faction, etc in the game and call their methods (update_age() and so forth).

However, this would mean Calendar would be a singleton, which is sometimes considered an antipattern.

Alternatively, I could make a global variable for the current time, and update that as part of the main() game loop--using globals sounds like a dirty thing to do, though.

Is there a good reason to use a Calendar singleton (or even a reason to have multiple separate Calendars?)

sentences:
Is there a limit on game updates in the iOS app store? Does Apple implement any limit on the frequency / number of updates posted for a given app on the app store?

I have seen that apps that are updated get featured in the "new app" lists. So developers may choose to update their app every week to get featured in these lists on a regular basis?

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:
Why is Metal is rendering textures SLIGHTLY darker than they should be? I already checked this question. Using [MTKTextureLoader.Option.SRGB : false] in texture loader options doesn't work. All that happens is when I do [MTKTextureLoader.Option.SRGB : true], it's a lot darker instead of slightly darker. There must be something else. Here is an example of this unwanted behavior.

As you can see I am using the mouse to hold the original packed ice texture over the rendered one. It's considerably lighter, even with [MTKTextureLoader.Option.SRGB : false].

Here is my fragment function:

fragment half4 TextureFragment(VertexOut VertexIn [[stage_in]], texture2d<float> Texture [[texture(0)]]) {
    constexpr sampler ColorSampler(mip_filter::nearest, mag_filter::nearest, min_filter::nearest);
    float4 Color = Texture.sample(ColorSampler, VertexIn.TexCoord.xy / VertexIn.TexCoord.z);
    return half4(Color.r, Color.g, Color.b, 1);
}

How can I fix the problem? How can I render the actual texture instead of a darker version?

Note: I must fix the problem, not work around it. A workaround would be like return half4(Color.r, Color.g, Color.b, 1); from the fragment shader. I must fix the problem from the root.

sentences:
When should you use a baseclass and a class as a datatype? Im following a C# rpg game development tutorial atm and what confuses me is that I cant figure out when to use what.

The author writes different classes where 1 class derives from another so the derived class has all the properties of the bass class. With other classes when all the properties are needed from another class he just makes them a datatype

Example: both the monster and player class have currentHealth and and maximumHealth as properties from the LivingCreature baseclass. But then the author writes Item class as a public data type property in the InventoryItem class. Can someone explain to me when I should make a datatype and when I should I derive a class?

public class Monster : LivingCreature {
 public int ID { get; set; }
    public string Name { get; set; }
    public int MaximumDamage { get; set; }
    public int RewardExperiencePoints { get; set; }
    public int RewardGold { get; set; }
    public List<LootItem> LootTable { get; set; }

    public Monster(int id, string name, int maximumDamage, int rewardExperiencePoints, int rewardGold, int currentHitPoints, int maximumHitPoints)
        :base  (currentHitPoints, maximumHitPoints) {

        ID = id;
        Name = name;
        MaximumDamage = maximumDamage;
        RewardExperiencePoints = rewardExperiencePoints;
        RewardGold = rewardGold;
        LootTable = new List<LootItem>();
}

}
public class InventoryItem
{
 public Item Details { get; set; }
 public int Quantity { get; set; }

    public InventoryItem(Item details,int quantity)
    {
        Details = details;
        Quantity = quantity;
    }
}

sentences:
How to be sure that a target goal in a match 3 game level will not be impossible? This is clearly not a coding problem but the logical one. I am starting to learn how to make a match 3 game.
but there is a question rising in my mind.

when i will set goal to complete the level, how will i know the goal is achievable ?

suppose in a level where i have to collect 5 Red, 12 blue, 9 green objects by matching the same(like farm heros).
how would i decide how much moves i need to set to make this goal achievable. i mean it should be challenging but  not be impossible.

since the objects spawn in a random whats the surety that there will be enough number of gem in the game to not make impossible.

is there some logical explanation for this, or i just have to test and look out how many moves it takes to achieve the goal.

Is there an algorithm which generates the gems according to target set, or they are generated in random manner?

To be more clear towards my question i am going to take an example of King.com's farm-heros-saga .

In level 9 the target is to collect number of four types of objects 26,26,14,5 respectively. and the maximum number of moves are 22.

now this goal may be achievable and challenging(i mean you can achieve it in two or three trials ) but not impossible.

Now my question is what made those guys so sure that it will not be impossible, how they decided that 22 move will be enough and challenging.

well.. they could have put the maximum number of moves to 5 or 6. but that would surely make it impossible to clear the level. so how they decided to keep move 22 or this.

Are they using static pattern to generate and spawn objects, or ratio of collectible gems is fixed(i.e in total gameplay there will be X%,Y%,Z%,M% of gems respectively ), or there is some other way.
I just need some hint what should i look for..

sentences:
How do I create a web player for a game engine written in C++? This web player is for the Unreal Development Kit, and works very well without a browser plugin. I'm wondering how it is built.
How do I create a web player for a game engine written in C++?

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:
Can I generate collision boxes from a model file with BepuPhysics and XNA? I am currently developing a game using BepuPhysics in XNA 4.0, and I am trying to reasonably match the in game collision Entities with the Model they are associated with.

My current workflow involves guessing what size the various segments of the model are, guessing a size and position of a box to match each segment, and throwing stuff at it to see if I'm right.

This is not an efficient process.

Is there a way to automatically generate the Entity from the Model?
If not, is there some other way to speed up my workflow?

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: Move an enemy towards the player in pygame I set variables for the distance between the enemy and the player along the x-axis and y-axis. My plan is to move the enemy along the hypotenuse formed by y and x-axis line at a constant speed. The thing is I'm not sure how to set x and y speed of the enemy so that it will adjust dynamically to the changing position of the player and still maintain a constant speed. I thought that maybe I could find the angle at which enemy approaches the player and do something with that, but I couldn't think of anything.

sentences:
Physics system imploding under force I have a basic physics body system (incomplete/very basic; as collision resolution and detection are not implemented, just mass, position, velocity, acceleration, force and impulse).

I implemented position, velocity, acceleration, force and impulse as described in Game Coding Complete 3rd. Ed. by Mike "Mr. Mike" McShaffrty et al. specifically Chapter 15: Collision and Simple Physics by Jeff Lake which is: (paraphrasing from text and code, US copyright law and all that.)

  Gravity is a Force.

  Application of a Force vector adds it to a std::list of forces.

  Application of an Impulse vector adds it to a std::list of impulses.

  Upon calling Update on the physics body:

  Add all forces and all impulses together (F).
  Clear the impulses list.
  Set acceleration to (F / mass)
  Set velocity to (velocity + (acceleration * deltaTime))
  Set position to (position + (velocity * deltaTime))

(See code below)

The problem I'm having is when gravity is applied as a force the list grows linearly...forever. Eventually it overcomes any attempt to directly set the position of an object to the point that A) The object is always affected by gravity no matter if or how fast the position is changed (clamping to the screen is a good example) B) The list grows so large that the system implodes and chugs. C) If, before the system implodes, the object is stopped at a specific position, the acceleration due to gravity continually increases making it ever harder to change the acceleration/velocity/position of the object (specifically applying an impulse or force upwards).

If I change the noted line in GravityHandler to elem->ApplyImpulse(deltaG); it works satisfactorily but is this correct or am I missing something?

My implementation according to his example:

RigidBody and its state:

void State::ApplyImpulse(const Vector2D& impulse) {
    _impulse.push_back(impulse);
}

void State::ApplyForce(const Vector2D& force) {
    _forces.push_back(force);
}

//RigidBody is a `friend` of State.
void RigidBody::ApplyForce(const Vector2D& force) {
    _curState.ApplyForce(force);
}
void RigidBody::ApplyImpulse(const Vector2D& impulse) {
    _curState.ApplyImpulse(impulse);
}

GravityHandler:

void GravityHandler::Update(double deltaTime) {

    class UpdateObject {
    public:
        UpdateObject(double deltaTime) : _deltaTime(deltaTime) { };
        void operator() (RigidBody* elem) {
            double mass = elem->GetMass();
            if(Math::IsEqual(mass, 0.0)) return;

            double gxm = elem->GetXGravityModifier();
            double gym = elem->GetYGravityModifier();

            Vector2D deltaG(_GRAVITY_VALUE.GetX() * gxm * mass * _deltaTime, _GRAVITY_VALUE.GetY() * gym * mass * _deltaTime);
            elem->ApplyForce(deltaG); //The problem seems to be here.
        };
    private:
        double _deltaTime;
    };

    _accumulator += deltaTime;
    if(_accumulator < (1.0 / 60.0)) return;
    _accumulator -= deltaTime;
    if(!_isActive) return;
    std::for_each(_subscribers->begin(), _subscribers->end(), UpdateObject(deltaTime));
}

RigidBody:

void RigidBody::Update(double deltaTime) {

    double mass = GetMass();
    //If static body, do nothing.
    if(Math::IsEqual(mass, 0.0)) return;

    Vector2D F;
    F += std::accumulate(_curState._forces.begin(), _curState._forces.end(), Vector2D());
    F += std::accumulate(_curState._impulses.begin(), _curState._impulses.end(), Vector2D());
    _curState._impulses.clear();
    SetAcceleration(F / mass);
    SetVelocity(GetVelocity() + GetAcceleration() * deltaTime);
    SetPosition(GetPosition() + GetVelocity() * deltaTime);

}

sentences:
D3DXMatrixDecompose gives different quaternion than D3DXQuaternionRotationMatrix In trying to solve this problem, I tracked down the problem to the conversion of the rotation matrix to quaternion. In particular, consider the following matrix:

-0.02099178 0.9997436  -0.008475631 0
 0.995325   0.02009799 -0.09446743  0
 0.09427284 0.01041905  0.9954919   0
 0          0           0           1

SlimDX.Quaternion.RotationMatrix (which calls D3DXQuaternionRotationMatrix gives a different answer than SlimDX.Matrix.Decompose (which uses D3DXMatrixDecompose). The answers they give (after being normalized) are:

                            X            Y             Z            W
Quaternion.RotationMatrix   -0.05244324  0.05137424    0.002209336   0.9972991
Matrix.Decompose             0.6989997   0.7135442    -0.03674842   -0.03006023

Which are totally different (note the signs of X, Z, and W are different). Note that these aren't q/-q (two quaternions that represent the same rotation); they face completely different directions.

I've noticed that with matrices for rotations very close to that one (successive frames in the animation) that the Matrix.Decompose version gives a solution that flips around wildly and occasionally goes into the desired position, while the Quaternion.RotationMatrix version gives solutions that are stable but go in the wrong direction. This is only for the right arm in my animation -- for the left arm, both functions give the correct solution, which is the same quaternion within error tolerances.

This makes me think that there's some sort of numeric instability or weird stuff with signs going on. I tried implementing this and then this, but both gave me a completely incorrect solution (even for the matricies where the SlimDX ones were working correctly) -- maybe the rows and columns are flipped?

sentences:
Blender animation's curled fingers are splayed-out when played in Unity I have exported my character into Unity and all the animations came with it. At first, I thought I was good to go but then I made a jogging animation. In blender the hands are gripped like this:

When this animation is exported to Unity the hands are no longer gripped and look like this:

Here are some more pictures showing the settings I have on my animation first in Blender:

Next in Unity:

So far I have tried:
Checking if the animations were updated in Unity (They were),
Reimporting the Unity model,
Looking through the animation properties in Blender,
Looking through the animation properties in Unity
I've been stuck on this for a few days now and I would appreciate some help as this is getting quite frustrating.

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:
Cube that turns every for example 5 seconds 90 degrees I want a cube to rotate 90 degrees every [Second/Counter should be setable]

Like in this video at 3.47 the spiky cube that turns 90 degrees
https://www.youtube.com/watch?v=bxWpsT4lKXU

I have tried to do it but it will not turn 90 degrees smoothly or even 90 degrees, it just turns kind of 90 degrees but I need help I guess.

Here is my script:

public class TurnCubeScript : MonoBehaviour {

public Transform turnCube;

public float turnSpeed;
//SETTING THE COUNTER FOR OBJECT TO TURN
public float setCounter;
public float counter;
//SETTING THE COUNTER TO SETCOUNTER AFTER COUNTER1 = 0
public float setCounter1;
public float counter1;

void Start ()
{
    setCounter = counter + setCounter;
    setCounter1 = counter1 + setCounter1;
}

void Update ()
{
    TurnTheCube();
}

void TurnTheCube()
{

    counter -= 1 * Time.deltaTime;
    if (counter < 1)
    {
        //SOME TRIES...
        //turnCube.transform.eulerAngles += new Vector3 (0, 0, 90 * Time.deltaTime * turnSpeed);
        //turnCube.Rotate(0, 0, 90 * Time.deltaTime * turnSpeed);
        //turnCube.rotation = Quaternion.Euler(0, 0, rotation);

        counter1 -= 1 * Time.deltaTime;

        //GIVES THE CUBE SOME TIME TO TURN
        if(counter1 < 1)
        {
            counter = setCounter;
            counter1 = setCounter1;
        }
    }
}

}

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:
Can a high FPS negatively affect how a program runs? Yeah I know this is a broad question and will get down rated, I'm just hoping for some answer before it gets closed.

Anyway, I'm using Slick 2D/Java to play around with graphics. I'm having some trouble with trying to move an image. The weird thing is, the code works just fine on my laptop, but the image sporadically moves to (0,0) and stops on my desktop. The only difference between the two is that it says the FPS is about 500 on my laptop and 6600 on my desktop. Can that affect it or does someone have any ideas for what to check on?

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:
What should my map creation workflow be for a turn-based tactics game? I am planning to make a tile turn-based game like Final Fantasy Tactics. Now, I am brainstorming of how can I implements the map arena system (the battle arena where there are block by block tile so that character can walk on) such that it is easy to merge an art consisting of whole arena terrain onto the game.

I planned to create a full-map sprite, modelling it after a real place, then put it into the game. The problem is how do I code the program such that it will know the height and location of each tile out of a large single-sprite map? If I am to do that, then I should create some kind of editor that generate such data.

If I implements a tile by tile map creation, such that I use separate art sprite for each tile, then it would be hard to put the full map onto the game. I will have to build the map from tiny sprite, tile by tile.

I would kindly ask any professional or people who have done these type of game before, which method would you suggest me to do?

Another question that I want to ask is, if any of you know, how does game like final fantasy tactics layout their background map to make it look 3D? Do they simply make a sprite tile created from an angled (user's ) view instead of flat sprite with top-view? Or do they simply use flat top-view sprite and maps it on a 3D plane/terrain ?

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:
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:
How to optimize two-pass operations on an array with Unity Coroutines I am working on simulating vacuum decompression in a 2D top down environment.
I have 2 2-dimensional arrays: one that stores the pressure at a location, and one that stores the vector of fluid flow.

The algorithm looks likes this:

private void Flow()
{
    Diffuse();
    Vectorize();
}

private void Vectorize()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            Vector2 flowVector=calculate_the_resultant_vector_from_the_pressure_differentials //O(1) op
            [...]
            vector[x,y]=flowVector;
        }
    }
}

private void Diffuse()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            float newPressure=calculate_the_new_pressure_from_the_pressure_differentials //O(1) op
            [...]
            pressure[x,y]=newPressure;
        }
    }
}

The problem is that as the area of the simulation space increases, the performance continues to drop off as the iteration steps block the update loop.

I want to convert these to Coroutines in such a way that both yield but more or less maintain a lockstep appearance. Since flow is dependent on pressure differential, and pressure differential is partially dependent on flow, if an order has to be enforced, then Diffuse should take precedence.

My initial attempt followed the following form:

IEnumerable Flow()
{
    StartCoroutine(Diffuse());
    yield return null;
    StartCoroutine(Vectorize());
}

IEnumerable Vectorize()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            Vector2 flowVector=calculate_the_resultant_vector_from_the_pressure_differentials //O(1) op
            [...]
            vector[x,y]=flowVector;
            yield return null;
        }
    }
}

IEnumerable Diffuse()
{
    for(int x=0;x<xRange;x++)
    {
        for(int y=0;y<yRange;y++)
        {
            float myPressure= pressure[x,y];
            [...]
            float newPressure=calculate_the_new_pressure_from_the_pressure_differentials //O(1) op
            [...]
            pressure[x,y]=newPressure;
            yield return null;
        }
    }
}

This tended to cause a jittery simulation. Even on a small 20x20 simulation field, there was noticeable difference between the first and second solutions.

Are there any tricks to coroutines that will allow a more lockstep simulation that scales well? Any suggestions on optimization is welcomed as well.

sentences:
Strange deviations while implementing alpha compositing I've been trying to create my own 2d renderer for my game (for learning purposes) and I'm trying to implement alpha compositing. The formula I'm using is very trivial, which is color = alpha * src + (1 - alpha) * dest.

Everything seemed to be going and looking well until I started comparing it to existing 2d canvas implementations. I've tested my canvas against OpenGL, the JS canvas, and a BufferedImage in Java, and they have all been getting slightly different results to the formula I use.

For example, let's say I have a background with a red value of 1 and shape with a red value of 0.49 and an alpha of 0.026. From plugging in the values to the formula, I got a red value of 251.6187 (multiplying the original result by 255), which can be rounded to 252. However, every canvas implementation I've used returns a red value of 251.

I'm keeping all my color values in a float between 0 and 1. However, I've tried experimenting with rounding it to increments of 255 and it still had no effect. For the js canvas implementation, I simply multiply the 0-1 by 255. (BufferedImage and OpenGl both accept a float from 0-1)

Here is a program to illustrate the issue: https://editor.p5js.org/SarahJ/sketches/VTzi0r5c7

I initially thought I needed to apply round, floor, or ceil function to my result, but while that helped this example, it caused problems for others.

Is this not the alpha compositing formula that most 2D canvas implementations use, or am I doing something wrong? Any advice is appreciated. Thanks!

sentences:
In Unity, why does my Hose particle system only show up in the scene preview? I added particle system package from assets, selected hose particle system and put it in the scene. When I select 'Water Shower', it works in the scene preview, but on play, it just appears and vanishes in a fraction of a second. I set Looping, Play on awake enabled already, no result.

I also get the same result in a separate otherwise empty project.

Is this the problem with the prefab or there is something else I need to set to make it work properly?

I am trying to use hose particle system to create fountain like effect. I have used Steam particle system from same package, and it renders in play mode fine.

I know this is similar to this StackOverflow question.  I have already tried the solutions provided there, and the asker also has not yet marked answer as a solution.

I've also made a video of what is happening.

sentences: b2DistanceJoint with frequency equal to 0 vs b2WeldJoint What is the difference of b2WeldJoint and b2DistanceJoint? They both have frequency and also when you put frequency of Distance Joint to 0 it acts like Weld Joint. It seams that you can create Distance Joint effect using Weld Jonit and vice versa.

sentences:
How can I properly detect my cars collisions using hitboxes? I have created two car objects and their current speed is represented as the len variable.

This is the code:

Under Blue Car Collision Event:

if (place_meeting(x,y,obj_CarRed)) { // Checking Collision
    len = 0 //Current speed
    if (len < obj_carRed.len) { // Blue Car's current speed is greater than Red's
        myHP -= obj_carRed.len/2
    }
}

So I copied the code to the other object and replaced Red with Blue. When the Red car crashes into the Blue car, the Blue car takes damage because the Red car is traveling faster than the Blue car. But when the Blue car crashes into the Red car, the Red car won't take any damage.

Later, I thought about using a Hitbox and have it as a parent for both cars, but I don't know if it would mess up the collisions, and I don't know how to tell the hitbox that it's been created by Blue Car, or by Red Car. I don't know if I should make a new hitbox for each car or one for both.

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:
Sequencing method calls with time delay I'm trying to solve what seems to be (or should be) a very simple problem. I'd like to sequence several steps in a GameManager class with some time delay between them. In my case, I'd like to clear the screen of objects, then ask my UIManager class to display a "Starting Level" message for 3 seconds, then spawn all the objects I need. This sequence should be repeatable unless a event that the GameManager subscribed to is triggered.

I'm trying to do this in the most generic, flexible and elegant way I can find. This is not a technical, "whatever works" question. I can do this with coroutines. I can do this with the GameManager calling an Action delegate to which UIManager is subscribed, then make the UIManager call an event that the GameManager is subscribed to when the displaying is done. But all these solutions seems convoluted to me.

I've started a thread on Unity Answers with some example code about this, which has generated a small discussion. In posting here I am hoping to find some new ideas, maybe generic to C# and not specific to Unity, on how to sequence a chain of methods. How would you achieve this?

To make this clearer, imagine a more complex sequence inside a GameSequence method:

Initialize variables (level, difficulty etc).
When done, play an introductory animation to that level, which can be of varying lengths depending on the level.
Show a "Get ready" message for 3 seconds.
Spawn the level and let it play.
If the level ends successfully, animate some sort of cutscene (which can be of any duration).
If the level doesn't end successfully, trigger a GameOverManager or something to that effect.

I hope I'm being clear in my question. Thank you for your help.

sentences:
Blend multiple regions from same texture atlas I'm representing terrain in my game as a grid with at each node a composition, for example 100% rock, or 50% grass, 50% soil. I'd like to use this composition vector to blend textures together. I'm using a single texture atlas which contains all my terrain textures.

I've tried various ideas but I always seem to stumble on the rasterization part of the pipeline, because the interpolation does not work correctly between coordinates across the texture atlas.

What is the recommended way to accomplish this?

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:
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:
Is studying Alternate Coordinate System required game development? I don't know whether or not this question is fit for Gamedev.Stackexchange, but I would like to know :-

I am new to Linear Algebra. I only want to study those parts of Linear Algebra which would be required for making games. Alternate Coordinate System, is it required for making games, or should I just study Vector Spaces and Matrix Transformations?

sentences:
Is it possible to render to multiple devices / monitors in XNA? As the title.

If so, how?

As well as wiring it up correctly, how should I manage syncing GPU resources and update/draw steps?

sentences:
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:
Memory-leak around SDL_FreeSurface When I call my tile engine function, the amount of memory my program uses begins to spike at about 80 - 90 megabytes per second. The memory use continues to go up until the program crashes. The function is below.

After tinkering with it, I figured out that I could reduce this bricking to about 15 megabytes per second if I called SDL_FreeSurface every time I ran the function. But this confused me, because I thought that you are only supposed to use SDL_FreeSurface when the program exits so that the images don't continue to occupy the memory.

if I don't call SDL_FreeSurface before I blit the tiles, do the previously blitted tiles continue to exist?
If I don't how do I fix the aforementioned bug?

The edit I made to bring the memory bricking down to 15 megabytes per second is commented out.

SDL_Surface* loadedTile = NULL;
SDL_Surface* modelIMAGE = NULL;

void enviroment::blitTiles(SDL_Surface* windowENVIRO, int tileAmount, int tileType[], int tileXenviro, int tileYenviro, bool quitTiles)
{
    HDcounter = -1;

//if(loadedTile != NULL)
//{
//    SDL_FreeSurface(loadedTile);
//}

loadedTile = IBFobjectENVIRO.loadIMG("tileClipSheet.png");

        for(int tiles = 0; tiles < tileAmount; tiles++)
        {

            switch(tileType[tiles])
            {
                //Black square (unpassable)
                case 1: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 0, 0, 75, 75);

                        HDcounter += 1;

                        forbiddenX[HDcounter] = tileXenviro - 75;
                        forbiddenY[HDcounter] = tileYenviro;
                        forbiddenSpriteWidth[HDcounter] = 75;
                        forbiddenSpriteHeight[HDcounter] = 75;
                        forbiddenSpriteDepth[HDcounter] = 75;
                break;

                //Grey square
                case 2: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 75, 0, 75, 75);
                break;

                //Brown square
                case 3: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 150, 0, 75, 75);
                break;

                //Invisible square (unpassable)
                case 4: IBFobjectENVIRO.blitIMG(tileXenviro - 75, tileYenviro, windowENVIRO, loadedTile, 225, 0, 75, 75);

                        HDcounter += 1;

                        forbiddenX[HDcounter] = tileXenviro - 75;
                        forbiddenY[HDcounter] = tileYenviro;
                        forbiddenSpriteWidth[HDcounter] = 75;
                        forbiddenSpriteHeight[HDcounter] = 75;
                        forbiddenSpriteDepth[HDcounter] = 75;
                break;
            }

            tileXenviro += 75;

            if(tileXenviro >= level1ObjectENVIRO.level1Width)
            {
                tileYenviro += 75;
                tileXenviro = tileXenviro - level1ObjectENVIRO.level1Width;
            }
        }

    if(quitTiles == true)
    {
        SDL_FreeSurface(loadedTile);
    }
}

sentences:
Handling Background & other objects in a Flash platformer I asked a similar question in 'SO' not knowing about this place,anyways here goes:

I wanted to know what the best approaches are while creating a platformer based game for handling background & objects.

Tiled method - Using small objects & loading on-the-fly :
I understand this is good for employing a level editor for the game later but wouldn't it become too processor intensive to manage so many tiles(using arrays, i assume). Especially if have many objects which also might be mutually exclusive (eg different sets of bg objects which react differently to user). Please throw some light on what usually the tile sizes often considered. I have a doubt that I used too small tiles which reduced my frame rate drastically.

Create, store & scale:
Creating the whole level & storing them in separate movie clips, scaling them while the level loads. I found this method could solve the frame rate problem, but I then had to handle the issue of not  being able to place objects (like enemy, power ups, etc) during runtime, as I no longer tracked the exact locations of the player (hero) in the game.

sentences:
How can I transform a group of objects in libGDX? I'm new in LibGDX.
I created group with actors in show method and add listener (where i calculate rotation matrix) and want to rotate all actors from group with batch.setTransformMatrix(matrixResult); but nothing happens. How can I force to rotate all actors of group?

 @Override
   public void show() {
      camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      camera.position.set(0f, 0f, - 120);
      camera.lookAt(0,0,0);
      camera.near = 0.1f;
      camera.far = 300f;

      camera.update();
      stage = new Stage();
      shader = new ShaderProgram(vertexShader, fragmentShader);
      myBatch = new SpriteBatch();
      shapeRenderer = new ShapeRenderer();
      sphere = BuildSphere(5, 100);
      group = new Group(){
         @Override
         public void draw(Batch batch, float parentAlpha) {
            batch.setTransformMatrix(matrixResult);
            super.draw(batch, parentAlpha);

         }
      };

      group.setTouchable(Touchable.enabled);
      group.addListener(new InputListener(){

         @Override
         public boolean touchDown(InputEvent event, float x, float y,
               int pointer, int button) {
            Gdx.app.log("MOUSE_X_BEG", Float.toString(x));
            Gdx.app.log("MOUSE_Y_BEG", Float.toString(y));
            begX = x;
            begY = y;
            return true;
         }
         @Override
         public void touchDragged(InputEvent event, float x, float y,
               int pointer) {
            endX = x;
            endY = y;
            //isRotate = true;
            float translationX = endX-begX;
            float translationY = begY-endY;
            float length = (float)Math.sqrt(Math.pow(translationX,2) + Math.pow(translationY,2));
            Vector3 axis = new Vector3(0, 0, 0);
            if(length>0){
               if(begX-endX == 0){
                  axis.x = 1;
               }else{
                  float angle = (float) (Math.atan(translationY/translationX) + Math.PI/2.0*(translationX <0 ? -1 : 1));
                  axis.z = 1;
                  axis.x = (float) Math.cos(angle);
                  axis.y = (float) Math.sin(angle);
               }
            }
            quaternion = new Quaternion(axis, 0.02f*length);
            Matrix4 rotation = new Matrix4(quaternion);
            matrixResult = rotation.mul(matrixRotationOld);
            matrixRotationOld = matrixResult;

         }

      });
      //group.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      for (CenterCoordinate cenCoordinate : sphere.getPolygonCenterCoordinates()) {
         Vector3 vector = cenCoordinate.getCartesianCenter();
         Polygon polygon = new Polygon(1, cenCoordinate.getType().getCode(), cenCoordinate.getRadius(), cenCoordinate.getPsi(),
               cenCoordinate.getKsi(), vector, cenCoordinate.getRotation());

         group.addActor(polygon);
      }

      stage.addActor(group);
      Gdx.input.setInputProcessor(stage);

   }

Polygon extends Actor draw method :

         @Override
  public void draw(Batch batch, float parentAlpha) {
     translation.setToTranslation(vertex.x, vertex.y, vertex.z);
     matrix.mul(translation);
     shader.begin();
     shader.setUniformMatrix("u_worldView", matrix);
     mesh.render(shader, GL20.GL_LINE_LOOP, 1, mesh.getNumVertices()-1);
     shader.end();
     matrix.idt();

  }

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:
Problem with wheelcollider on bike game I have a problem with my first test on Unity, it's a simple motorcycle game. I found a script to start learning and runs very good, is this (answers.unity3d.com/questions/528298/bike-physics.html).
Well, the bike is moving good, and turns well, the problem comes when I try to knock down the bike. I'm using this example (docs.unity3d.com/ScriptReference/Transform-rotation.html), and the movement is perfect, but the bike don't turns as expected, making a strange movement (a small jumps, seems a bug xD).
What is the correct (and easy) way to get work the wheels on bike, because on car works perfectly.
Sorry for my english, and I appreciate a answers for noobs to my question, please.

I'm thinking on the possibility of keep the wheelcolliders always straight and rotate the other parts of the bike...
Or here, the user reccomends a sphere collider...but, how to make a "wheelcollider" with a spherecollider??
I'm very lost...

A lot of thanks!!!

----- EDIT -----

PROBLEM SOLVED!!
This is the code I used to solve the problem, I don't know if is correct but works perfect for me:

//INCLINACION MOTO AL GIRAR
var tiltAroundZ = -(Input.GetAxis("Horizontal") * tiltAngle);
var target : Vector3;
target = Vector3 (0,0,tiltAroundZ);
var deltaRotation : Quaternion = Quaternion.Euler(target * Time.deltaTime);
// Dampen towards the target rotation
rb.MoveRotation(rb.rotation * deltaRotation);
if(Input.GetButton("Horizontal")==false)
{
if(rb.rotation.z > 0){
target.Set(0,0,-30);
deltaRotation = Quaternion.Euler(target * Time.deltaTime);
rb.MoveRotation(rb.rotation * deltaRotation);
}
if(rb.rotation.z < 0){
target.Set(0,0,30);
deltaRotation = Quaternion.Euler(target * Time.deltaTime);
rb.MoveRotation(rb.rotation * deltaRotation);
}

sentences:
Problem calculating normals for heightmaps So far I have been using normal avering to calculate the normals for my vertices in my heightmap, with good graphical result (see picture), however it is terribly slow. With a incresing image size the calculation time increases exponationally.

So I wanted to try implementing this algorithm insteed, but it isn't going very well. I have tried to trow around the variables a bit and tried diffrent combinations but nothing seems to work. Something that seems to be recurring is this shadow line pattern i get everywhere (the picture is a bit dark but i hope you can see the pattern).

My best guess to why this isnt working is because the algorithm isnt taking 2 of the neighboring vertices in to account in the calculation (See picture, blue is vertice we are trying to calculate normal for, green is the ones used in algorithm, red isnt used)

However, this algorithm seem to pop up in alot of places so that makes me think it has to be rigth. So im not sure if im doing it wrong somehow or if the algorithm is wrong. I was hoping some of you guys had runed in to the same problem and could give me some tips to what might cause this problem.

This is my translation of the algorithm im using

int cols = hmInfo.terrainWidth;
int rows = hmInfo.terrainHeight;

#define height(x, y)  hmInfo.heightMap[(y*cols) + x].y
XMVECTOR normal;
for(DWORD y = 0; y < rows; ++y)
{
    for(DWORD x = 0; x < cols; ++x)
    {

        float sx =  height( x < cols-1 ? x+1 : x, y) - height(x ? x-1 : x, y);
        if (x == 0 || x == cols-1)
              sx *= 2;

        float sy =height( x , y < rows-1 ? y+1 : y)- height(x, y ?  y-1 : y);
        if (y == 0 || y == rows -1)
            sy *= 2;

        normal=  XMVectorSet(-sx , 2.0f,  sy , 0.0f);
        normal = XMVector3Normalize(normal);

        tempSubset.vertices[y*cols+x].normal = XMFLOAT3(XMVectorGetX(normal),XMVectorGetY(normal), XMVectorGetZ(normal));

    }
}

PS. Seeing how it works with normal averaging im fairly sure that all other parts of the program is working fine DS.

sentences:
Is JavaScript viable for serious multiplatform 2D game development? Ever since I was a little kid, my dream has been to develop games. Well, now that I am older, more mature, and have some programming experience, I would like to start. However, I would like to turn this into a career.

I would like to develop strategy games like "Stronghold" and "Age of Empires".

The problem is that my language of choice is JavaScript.

sentences:
problem with SCNTransaction in Scene Kit I'm trying to move an object over a period of ten seconds from y coordinate 0 to y coordinate 10.  the object is created at y coordinate 0.  The problem is when the animation starts, the object pops to the end position for like one second or so then pops back down to the starting position and begins the animation properly.  Why is the object ending moving to the end location instantly, and how can I prevent this from happening?

//create box bottom
func createGrabBox() {
    grabbottom = grabBox.rootNode.childNodeWithName("grabbottom", recursively: true)!
    grabbottom.position.y = 0
    grabbottom.geometry!.firstMaterial!.transparency = 0.5
    grabbottom.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.Dynamic, shape: nil)
    grabbottom.physicsBody!.restitution = 0.0
    grabbottom.physicsBody!.friction = 1.0
    grabbottom.physicsBody!.categoryBitMask = ColliderType.grabBottomCatagory.rawValue
    grabbottom.physicsBody!.collisionBitMask = ColliderType.diceCatagory.rawValue
    scene.rootNode.addChildNode(grabbottom)

    //animation snippet
    SCNTransaction.begin()
    SCNTransaction.setAnimationDuration(10.0)
    SCNTransaction.setCompletionBlock() { }
    grabbottom.position.y = 10
    SCNTransaction.commit()

    //physics field for this object
    let field = SCNPhysicsField.linearGravityField()
    field.strength = 0
    field.direction = SCNVector3(x: 0, y: 0, z: 0)
    field.categoryBitMask = ColliderType.grabBottomCatagory.rawValue
    //only things with categories that match the field's will be affected by it
    let fieldNode = SCNNode()
    fieldNode.physicsField = field
    scene.rootNode.addChildNode(fieldNode)
}

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:
How to correctly pass multiple light structures to shader stage? I'm having some problems when passing multiple light structures to a shader stage. I'm using an array of point lights that is updated each frame.

This is my code for creating the buffer

D3D11_BUFFER_DESC lbDesc;
lbDesc.ByteWidth            = sizeof( PointLightData ) * NUM_LIGHTS;
lbDesc.Usage                = D3D11_USAGE_DYNAMIC;
lbDesc.BindFlags            = D3D11_BIND_CONSTANT_BUFFER;
lbDesc.CPUAccessFlags       = D3D11_CPU_ACCESS_WRITE;
lbDesc.MiscFlags            = 0;
lbDesc.StructureByteStride  = 0;

hr = mDevice->CreateBuffer( &lbDesc, nullptr, &mLightBuffer );

And this is how I update it

D3D11_MAPPED_SUBRESOURCE mappedResource;
hr = mDeviceContext->Map( mLightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource );

if( SUCCEEDED( hr ) )
{
    memcpy( mappedResource.pData, &mPointLightData[0], sizeof(PointLightData) * NUM_LIGHTS );
    mDeviceContext->Unmap( mLightBuffer, 0 );
}

mPointLightData is declared like this

mPointLightData = new PointLightData[NUM_LIGHTS];

In my shader I declare the light

struct PointLight
{
    float4  positionAndRadius;
    float4  ambient;
    float4  diffuse;
    float4  specular;
    float3  attenuation;
};

cbuffer CB_LIGHT : register(b1)
{
    PointLight  pointLight[2];
};

I can only access the first light object in the buffer successfully. Rendering the second light results in a pitch black scene.

However, if I change the starting address at the mapping stage from &mPointLightData[0]  to  &mPointLightData[1] the second light works but obviously not the first.

So my guess is that I'm doing simething wrong at either the mapping stage or at the creation of the buffer..

Any suggestions? Thank you!

sentences:
What is the name of the phenomenom where faces get stretched to the middle of the screen? I'm trying to make my own 3D view in java without the use of any imported libraries. It has been going really well for me except for the fact that if I'm positioned in a certain way some of my edges get stretched to the middle of the screen. a reference image:

The gun render's completely fine in the front part, but when I'm looking at it from this angle it looks like some of my edges get stretched to my viewto point. I want to google information on what other people have done to fix it, but I have no idea what this phenomenom is named.

I'm not looking for an answer on how to fix it, but on the name of the phenomenom because I'm trying to learn as much as possible by myself.

I'm pretty sure this is a wellknown problem and I just can't remember the name of it.

sentences:
How can I find the tangent and normal at an interpolated point on a Catmull-Rom/Hermite spline? I have an implementation of a simple Catmull-Rom spline. It works, but I'm trying my hardest to be able to place vertices at extrusions along the curve. For this I need the normal (and tangent in the process) to be able to find the correct locations off of the curve. I cannot find any information anywhere, at least nothing that I can understand, on how to quickly calculate the tangent for a given t value on the curve. I've tried to do the derivative myself but I quickly realized I had no idea what I was doing.

How can I find the derivative/tangent/normal for a point at a t value on a Catmull-Rom spline?

Just to be extra clear, here is an incredibly rough picture of what I need.

I need to sample a point at a location along the curve and find an orthogonal vector, represented here by the blue lines. At the end of the blue lines I will place vertices. I have a working implementation of this already but it is for a bezier curve.

sentences:
How To Find Out Which Package That Asset Belongs To? I have just messed up my project with some conflicting plugins, so i need to clean all plugins and reimport them, but i can't make sure which files to delete.

So how can i find out which package an asset belongs to?

Thanks in advance.

sentences:
Avoid threads/multithreading So here is the thing:
I have made a thread for each generator an outpost has. We have a total of 6 outposts , 5 generators each. 3 teams, engineers can only repair generators and prevent their overload. In order to make the whole generator logic I use threads. If the thread gets interrupted it means that the generator got prevented from being destroyed , if the thread is finished normally , the generator got destroyed and if the generator is destroyed an engineer can repair them. Is there any way of avoiding threads because in spite of high cpu usage there are also other thread issues.

The same thing happens with the shield regeneration of each player. I'll just post the code for this one:

public static void startRegenerate(final Player p){

    if(already_regenerating_arraylist.contains(p.getId())){
        return;
    }

    final int previous_shield_lvl = p.getShieldLevel();
    final int previous_hp_lvl = (int) p.getHealth();

    Thread reg = new Thread(){

        @Override
        public void run(){

            already_regenerating_arraylist.add(p.getUniqueId());
            try {
                sleep(3000);
            } catch (InterruptedException e1) {
            }

            for(;;){

                if(p.getShieldLevel() >= 20){
                    p.setShieldLevel(20);
                    already_regenerating_arraylist.remove(p.getUniqueId());
                    break;
                }

                if(p.getHealth() < previous_hp_lvl || p.getShieldLevel() < previous_shield_lvl){
                    already_regenerating_arraylist.remove(p.getUniqueId());
                    break;
                }

                p.setFoodLevel(p.getFoodLevel() + 6);

                try {
                    sleep(1000);
                } catch (InterruptedException e) {
                }
            }

        }

    };

    reg.start();
}

After having more than 50 players stuff stop working (lag , etc...)

sentences:
Make part of albedo transparent I have a shader which creates a circle inside of a plane mesh. I would like to get get rid of the parts around the circle, which are the r and b parts of the ALBEDO but I can't seem to figure out how to do it.
The only thing I've managed to find is ALPHA but that changes the transparency of the entire shader and not just parts of it.
shader_type spatial;

float circle(vec2 position, float radius, float feather)
{
    return smoothstep(radius, radius + feather, length(position - vec2(0.5)));
}

void fragment() {
    ALBEDO = vec3(0, circle(UV - vec2(0), 0.5, 0.005), 0);
}

Which currently looks like:

sentences:
Problem in if statement comparing GameObject name I am trying to get the name of the game object. for that i used

    Debug.Log (gameObject.transform.ToString());

in start. My gameObject name is "PowerupItem_0" and "PowerupItem_1". in console it displayed the gameObject name correctly. then i tried to execute the statement. so i used

    if (gameObject.transform.ToString () == "PowerupItem_0") {
        Debug.Log ("PI_0");
    } else if (gameObject.transform.ToString () == "PowerupItem_1") {
        Debug.Log ("PI_1");
    } else
        Debug.Log ("Oth");

for this coding in console it displayed a message as "oth". i am not understanding why its not printing "PI_0" and  "PI_1". anybody please help

sentences:
Getting any type in Unity Inspector I am developing a SaveManager system for my games. Basicly what it should do is;

1) Gets the "ANY" user created Serializable class by Drag&Drop to inspector. (save data).

2) Writes that class to a file using either BinaryFormatter or XMLSerializer.

I want to be able to use it in my future games. So it should be save data class(type) independant (like serializers). I will use it like an asset, import the SaveManager, give serialized class as parameter, and let it do the rest. But as i said, it should be able to use any user created serialized class.

So the problem is, since that "serialized class" will be written by the user in the "game project" (not in the SaveManager project), and i don't have that "serialized" class type in my SaveManager project, i don't know how to make the SaveManager, reference the class from inspector.

So lets say i create this class in the game project (not in the SaveManager project)

[System.Serializable]
public class SaveData
{
    public string Name = "Name";
    public int Number = 5;
}

Now when i import the SaveManager project (asset) into my "game" project, i should be able to drag and drop the script to the SaveManager inspector and let it do the rest. Since BinaryFormatter works for every Serializable type, the name of the type is actually doesn't matter. I mean BinaryFormatter is type free as long as the type is serializable. I want to use that feature, and make the SaveManager type free too.

So in future if i want to use, say "MyNewSaveData" serialized class, "in an another game", i want to be able to drag and drop this to SaveManager inspector and let it do the rest.

Now the thing is, if i use

public object _SaveData;

in SaveManager script, unity inspector doesn't show it.

if i use

public Object _SaveData

it casts the user created type to an Object, and i lose the type i need.

I tried to use System.Type, but unity doesn't show it too.

Basicly what i want to do is, get "any" serialized class as reference. Like

public SerializedClass _SaveData;

or something like

public Script _SaveData;

That reference should accept "any" serialized class. Gets it's type, then casts it to that type.

When i use

public Object _SaveData

if i use _SaveData.GetType(), i get the type the "user created".
I have the type, in my hands, but i can't cast Object to that type. I don't know how to use that type for casting.

What ever i do, it either doesn't show up in inspector, or it casted to another type and i lose the data.

What should i do?

sentences: Does a patch of simplex noise sum up to zero? Just for interest, when sampling simplex noise in any given dimension, would the sum of all samples run towards zero?

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:
Should static tiles and dynamic tiles share the same parent class? I want to make an abstract Tile class for all of the tiles in a platformer game - walls, platforms, floor traps, everything. This parent class has basic things every tile will have, such as width and height, position, and boundbox, as well as getters for all of these things. I want to make these attributes constants, because those things typically shouldn't be changing - a wall shouldn't have its width and height changed, for instance. However, in some special cases, those attributes may indeed change - a special platform may change its height when the player jumps on it, or another special platform may disappear after 1 second after the player jumps on it, for instance.

This presents a problem, because for the static tiles, non-constant attributes in the Tile class is bad practice, but for dynamic tiles, constant attributes will prevent them from being dynamic. Is the best method, then, to create two different parent classes, which are the same, aside from one with constant attributes and one with non-constant? Is there a special name for dynamic tiles (I've heard "entity" thrown around, but I really don't know)?

sentences:
glGetUniformLocation Returns -1 I've been trying to develop shaders that would allow me to easily display text on screen using a font texture. I've previously written shaders that simply drew the text on screen and I passed the exact coordinates for the vertices and UV coordinates to the shaders. With my new shaders, I'm trying to pass just a single point for each letter, representing the bottom left corner each letter, as well as a single point for the UV coordinate of the letter, representing its location on the font texture. I then use a geometry shader to generate the triangles and UV coordinates necessary to draw the letters. Here is my code for the shaders:

Vertex Shader:

#version 330
layout(location = 0) in vec2 vertexPosition;
layout(location = 1) in vec2 vertexUV;
layout(location = 2) in float textSize;
uniform unsigned int textureX;
uniform unsigned int textureY;
out VertexData
{
    vec2 uv;
    float textSize;
} outputData;
void main()
{
    // Represents the bottom left corner
    gl_Position = vec4(vertexPosition, 0.0f, 1.0f);
    // Convert the UV coordinates from [0, textureX - 1] to [0, 1]
    outputData.uv = vertexUV / vec2(textureX, textureY);
    outputData.textSize = textSize;
}

Geometry Shader:

#version 330
layout(points) in;
layout(triangle_strip, max_vertices = 6) out;
uniform unsigned int textureX;
uniform unsigned int textureY;
in VertexData
{
    vec2 uv;
    float textSize;
} inputData[];
out FragmentData
{
    vec2 uv;
} outputData;
void main()
{
    float textureWidth = 1.0f / textureX;
    float textureHeight = 1.0f / textureY;
    // Calculate the vertices
    vec2 brCorner = vec2(gl_in[0].gl_Position) + vec2(inputData[0].textSize, 0.0f);
    vec2 tlCorner = vec2(gl_in[0].gl_Position) + vec2(0.0f, inputData[0].textSize);
    vec2 trCorner = vec2(gl_in[0].gl_Position) + vec2(inputData[0].textSize, inputData[0].textSize);
    vec2 uvBR = inputData[0].uv + vec2(textureWidth, 0.0f);
    vec2 uvTL = inputData[0].uv + vec2(0.0f, textureHeight);
    vec2 uvTR = inputData[0].uv + vec2(textureWidth, textureHeight);
    gl_Position = vec4(tlCorner, 0.0f, 1.0f);
    outputData.uv = uvTL;
    EmitVertex();
    gl_Position = gl_in[0].gl_Position;
    outputData.uv = inputData[0].uv;
    EmitVertex();
    gl_Position = vec4(trCorner, 0.0f, 1.0f);
    outputData.uv = uvTR;
    EmitVertex();
    EndPrimitive();
    gl_Position = gl_in[0].gl_Position;
    outputData.uv = inputData[0].uv;
    EmitVertex();
    gl_Position = vec4(brCorner, 0.0f, 1.0f);
    outputData.uv = uvBR;
    EmitVertex();
    gl_Position = vec4(trCorner, 0.0f, 1.0f);
    outputData.uv = uvTR;
    EmitVertex();
    EndPrimitive();
}

Fragment Shader:

#version 330 core
in FragData
{
    vec2 uv;
} inputData;
out vec4 color;
uniform sampler2D textureSampler;
void main()
{
    color = texture2D(textureSampler, inputData.uv);
}

When I call glGetUniformLocation for the textureSampler uniform in my fragment shader, I get a valid uniform location back. However, when I call glGetUniformLocation for textureX  and textureY, glGetUniformLocation returns -1. When I searched for what could cause this, the main cause of this issue is usually the compiler optimizing the variable out as it's not used. I don't believe this to be true in my case, but I have no idea what could be causing glGetUniformLocation to return -1 for this.

Edit: After reading Andon M. Coleman's excellent answer on how active uniforms are determined, I discovered the issue. The name of the struct the geometry shader outputs and the name of the struct the fragment shader accepts are different-

Geometry Shader:

out FragmentData
{
    vec2 uv;
} outputData;

Fragment Shader:

in FragData
{
    vec2 uv;
} inputData;

After changing the structs to share the same name, I am able to get a valid uniform location back.

sentences:
Unity wwwForm responce handle? Is there any way to handle the response for the wwwform we are using add.form method and there is no way to validate the data insertion we cant say the values are entered into database or not is there any way to check the response?

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LoadOnClicktes : MonoBehaviour {
    public Text box1;
    bool ch=false;

    // Use this for initialization
    string url1="*******/index.php";

    // Update is called once per frame
    public void LoadScene(int score1)
    {
        string kill = box1.text;
        Debug.Log (kill);
        int sco = Player.score;
        Debug.Log (sco);
        WWWForm form = new WWWForm ();
        form.AddField ("name", kill);
        form.AddField ("score",sco);
        WWW WWW = new WWW (url1, form);
        Debug.Log ("Done");
        ch = true;

    }
    /*void OnGUI(){
        if(ch)
        GUI.Window (0, new Rect ((Screen.width / 2) - 150, (Screen.height / 2) - 75
        , 300, 250), ShowGUI, "");
    }
    void ShowGUI(int windowID)
    {
        // You may put a label to show a message to the player

        GUI.Label(new Rect(65, 40, 200, 30), "Score Submitted");

        // You may put a button to close the pop up too

        if (GUI.Button(new Rect(50, 150, 75, 30), "OK"))
        {
            ch = false;
            // you may put other code to run according to your game too
        }

    }*/

}

sentences:
Merging geometry/mesh without losing benefits In three.js we can simply merge geometry to limit the amount of draw calls and thus increase performance. In a simple test with one material, I could draw 50.000 cubes + shadows @ 60fps on my GTX660 GPU. Without geometry merging, 5.000 cubes already caused a problem.
I wonder how to preserve the benefits of rendering each cube mesh on it's own. For example, how to pick a cube mesh when everything is merged into one geometry? By default that's not possible of course.
Is there any common technique for this problem? After all I do have all the unmerged mesh objects even after merging. So there must be some way to utilize them for picking?
What I want to do in a nutshell

SimCity like game for learning purposes
Each house is a cube mesh
Want to render 50.000 houses and be able to add & remove houses
House-selection via mouse-cursor (picking) must be possible

sentences:
Not able to assign any scripts to my game object I am not able to assign a particular C# script to a game object. When I try to do so, I get this error as shown below Only the script I have is different.

In brief, just like the error above I am getting it as Can't Add Script Component 'AIWaypointNetwork' because the script class cannot be found. Make sure that there are no compile errors and that the file name and the class name match
And when I try to create a script component, I get the warning Associated Script cannot be loaded. Please fix compile errors and assign a valid script. Here is a screenshot of the situation.
As far as I know, I don't see anything wrong with the script and it's pretty simple too.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AIWaypointNetwork : MonoBehaviour
{
    public List<Transform> Waypoints = new List<Transform>();
}

The unity version that I am using right now is Version 2020.1.11f1 Personal. And I have not faced these types of errors before. Based on my search, I see that I would probably have to reimport assets over again. How do we do that in this version of unity?
Is there something else I am missing here?

sentences:
Still confused about timesteps in XNA I have been reading many different posts and articles about timesteps and while I now understand that fixed timesteps are generally considered superior, I'm having a bit of difficulty implementing one in XNA.

Apparently XNA uses a fixed timestep where the update method is called 60 times per second by default. However, I'm not really sure how to reconcile this fact with what I have been reading here, here, and here.

Do I need to supply my physics stepping with some sort of delta variable? Should I even be using GameTime.ElapsedGameTime anywhere in my code?

I guess I'm just a bit confused in regard to how much XNA is actually doing for me. Is it advisable to turn off the fixed timestep in XNA and instead make my own loop like the one from this post?

sentences:
Can't understand why transformation doesn't work To make a simple transformation like a rotation I want to use linear algebra -multiplying the vec4 vertex_position by a mat4 transformation

If alpha is the angle of rotation, then the mat4 is structured like this:

|first      |second    |third |forth|
|cos(alpha) |sin(alpha)|0     |0    |
|sin(alpha) |cos(alpha)|0     |0    |
|0          |0         |0     |0    |
|0          |0         |0     |0    |

This matrix represents a rotation in the xy plane.

The transformation doesn't work though - can anyone spot my mistake?

sentences:
Bukkit send a custom placed name plate? Hello i have been working on a part of my plugin that has waypoints allowing the user to create delete etc. I got to thinking after using and seeing a couple of the disguse plugins. That maybe i could create a command toggle that would show the user where the waypoints they have are! I know how to do all of this i just have no idea how to display a nameplate to the client. I know its possible because disguisecraft does it i tried looking though their code but couldent find much...

I belive to get this effect i need to send packets to the client if someone can direct me to a list of bukkit packets or even a solution to sending the client a custom located nameplate that would be fantastic! Thanks in advanced.

sentences:
How much is 2D geometry used in 3D? I'm studying 2D geometry with eventual goal to study 3D geometry for building games - very much looking forward to 3D!!
Looking up on how to calculate hypotenuse of a right triangle in 3D I read that the the same 2D Pythagorean theorem can also be used in 3D right triangle to calculate the hypotenuse.
So now I'm curious on how much of the 2D geometry I'm learning right now will be reusable when I get to 3D?
By "how much" I mean

Do devs throw away their 2D knowledge in 3D and use a whole new sets of formulas/theorems?
Or almost all or at least 90% of 2D knowledge is reused in 3D?

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:
How do you tell OpenGL ES 2.0 to use a texture as the depth buffer? I want to render a scene with an outline post processing effect in OpenGL ES 2.0.

First I render all the opaque objects. Then I use a post processing shader
for silhouette detection that uses the depth buffer as a texture.
 And now I want to render all the objects using alpha blending,
without writing to the depth buffer, but using depth testing with
the values from the depth buffer texture used for silhouette detection.

If I would have rendered the translucent objects before the post processing,
 the post processing would have rendered the outlines of opaque objects over
 them since they don't write to the depth buffer.

How do you tell OpenGL ES 2.0 to use a texture as the depth buffer?

Thank you

sentences: Unity Loading Image? I have a quastion about loading screen in unity. I don't want to make a scene between to levels [Main Menu > Loading Scene > Game level]. I want to use Canvas "Image"that run at the start of the game level and then disappear after few seconds [Main Menu > Game level]. Is this good idea ?

sentences:
Unity2d Camara smooth zoom issue want to know that how mathf.movetowards works, i tried to play around it and have some issues.
i want to make the camera moves from player to target places along with zooming upon triggered and vise versa, while smooth follow(camera changes target) works, smooth zooming doesn't work.
i place the movetowards code to ontriggerenter/exit, but it doesn't work as intended as it only zoom for frames. However, if i place it at update side, the zooming doesn't work at al.

code provided for more infomation.

public class Disable : MonoBehaviour {
GameObject player;
GameObject Camera;
public Transform placeHolder;
public float smoothTime = 2f;
public float adjustSize;
public float originalSize = 6.5f;
public float targetOrtho;

public Vector3 velocity;

void Awake()
{
    player = GameObject.FindGameObjectWithTag("Player");
    Camera = GameObject.FindGameObjectWithTag("MainCamera");

}
private void Start()
{
    targetOrtho = originalSize;
}

void Update()
{
    Camera.GetComponent<Camera>().orthographicSize = Mathf.MoveTowards(Camera.GetComponent<Camera>().orthographicSize, targetOrtho, smoothTime * Time.deltaTime); //doesn't work

}

void OnTriggerEnter2D(Collider2D other)
{
    if (other.gameObject == player)
    {

        Camera.GetComponent<Camera2DFollow>().target = placeHolder;
       targetOrtho = adjustSize;
       //Camera.GetComponent<Camera>().orthographicSize = adjustSize; //works but only changes the size without smooth
       //Camera.GetComponent<Camera>().orthographicSize = Mathf.MoveTowards(Camera.GetComponent<Camera>().orthographicSize, adjustSize, smoothTime * Time.deltaTime); //works but only did for a few frames( not completely)

    }
}

void OnTriggerExit2D(Collider2D other)
{

    Camera.GetComponent<Camera2DFollow>().target = null;
    targetOrtho = originalSize;
    //Camera.GetComponent<Camera>().orthographicSize = originalSize; //works but only changes the size without smooth
    //Camera.GetComponent<Camera>().orthographicSize = Mathf.MoveTowards(Camera.GetComponent<Camera>().orthographicSize, originalSize, smoothTime * Time.deltaTime); //works but only did for a few frames (not completely)
}

sentences:
Drawing beam effect in UDK? I'm having trouble drawing a particle effect between two actors in UDK - Both the source and the target are not static objects, so as far as I can tell I need to do it in the code not in kismet. Here's what I've got at the moment and it seems to not be doing anything at all. Ideas?

BeamEmitter[0] = new(self) class'UTParticleSystemComponent';
BeamEmitter[0].SetAbsolute(false, false, false);
BeamEmitter[0].SetTemplate(BeamTemplate[0]);

BeamEmitter[0].SetTickGroup(TG_PostUpdateWork);
BeamEmitter[0].bUpdateComponentInTick = true;
self.AttachComponent(BeamEmitter[0]);
BeamEmitter[0].SetBeamEndPoint(2, tarPos);
BeamEmitter[0].ActivateSystem();

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:
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 refer to a recipe defined in one function from elsewhere in my code? I want to access the variable recipes defined in this code below.

Unfortunately I have to define my recipes inside  storage.loadGame(session, function(currentGame) {... because I need to make use of the currentUser variable available inside that function.

Once I'm outside of that function, I don't know how to access my recipes anymore.

rPositivityWORLD: function(intent, session, answer) {
    storage.loadGame(session,
       function(currentGame) {
         var currentUser = currentGame.data.UserName;
         var recipes= [
           "<seak>hey </speak>" + currentUser + "<speak> i know that you can do it, also just one more thing thank you</speak>",
           "<speak>testing </speak>" + currentUser + "<speak> testing</speak>",
           "<speak>testing </speak>" + currentUser + "<speak> testing 2</speak>"
         ];
 return recipes; // so i did try changing it to this,let's see what will happen.
       }
    );

    var indexList = [],
    ANSWER_LENGTH = 2,
    recipe = storage.loadGame.recipes;

    var index = recipe.length;
    if (ANSWER_LENGTH > index) {
        ......
    }
 }

sentences:
How to create a believable swimming fish animated Sprite in 2d? I want to create a fishing game in which fish needs to be swam across in the ocean. I put static fish which just progresses across ocean but it does not look very realistic and interesting to attract users to play.

I have used minimal graphics style to design graphics for the game and want to put some animation, like, moving tails and fins which I can achieve by making multiple images. But I also want to put some big fishes like sharks and only animating fins and tails will not be enough for them. As player will die without touching body due to margin left for tails or fins animation, or consider an eel.

I can use the snake technology for eels but for fishes where only tails move, is there any other way I can use? Or consider the Jumping Fish game by Ketchapp.

Could anyone suggest me proper ways to achieve such animations?

sentences:
Making a Box2D ball bounce to constant height I want to create a game like Doodle Jump. I'm using libgdx and Box2d. I needadvice  on how to make my ball bounce constantly and with the same height.

I've tried setting the ball's body restitution to 1 so it can jump constantly, but when I jump on a block the "impulse" is smaller. I also tried to detect the collision, then apply an impulse but it didn't work either.

How can I make the ball bounce to the same height every time?

sentences:
How to mitigate when applying horizontal force to a rigidbody seems to overpower gravity? I've started testing movement using the example code in this answer of making a body accelerate to a target velocity
    private void FixedUpdate()
    {
        Vector2 input = GetInput();

        if (Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon)
        {
            Vector3 desiredVelocity = new Vector3(input.x * speed, 0f, input.y * speed);

            Vector3 delta = desiredVelocity - body.velocity;
            Vector3 acceleration = delta / Time.deltaTime;

            if (acceleration.sqrMagnitude > maxAccel * maxAccel)
            {
                acceleration = acceleration.normalized * maxAccel;
            }

            body.AddForce(acceleration, ForceMode.Acceleration);
        }
    }

and I've encountered the following curious behavior:
https://imgur.com/snGyVYK
When moving the body by applying force, the body seems to levitate as if gravity is not being applied. It actually is being applied but it seems as if the force being applied to the body is overriding the force of gravity because as soon as I let go of the movement keys the body suddenly drops. I am not applying any force on the y axis so I'm not sure what exactly is at play here. What is going on here and what can I do to mitigate this behavior?

sentences:
Unity player movement in cells I want to do a game where the map is cell based, like Pokemon, where when you press Left, you move from 210x100 to 209x100.

Like this:

    void Update()
    {
        var x = Input.GetAxis("Horizontal");
        var z = Input.GetAxis("Vertical");

        if (x == 0 && z == 0)
        {
            return;
        }

        if (x > 0)
        {
            x = 1;
        } else if (x < 0)
        {
            x = -1;
        }

        if (z > 0)
        {
            z = 1;
        } else if (z < 0)
        {
            z = -1;
        }

        transform.Translate(
            x,
            0f,
            z,
            Space.World
        );
    }

But with this approach, when you quick press and release the left, the Update is executed many times and you go from 210 to 203 easily.

How can I move from 210 to 209 in 0,5 seconds and don't allow other movement until the current movement has finished?

sentences:
Square game map rendered as sphere For a hobby project of mine I have created a finite voxel world (similar to Minecraft), but as I said, mine is finite. When you reach the edge of it, you are sent to the other side. That is all working fine along with rendering the far side of the map, but I want to be able to render this grid as a sphere.

Looking down from above, the world is a square. I basically want to be able to represent a portion of that square as a sphere, as if you were looking at a planet. Right now I am experimenting with taking a circular section of the map, and rendering that, but it look to flat (no curvature around the edges).

My question then, is what would be the best way to add some curvature to the edges of a 2d circle to make it look like a hemisphere. However, I am not overly attached to this implementation so if somebody has some other idea for representing the square as a planet, I am all ears.

sentences:
The true cost to get my XNA game on XBox? There seem to be many hurdles to get ones game onto Xbox, so far I have uncovered:

You need Visual Studio (once your game becomes commercial you cannot use Express - but have to pay for professional). $1000+
You then buy a XBox to find you also need a harddrive - so buy a Xbox harddrive too. $400
You need to buy XBox Gold LIVE subscription. $70 (Free)
You need to buy AppHub Creators Club subscription $100

Then after all that I cannot even find the place on my XBox to download Indie games?!!! Seriously WTF - after doing all this I could have come proficient in WebGL and done it all for free...

Before I go all the way down this path (hole) are there any other hidden hurdels before I can publish my game?

UPDATE: "Indie Games are not available in Australia, due to the requirement for all games to be rated by the Australian Classification Board, and the prohibitive expenses involved."....... im going to have to break something....

sentences:
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: What is the difference between body transform and root transform I am learning about Root animation and here come two terms, one is root transform and Body transform. As name suggests that body transform is the character body but what is root transform? and what is the Root transform rotation based upon body orientation, Feet, center of mass or original.

sentences:
How could I implement destruction of bases in Space Invaders type game? What approaches could you use to implement the the gradual destructions of bases/shields in a top down shooter type game similar to Space Invaders?

The simplest approach could be to use a series of sprites that are replaced to show increasing deterioration after each missile hit.

A more advanced approach might be to randomize the deterioration pixel by pixel after each hit, but I'm not sure how to implement an approach like this. Does anyone have any suggestions for how to approach something like this?

sentences:
Is there a way to make a game object invisible to only certain players? I have found a few posts and blogs here and there. But all of the solutions they provide seem to be global.

Is there a way for let's say a multiplayer scenario where maybe an enemy has a cloaking device. Player 1 can't see said enemy but because Player 2 has thermo-goggles he can see the enemy just fine.

Is there an example of that scenario somewhere? I assume that it would have to be done at the camera level instead of the object instantiation. Maybe a state machine to designate these objects are invisible and one on the camera to state that you can see said invisible objects?

sentences:
Approach in implementing the web browser game Im Phil and try to figoure out the best approach for my app.
I was searching Stack for my question but I didnt find a completely answer.
Assumptions:

It will be multiple user who can see in real time their vehicles(locations,state, fuel), places(state, is it planted, is it mowed) etc.
Action taken by players - e.g. User click build/drive and have to wait for example 45min. I want to display to user time to end of action.
should action be registered in queue system ? ( RabbitMQ or something like this,generally a message queuing system)
After this time the object of user should change - User get coins or the vehicle change his place from X to Y
Remove this action from queue and store information about ended action in DB

Is my approach correct? Could I ask for ways to implement this? Or should I go in a completely different direction? I will be grateful for all the advice!

EDIT:
I found different solution: Store action in DB to build / drive and save the current timestamp and time when action is finished. Now i should have bacgrond process which will be looking into this DB and change state when the action is finished (add coins to player X e.g.) In the same time when user clik the request to server is send. In response got the time when te action start and finish. Javascript will be drawing to user the progres bar (calculated from current timestamp and from db) What in situation when user not send another request (not rerfresh site)? The script should check if action in finished (current timestamp > timestamp from db ) and then should automatically refresh user site. Is that correct?
Second aproach is simpler to implement IMO.

sentences:
Advices on multiplayer implementation I am developing a top down shooter and my singleplayer is pratically finished so now I want to move on to develop multiplayer but I have some questions and I am seeking for some advices.
In my game a match is constituted by a character(two in a multiplayer match) , monsters, projectiles, boosts and spawn points.
Here is my initial solution:
Characters- Send to the game server my character(position, if it´s dead or not,currentHealth,etc) and receive the other player character from the server. Thinking about using UDP because I want real time positions
Monsters- My strategy for this one is having the server randomly choosing one of players´computer to handle the spawn of the monsters .The list of monsters is sent to the server and the other player gets it. Thinking about using TCP because a lost package would imply that the round will have less monsters than it should have
Projectiles- When a player clicks the left button to shoot a projectile, the input is sent to the server. This means that the projectiles list would be instanciated in the server and both players will have to get it from it. 99% sure I will use UDP because a lost projectile wouldn´t have a major impact on the match.
Boosts- Probably the same strategy as the monsters. Pretty sure I will be using TCP because if the boost doesn´t spawn in that round it completely alters the match.
I am looking for critics to the strategies I am planning to implement as well as some advices

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:
How can I make my tiles fall smoothly? I'm working on a Tile-Based game and I can't figure out how to make my tiles fall down smoothly like in candy crush. All column tiles fall-down at the same time. And spawn new like how many tile place if null.
What I want:

Update [25.12.2015]
But the my code works like this:

Update [26.12.2015]
Hello Again,
World Scale (x,y)
World Scale OLD: (10,10)
World Scale NEW: (10,11)
Y=11 Tiles type = Empty
Now, when i click the random place like (5,7),above all blocks down to :
block.transform.pozition += new Vector3(0,-1,0);
It's working. But again, when i click same place (5,7) not working...
I changed Y scale 10 to 11. Because, when i clicked tile, the tile will return to Y=11 position and fall down, how many tile place null.
When Tiles state "fallling down", the space between two blocks distance not more "0.01".
I do not know how to do. But I approached. I need to more improve this.
Thanks...
Pseudo-code:
When I click the (4,7) coord, the tiles,
tile(4,8) is smooth down the coord(4,7)
tile(4,9) is smooth down the coord(4,8)
tile(4,9) is generate new tile.

What I have (Code not working properly :( ):
World.Height = 10
World.Widht = 10
Tile X and Y {get, protected set}

public void ColumnDown(int x , int yStart)
{
    if (IsColumnFull(x)) return;

    for (int y = yStart; y < World.Height; y++)
    {
        //Yeni tile spawnla
        if (y + 1 >= World.Height) continue;

        Tile tile = World.GetTileAt(x, y);
        Tile tile2 = World.GetTileAt(x, y + 1);

        GameObject go_Tile = GameObject.Find("Tile-(" + x + "," + y + ")");
        GameObject go_Tile2 = GameObject.Find("Tile-(" + x + "," + (y + 1) + ")");

        if (tile != null)
        {
            if (go_Tile == null && go_Tile2 == null)
            {
                Debug.Log("go_Tile NULL");
                continue;
            }

            tile2 = tile;
            go_Tile2.transform.position += new Vector3(0, -1, 0);
            go_Tile.name = "Tile-(" + x + "," + (y + 1) + ")";
            go_Tile2.name = "Tile-(" + x + "," + (y) + ")";
        }
    }
}

sentences:
Adding newly created objects into a vector inside the object? Would some thing like this work?

RawModel::RawModel(GLuint vao, GLsizei count)
    : m_VAO(vao), m_Count(count)
{
    m_RawModels.push_back(this);
}

RawModel::~RawModel()
{
    for (GLuint i = 0; i < m_RawModels.size(); i++)
        delete m_RawModels[i];
}

I am fairly new to the language and I don't know if it would work.

sentences:
Sprite Animation Using Multiple Images (XNA / C#) all.

Right now I am currently working on a game with my Australian buddy and I just am having such a difficult time with the spriting process.  As the programmer of our game, it is my responsibility to get the sprites he models drawn and animated onscreen.  However, the sprites he's drawing are huge images and the animation sequences are always at least 20 images wide, which means they're too big for the FileOpen method to read...  Which brings me to my question: Is there a way to use a directory as the animation sequence?  Like instead of stringing all the images together in a chain and animating the sequence, can I make an animation from a collection of the images in a folder?

For this example, use Animation.png to represent the chain of images version and Image1, 2, and 3.png for individual images in a directory.

Thanks in advance!

sentences:
Sound Manager class in Unity Starting with Unity having had experience of XNA im not sure if the way i want to solve my problem is the correct way. So id like the opinion of more experienced people.

I am doing a 2.5D game and have no need for 3D sounds that generate from a certain 3D position. I am used to creating a sound manager class that handles the loading of sound assets and has a static public method for each sound effect. This way it works like a toolbox i can call SfxManager.PlayDeathScreamSfx(); from anywhere in the solution.

How could i do the same in Unity?

I have tried making a game object called soundmanager and given it static methods that would play the sound effects but the SoundClips needs to be static for the static methods to be able to use them. And if the SoundClips are static then they dont show up in the inspector and i cant drag'n'drop a sound file on them to reference them.

What to do?

sentences:
What do I do with a libgdx rectangle collision? The edge of the rectangle is not detached

But if the rectangle is narrowed, it will affect the left and right collision detection

sentences:
Tessellation won't render I am starting to work with tessellation and have some problems right in the beginning. I try to render a quad made of two triangles with tessellation, but nothing appears on the screen. But as soon as I remove the tessellation shaders and change GL_PATCHES to GL_TRIANGLESagain, it starts working again, without tessellation obviously.

So here is my code to setup the tessellation shaders:

glPatchParameteri(GL_PATCH_VERTICES, 3);
shaderID = glCreateProgram();
{
    vertex = GraphicsUtilities::loadShader("D:\\vert.glsl", GL_VERTEX_SHADER);
    glAttachShader(shaderID, vertex);

    fragment = GraphicsUtilities::loadShader("D:\\frag.glsl", GL_FRAGMENT_SHADER);
    glAttachShader(shaderID, fragment);

    tcs = GraphicsUtilities::loadShader("D:\\tcs.glsl", GL_TESS_CONTROL_SHADER);
    glAttachShader(shaderID, tcs);

    tes = GraphicsUtilities::loadShader("D:\\tes.glsl", GL_TESS_EVALUATION_SHADER);
    glAttachShader(shaderID, tes);
}
glLinkProgram(shaderID);

This is the vertex shader:

   #version 400

layout(location=0) in vec4 vertPosition;
layout(location=1) in vec2 vertUV;
layout(location=2) in vec3 vertNormal;

void main(void){
    gl_Position = vertPosition;
}

The TCS:

#version 400
layout (vertices = 3) out;

void main()
{
    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;

    gl_TessLevelOuter[0] = 3.0;
    gl_TessLevelOuter[1] = 3.0;
    gl_TessLevelOuter[2] = 3.0;
    gl_TessLevelInner[0] = 3.0;
}

And the TES:

#version 400
layout(triangles, equal_spacing, cw) in;

void main()
{
    gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position +
                   gl_TessCoord.y * gl_in[1].gl_Position +
                   gl_TessCoord.z * gl_in[2].gl_Position);
}

And this is how I draw the quad:

glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
glUseProgram(shaderID);
glBindVertexArray(quad->getVboID());

glDrawElements(GL_PATCHES, 6, GL_UNSIGNED_INT, (GLvoid*)0);

glBindVertexArray(0);

glUseProgram(0);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );

I tried using in and out variables instead of gl_in/out, but that doesn't work either. I also tried it without the TCS.
I was also using Apitrace to look up any errors, but nothing. The function loadShader() looks for compile errors.
So what could cause this problem? I really have no idea how to debug this thing any further.

sentences:
algorithm advice for game background ambiance - animals living in forest In the game, there is a forest and animals living in it.
The interaction of the animals is just a background ambiance.

When googling I found Goal-Oriented Action Planning pattern.

And this pattern seems to solve the issue. If we give goals to the animals while achieving their goals they can behave realistically for the ambiance.

After more research, I found a paper which is advising extending GOAP with smart ambiance objects to make agents behave context aware.
"Feeling the Ambiance: Using Smart Ambiance to Increase Contextual Awareness in Game Agents"

For example, think of an adventure game, the player is searching for clues/items in the forest.

Meanwhile, a bird (non-player character) is looking for a fruit on the tree to eat.
Bird sees a fruit on the tree but also saws a snake danger close to the fruit.
So bird afraid and do not decide to eat that fruit...

Are there other algorithms/patterns that you can remind to solve this need?

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:
How to handle wearable items on character I am developing a text/image based rpg game with javascript.I have questions about how to handle wearable items on character.

Lets say that there are many(naked no item) character types(images)and there are many items.When a player equips a sword and a helmet,do i have to make images of all item combinations with all base character types import them into the game then check all of them with if elses then display correct picture on screen  ?  or is there any other way

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:
Can unity playerprefs fail to save, and if they do how can I check? As the title says I would like to know if playerprefs can fail to save.

If they can, is there some way to check if it save properly / if it failed?

Example :

if (playerprefsFailed)
{
    Debug.Log("Failed to save playerprefs...");
}

I found PlayerprefsException in the Unity API, however I'm confused on how to use it.

I have also googled if they can fail, but couldn't find any results, however considering there is a exception for it, it can probably fail.

The PlayerprefsExceptionis also only thrown on the web player however I would like to know if it can fail, and when, and also how to stop it on a normal pc build.

sentences:
Ogre 3D Visibility Advice I would like an advice about some real-time rendering optimization.
I'm rendering a BSP level, by only using the mesh, textures, entities, and lightmaps, not using VIS at all.

I'm trying to make my own Cell/Portal rendering system, a very basic one, but here is the problem, since Ogre uses a basic frustum culling (as I've heard), I think it would render everything behind the walls if every portals are in the field of view :

Do you have some better ideas to implement this ?

I am getting 650 FPS at a resolution of 1920x1080 if I render only zone only. I can get 1300 FPS if I see nothing.

Is 300 FPS good for a complex scene like this one?

I would like to make a lot of basic things clear for me.

sentences:
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:
Making a night scene without being dark on the monitor What would be a good way to make a 3D scene look "like" a dark night, without being so dark on the monitor that it's hard to see stuff (especially when playing in a brightly lit room).

I've been experimenting with making the light bluish in nature, and having a fairly dark ambient component with a brighter diffuse component, but I find the result either a bit lack-luster or still too dark, depending on the exact parameters.

Are there any good examples to study?

sentences:
XNA captures mouse clicks when the game doesn't have focus If I alt-tab and do stuff outside of the game window, the game still captures mouse clicks (both left and right clicks).

The game doesn't "consume" the clicks, since they are also sent to the application that has the focus.

But it's rather annoying to hear a gunshot each time you click in your internet browser...

Also, the problem occurs even if the game is set to fullscreen.

sentences:
Realistic Trajectory of a Projectile When simulating an airplane and a missile, to get them moving in the air we apply a force in one direction. Now an airplane has wings that keeps it afloat while a missile can have fins to stabilize it. In both cases when the force is no longer strong enough, the velocity reduces and the projectiles are bound to succumb to gravity. When that happens, the projectiles naturally don't fall directly to the ground disregarding rotation and other spins based on air resistance and whatever momentum there is left.

My question is, to simulate such behavior how would the Bullet, Nvidia PhysX and Havok physics libraries compare against each other especially with emphasis to the following?

Gravitational pull and momentum acting on the projectiles.
Air resistance acting on the projectiles.
Both 1 and 2 above's behavior can be based on varied levels of a central forward force applied on the projectiles.

sentences:
How to blend the sprite into background? I try to blend the character into game but I still cannot remove the blue color in the sprite sheet and discover that the white area of sprite is semi-transparent.

Before that, the color D3DCOLOR_XRGB(255, 255, 255) is set in D3DXCreateTextureFromFileEx. You will see the fireball through the sprite.

After I change the color to D3DCOLOR_XRGB(0, 255, 255), the result will be

Now, I am trying to remove the blue color of the sprite sheet and my expected result is something like that

Until now, I still cannot figure out how to do that. Any ideas?

void initPlayer()
{
    //  Create texture.
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "player.png", 169, 44,
         D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
         D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(0, 255, 255),
         NULL, NULL, &player);
}

void renderPlayer()
{
    sprite->Draw(player, &playerRect, NULL, &D3DXVECTOR3(playerDest.X, playerDest.Y, 0),D3DCOLOR_XRGB(255, 255, 255));
}

void initFireball()
{
    hr = D3DXCreateTextureFromFileEx(d3dDevice, "fireball.png", 512, 512,
         D3DX_DEFAULT, NULL, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
         D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(255, 255, 255),
         NULL, NULL, &fireball);
}

void renderFireball()
{
    sprite->Draw(fireball, &fireballRect, NULL, &D3DXVECTOR3(fireballDest.X, fireballDest.Y, 0), D3DCOLOR_XRGB(255,255, 255));
}

sentences:
A few questions about Order Independent Transparency I've been looking through several different Order Independent Transparency algorithms. But very few of them seem to answer a few things.

I understand that the idea of OIT is to not worry so much about ordering. But does it still matter in some cases? And is there a way to preserve it if a certain ordering is desired?

For starters, does presorting impact OIT in any way? Such as speeding it up, or producing different visual results?

And is lighting still handled per pixel as normal when you submit your geometry to be rendered. Or does it happen defacto?

A few algorithms I have been looking at.

Intel's OIT solution. This also seems to be fairly popular with AMD as well.
AMD's Powerpoint

Depth Peeling. Can't find a good link.

And then Depth Weighted blending. Which seems to produce muddy results with layers. Linky

I guess I should also ask how necessary, and how fast is this. My main issue isn't layer's of transparent objects with overlaps. Things like holograms and layers upon layers of glass are likely to be rare. But mostly with particles and their drawing order from different particle systems, and them interacting with other transparent objects correctly.

Currently... the engine treats a particle engine like one complete object, and renders them directly to the backbuffer on the transparency pass. Though because the particles are volumes... it causes some graphical errors. For example if there was a huge explosion that covers a massive chunk of land... there will be a random stack of smoke that renders on top of it.

And I don't want to break up all the particle instancing to batch them with the rest of the geometry... as it would likely massively raise the draw calls for every break.

I currently can't provide any pictures right now. The engine is undergoing a serious rewrite to get it more usable. So a good portion of the code is slashed out. I'm just trying to solve problems I have noticed in my first right up.

sentences:
Difference between linear and logarithmic z-buffer I've searched about this topic for awhile and i couldn't find it on google. I've come across several ways to avoid z-fighting which are linear z-buffer, logarithmic z-buffer and reversed z-buffer. I decided to leave reversed z-buffer for now as i'm not planning to use OpenGL 4.5. The thing is i don't know the difference between linear and logarithmic z-buffer.

By "linear" i mean this:

float fz = gl_Position.z * gl_Position.w;
gl_Position.z = (fz - near) * 2.0 / (far - near) - 1.0;

And by "logarithmic" i mean this:

float w = gl_Position[3];
float C = 0.001;
gl_Position.z = (2 * log(C * w + 1) / log(C * far + 1) - 1) * w;

If i understand those codes correctly, the linear try to map all of the z value evenly. So does the logarithmic one. Sure both of them are totally different but i have tried both and see no or if any minimal differences, both eliminate the z-fighting. So there must be something i missed or don't understand.

edit: As Jimmy said, logarithmic is better than linear. Please add why logarithmic is better than linear z-buffer as i want to know why it is better and not just which one is better.

sentences:
How do MMO servers handle a large concentrated number of players? I have a pretty good understanding of how to scale servers but there's one thing I can't quite be sure about is how to manage a lot of players in a concentrated area.

If I have a server which is using multiple threads and processes as long as you limit the amount of players that can join a single game instance then this can scale indefinitely by adding more servers and placing it behind a load balancer.

But MMO games don't work that way because it's broken down into zones that anyone can connect to. So if a massive amount of players all decided to connect to the same zone it would put all of the stress on 1 server.

If you tried to spread the load across multiple servers then you'd run into problems of having to share information between the servers (Such as if player X was connected to sever 1 then all of his movements would also have to be passed on to the players connected to server 2 since server 1 and 2 are managing the load for the same zone).

So I was wondering how do you go about solving this problem? Do you just keep on ramping up the specs for the server on heavily populated zones? Or is there a fast and efficient way for multiple servers to manage the load for the same zone and efficiently share data between the two servers?

sentences:
Read access violation, pointer was nullprt Im trying to figure out how to use pointers to make a single instance of an object that in this example will just change direction on x-axis.

Splav.h (eng. Paddle.h)

#pragma once
#include "SDL.h"
#include "Prikazi.h"

class Prikazi;

class Splav
{
private:
    int splavTrenutniX = 0, splavTrenutniY = 0; //current x and y axis position of the paddle
    int splavPocetniX, splavPocetniY; //starting position of paddle

public:

    Prikazi *pr; //pointer to the Prikazi (eng. Draw) class

    SDL_Rect rectSplav; //Rect used to store texture of paddle

    Splav(); //default constructor, used to initialize paddle for 1st load or reset
    Splav(int trenutniX, int trenutniY); //overload constructor where current x and y points on axis become points on paddle movement

    void gibanjeSplavi(); //move the paddle

};

Splav.cpp (eng. Paddle.cpp)

#include "Splav.h"

Splav::Splav()
{
    splavPocetniX =pr->sirinaEkrana / 2; //sirinaEkrana = Screen width
    splavPocetniY = pr->visinaEkrana - pr->visinaSplavi; // screen height- paddle height

    rectSplav.x = splavPocetniX;
    rectSplav.y = splavPocetniY;
    rectSplav.w = pr->sirinaSplavi;
    rectSplav.h = pr->visinaSplavi;
}

Splav::Splav(int trenutniX, int trenutniY)
{

    splavTrenutniX = trenutniX;
    splavTrenutniY = trenutniY;

    gibanjeSplavi();
}

void Splav::gibanjeSplavi() //when paddle starts to move
{
    const Uint8 *tipka = SDL_GetKeyboardState(NULL);

    if (tipka[SDL_SCANCODE_A] && rectSplav.x > 0)
        rectSplav.x--;

    if (tipka[SDL_SCANCODE_D] && rectSplav.x < 1280-pr->sirinaSplavi) //1280-200(paddle width)
        rectSplav.x++;
}

Prikazi.h (eng. Draw.h)

#pragma once

#include "SDL_image.h"
#include "Splav.h"

class Splav;

class Prikazi
{

private:

    SDL_Window * ekran = NULL;
    SDL_Renderer *renderer;

    SDL_Texture *pozadina;
    SDL_Texture *splav;
    SDL_Texture *loptica;

    SDL_Rect rectPozadina;

public:

    Splav *sp ;

    const int sirinaEkrana = 1280, visinaEkrana = 720; //screen width and height
    const int sirinaSplavi = 200, visinaSplavi = 10; //paddle width and height

    Prikazi();
    ~Prikazi();

    void crtajPocetno();

    SDL_Rect initRect(int x, int y, int sirina, int visina);
};

Prikazi.cpp (eng. Draw.cpp)

#include "Prikazi.h"

Prikazi::Prikazi()
{

    ekran = SDL_CreateWindow("Breakout", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, sirinaEkrana, visinaEkrana, SDL_WINDOW_SHOWN);
    renderer = SDL_CreateRenderer(ekran, -1, 0);
    pozadina= IMG_LoadTexture(renderer, "Assets/pozadina1.png");
    loptica = IMG_LoadTexture(renderer, "Assets/loptica.bmp");
    splav = IMG_LoadTexture(renderer, "Assets/splav.bmp");

    rectPozadina = initRect(0, 0, sirinaEkrana, visinaEkrana);

//this is where I get nullptr value
    sp->rectSplav = initRect(sp->rectSplav.x, sp->rectSplav.y, sirinaSplavi, visinaSplavi);

    crtajPocetno();
}

Prikazi::~Prikazi()
{
    //SDL_DestroyWindow(ekran);
}

void Prikazi::crtajPocetno()
{
    SDL_RenderClear(renderer);
    SDL_RenderCopy(renderer, pozadina, NULL, &rectPozadina);
    SDL_RenderCopy(renderer, splav, NULL, &(sp->rectSplav));

    SDL_SetRenderTarget(renderer, pozadina);
    SDL_SetRenderTarget(renderer, splav);

    SDL_SetRenderTarget(renderer, NULL);
    SDL_RenderPresent(renderer);

}

SDL_Rect Prikazi::initRect(int x, int y, int sirina, int visina)
{
    SDL_Rect r;
    r.x = x;
    r.y = y;
    r.w = sirina;
    r.h = visina;

    return r;
}

My question is: How to define that pointer so I can just use it to store Rect coordinates to my Prikazi class (eng. Draw) so It can use that info to render it on the screen? Same question goes to creating Prikazi pointer inside Splav.h ( so I can use constants for screen height, width etc. )

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 wrong with my specular phong shading I'm sorry if this should be placed on stackoverflow instead however seeing as this is graphics related I was hoping you guys could help me:
I'm attempting to write a phong shader and currently working on the specular. I came acros the following formula: base*pow(dot(V,R),shininess) and attempted to implement it (V is the posion of the viewer and R the reflective vector). This gave the following result and code:

Vec3Df phongSpecular(const Vec3Df & vertexPos, Vec3Df & normal, const Vec3Df & lightPos, const Vec3Df & cameraPos, unsigned int index)
{
    Vec3Df relativeLightPos=(lightPos-vertexPos);
    relativeLightPos.normalize();
    Vec3Df relativeCameraPos= (cameraPos-vertexPos);
    relativeCameraPos.normalize();
    int DotOfNormalAndLight = Vec3Df::dotProduct(normal,relativeLightPos);
    Vec3Df reflective =(relativeLightPos-(2*DotOfNormalAndLight*normal))*-1;
    reflective.normalize();
    float phongyness= Vec3Df::dotProduct(reflective,relativeCameraPos);
    if (phongyness<0){
        phongyness=0;
    }
    float shininess= Shininess[index];
    float speculair = powf(phongyness,shininess);
    return Ks[index]*speculair;
}

I'm looking for something more like this:

sentences:
Game input display is slow I'm trying to build a very small example to run input logic but i'm facing a small issue. The code below is runnable with MonoGame v3.7.0.1708.

My problem is that whenever you press a key (here the example is for the D key) i'm displaying a small text on the console.

But you will see if you run the code that the display happens with lag. When i press the "D" key on my keyboard, the message is displayed only ~200ms after the input.

You can for example do a fast press on the keyboard and the message will be displayed after the release of the key.

Does anyone have any idea why it's happening? Thanks!

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;

namespace TestProject
{
public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    GameInput gameInput;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        gameInput = new GameInput();
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent() {}

    protected override void UnloadContent() {}

    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();
        base.Update(gameTime);
        gameInput.Update();
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
    }
}

public class GameInput
{
    public bool _dKeyPressed = false;

    public void Update()
    {
        KeyboardState keyState = Keyboard.GetState();
        if (keyState.IsKeyDown(Keys.D))
        {
            if (!_dKeyPressed)
            {
                Console.WriteLine("[GameInput] D key is pressed.");
            }
            _dKeyPressed = true;
        }
        else if (_dKeyPressed)
        {
            Console.WriteLine("[GameInput] D key is released.");
            _dKeyPressed = false;
        }
    }
}
}

sentences:
How to Integrate Unity with Google Play Game Services for iPhone and Android games I want to integrate Google Play Game Services for Apple's iOS and for Android.
How can I do this efficiently?

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:
Fragment Shader Code returns weird values i've implemented a shader that produces a simple Radar Ping given a uniform time input. ShaderToy Proof of concept

Now i implemented this into my real Opengl GLFW GLAD C++ Core4.5Profile NVIDIA GTX960 environment and recieve only weird ouput when i use my own function call.

Why do i recieve such a weird output if i use a function call in opengl glsl?

PS: I have a feeling this has something to do with the precision and the call by value standards of glsl.

Thank you very much for any response, or even a hint where to look for help.

EDIT: The problem was as Kevin van der Velden described.

Result Images:

This is my shader Code:

    #version 330 core

    in vec2 v_TexCoord;
    out vec4 FragColor;

    uniform float u_time;

    // Generates a BnW Ping on normalized 2d coordinate system
    float RadarPing(in vec2 uv, in vec2 center,in  float innerTail,
                   in float frontierBorder, in float timeResetSeconds,
                   in float radarPingSpeed, in float fadeDistance,
                   in float currentTime)
    {
        vec2 diff = center-uv;
        float r = length(diff);
        float timeMod = mod(currentTime, timeResetSeconds) * radarPingSpeed;

        float circle;
        circle += smoothstep(timeMod - innerTail, timeMod, r) * smoothstep(timeMod + frontierBorder,timeMod, r);
        return circle;
    }

    void main()
    {
        //normalize coordinates
        vec2 uv = v_TexCoord; //move coordinates to 0..1
        uv = uv*2.; // translate to the center
        uv += vec2(-1.0, -1.0);
        //uv.x *= iResolution.x/iResolution.y; //correct the aspect ratio

        float color;
        // generate some radar pings
        float fadeDistance = 1.0;
        float resetTimeSec = 5.0;
        float radarPingSpeed = 0.3;
        vec2 greenPing = vec2(0.0, -1.0);

        //WITHOUT FUNCTION CALL
        //vec2 diff = greenPing-uv;
        //float r = length(diff);
        //float moduloTime = mod(u_time, resetTimeSec);
        //color = smoothstep(moduloTime - 0.25, moduloTime, r) * moduloTime + 0.025, moduloTime, r);

        //WITH FUNCTION CALL
        color += RadarPing(uv, greenPing, 0.25, 0.025,  radarPingSpeed, fadeDistance, u_time);

        //OUTPUT
        FragColor = vec4(color, color, color,1.0);
    }

sentences:
trouble in box2d flash with invoking a setLinearVelocity() from inside an eventHandler The set linear velocity doesnt affect a sprite when written inside an event handler.. but if i call setlinear velocity inside the main constructor..ie if the setlinearvelocity is called at the beginning of game code ..it moves..but not when i call it within a event handler..either keypress or mouse,it doesnt work?

Please ..any help would be greatly appreciated

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:
How were cartridge-based games programmed? I'm thinking of like the SNES, N64, Atari... even the DS today, I suppose.

SNES games did not usually take up more than 4 MB of space, and N64 games were usually 32 to 64 MB worth of data.

These days, you can barely compile a "hello world!" program without the resulting compilation generating 1.21 gigabytes!! of data. (Joking aside, files today do take up tons and tons of space compared to some of the technology back then.)

So... how did they do it?

What did they program these games in? ASM? The entire thing in ASM?!
How were graphics created? What technology did they have to create sprite sheets and, in some cases (like the N64), 3D models?
How did they fit so many levels, characters, quests and items on these cartridges? I mean, Super Mario World on the SNES clocks in around 1 MB, and it has 96 exits! Ocarina of Time, Banjo-Kazooie, DK64 and a few other games take up less than 64 MB and had huge worlds, tons of content and 3D models!

Sorry if my questions seem a little out-there, I'm just amazed that a lot of great titles out there managed to fit in such a small storage space.

It's fascinating to me because even tiniest and most trivial of files and games manage to take up at least a few MB, so imagining that huge levels like those in GoldenEye 007 managed to take almost no data at all is mind-blowing.

sentences:
changing depth stencil state in DirectX11 An example from Frank D Luna's 3d Game Programming with Dx11 shows the following effect technique:

technique11 DrawTech
{
pass P0
{
    SetVertexShader(   CompileShader( vs_5_0, DrawVS() ) );
    SetGeometryShader( CompileShader( gs_5_0, DrawGS() ) );
    SetPixelShader(    CompileShader( ps_5_0, DrawPS() ) );

    SetBlendState(AdditiveBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffffffff);
    SetDepthStencilState( NoDepthWrites, 0 );
}
}

Setting depth stencil state, blend states etc (and restoring them to previous state) when the Effects library isn't available is my goal.

I've had a hard time finding examples on this though.  Luna sidesteps the issue by using the effects framework in his book.

To complicate the issue, I'm using DXUT11 (for loading in meshes).

Can anyone help with an example or an svn repository that includes an example?

sentences:
Call native code from Unity iOS build error I created NativeCallProxy.cs in Unity

    public class NativeCallProxy: MonoBehaviour
    {
        [DllImport("__Internal")]
        public static extern void iOSUnloadUnityGame();

        public static void UnloadUnityGame()
        {
#if UNITY_IPHONE
            // Now we check that it's actually an iOS device/simulator, not the Unity Player. You only get plugins on the actual device or iOS Simulator.
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                iOSUnloadUnityGame();
            }
#endif
        }
    }

and created two files in Assets/Plugin/iOS
NativeCallProxy.m

#import <Foundation/Foundation.h>
#import "NativeCallProxy.h"

@implementation UnityBridgeAPI
id<UnityBridgeNativeCallsProtocol> api = NULL;
+ (void) registerAPIForNativeCalls:(id<UnityBridgeNativeCallsProtocol>)proxy {
    api = proxy;
}
@end

and NativeCallProxy.h

#ifndef NativeCallProxy_h
#define NativeCallProxy_h

@protocol UnityBridgeNativeCallsProtocol
@required
- (void)unloadUnityGame;
@end

__attribute__((visibility("default")))
@interface UnityBridgeAPI: NSObject
+ (void) registerAPIForNativeCalls:(id<UnityBridgeNativeCallsProtocol>)proxy;
@end

#endif /* NativeCallProxy_h */

and when I try to compile exported project I get an error in Xcode.

How can I figure out it?

sentences:
Bump mapping Problem GLSL I am having a slight problem with my Bump Mapping project. Although everything works OK (at least from what I know) there is a slight mistake somewhere and I get incorrect shading on the brick wall when the light goes to the one side or the other as seen in the picture below:

The light is on the right side so the shading on the wall should be the other way. I have provided the shaders to help find the issue (I do not have much experience with shaders).

Shaders:

varying vec3 viewVec;
varying vec3 position;
varying vec3 lightvec;
attribute vec3 tangent;
attribute vec3 binormal;
uniform vec3 lightpos;
uniform mat4 cameraMat;

void main()
{

    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = ftransform();

    position = vec3(gl_ModelViewMatrix * gl_Vertex);
    lightvec = vec3(cameraMat * vec4(lightpos,1.0)) - position ;

    vec3 eyeVec = vec3(gl_ModelViewMatrix * gl_Vertex);
    viewVec = normalize(-eyeVec);

}

uniform sampler2D colormap;
uniform sampler2D normalmap;

varying vec3 viewVec;
varying vec3 position;
varying vec3 lightvec;

vec3 vv;

uniform float diffuset;
uniform float specularterm;
uniform float ambientterm;

void main() {

    vv=viewVec;

    vec3 normals = normalize(texture2D(normalmap,gl_TexCoord[0].st).rgb * 2.0 - 1.0);

    normals.y = -normals.y;

    //normals = (normals * gl_NormalMatrix).xyz ;

    vec3  distance = lightvec;
    float dist_number =length(distance);
    float final_dist_number = 2.0/pow(dist_number,diffuset);
    vec3  light_dir=normalize(lightvec);
    vec3  Halfvector = normalize(light_dir+vv);
    float angle=max(dot(Halfvector,normals),0.0);
          angle= pow(angle,specularterm);
    vec3 specular=vec3(angle,angle,angle);
    float diffuseterm=max(dot(light_dir,normals),0.0);
    vec3 diffuse = diffuseterm * texture2D(colormap,gl_TexCoord[0].st).rgb;
    vec3 ambient = ambientterm *texture2D(colormap,gl_TexCoord[0].st).rgb;
    vec3 diffusefinal = diffuse * final_dist_number;
    vec3 finalcolor=diffusefinal+specular+ambient;

    gl_FragColor = vec4(finalcolor, 1.0);

}

sentences: How to implement Ragdoll physics to 2D characters in XNA? I'm starting a new project with XNA. I want to create a game where the main character is subject to ragdoll physics when killed. I was wondering if anyone can give me any tips on how should I implement the character class and apply these ragdoll physics before I start coding so I don't have to refactor my code later. No code is necessary, just a basic overview of an algorithm and some tips. I've found a lot of information about ragdoll physics in 3D but nothig about 2D in XNA.

sentences:
Unity - using Colliders with custom objects Hi so I'm quite new to Unity and currently experiencing issues with colliders, a quick summary of what I have.
Player >
Object = Capsule ( Directly created through Unity )
Components = CharacterController, CapsuleCollider & a PlayerController script

Basic Tile >
Object = Rectangle ( Imported from blender )
Components = BoxCollider

this combination works well, no issues. However when I get to slightly more complex objects, such as elevated terrain I can't apply a box collider because the surface isn't flat. So my next thought was to add a Mesh Collider but unfortunately it doesn't seem to do anything effective ( my player falls through ) I don't know whether that's because Mesh Colliders are only relevant to RigidBodies? Unfortunately though I can't switch from a CharacterController to a RigidBody.
So I'm not sure what to do, maybe MeshColliders are reponsive to a CharacterController and my settings aren't adjusted correctly?

sentences:
How to add multiple transforms to a collection? I have an array of Transforms:

public Transform[] monsterOne;

I can put a child's transform in this array using this code:

monsterOne = child.GetComponents<Transform>();

But if I try to do this in a loop for each child, the next child just replaces the last one, instead of adding to the array:

foreach (Transform child in transform)
{
    monsterOne = child.GetComponents<Transform>();
}

How can I add all of these transforms into one collection?

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:
Constrain parent node transform to child bounds If I have some node rendering tree set up, where a node basically has a draw method to render things, and a transform, represented as a 3x3 matrix, with scale and translation.

Now, I would like to constrain the scale and translation of that node (constrain the transform basically) to the bounds of the child. So if the child is a 300x400 image, I want the root to only scale large enough to see the whole image, not more. So does the translation, that it does not go beyond the image bounds. How can I achieve that? Which sorcery of mathematics must I read about to learn this? Affine transforms or what?

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:
OpenGL Compute Shader Uniforms I am trying to use a compute shader to generate some data in a texture. My compute shader looks something like this:

#version 430
//uniform int u_CurrentMipSize;
const int u_CurrentMipSize = 1024;
layout( r16f ) uniform writeonly image2D u_densityTexture;

bool ContributesSignificantDensity( ivec2 uv )
{
    return uv.x >= ( u_CurrentMipSize / 8 ) && uv.y >= ( u_CurrentMipSize / 8 );
}

//.... in main()
if( ContributesSignificantDensity( targetPosition ) )
{
    imageStore( u_densityTexture, targetPosition, vec4( 1.0 ) );
}
else
{
    imageStore( u_densityTexture, targetPosition, vec4( 0.0 ) );
}

And the calling code looks like this:

glUseProgram( m_DensityGenShader );

glMemoryBarrier( GL_SHADER_IMAGE_ACCESS_BARRIER_BIT );

uniform_loc = glGetUniformLocation( m_DensityGenShader, "u_densityTexture" );
if( uniform_loc != unsigned int( -1 ) )
{
    glBindImageTexture( uniform_loc, m_DensityTexture, 0, false, 0, GL_WRITE_ONLY, GL_R16F );
}
checkOpenGLErrors( "Density Texture Compute Shader" );

uniform_loc = glGetUniformLocation( m_DensityGenShader, "u_CurrentMipSize" );
if( uniform_loc != unsigned int( -1 ) )
{
    glUniform1i( uniform_loc, 1024 );
}
checkOpenGLErrors( "Density Texture Compute Shader" );

int num_to_compute = mip_sizes[ i ] / 16;
glDispatchCompute( num_to_compute, num_to_compute, 1);
checkOpenGLErrors( "Density Texture Compute Shader" );

glMemoryBarrier( GL_SHADER_ACCESS_BARRIER_BIT );

If I use this code, the program executes correctly on my texture of size 1024. I am just storing this result in an image2D. If I use a const float the program executes correctly, and I get a red square in the upper right 7/8ths of the image. (Just rendering this texture onto a quad in another shader). Texture rendered on quad- yay red!

However, if I change the top of my shader to the following by using a uniform instead of a const float:

uniform int u_CurrentMipSize;
//const float u_CurrentMipSize = 1024;

Then the output texture is just garbage, random data: Texture rendered on quad- boo noise!

I'm always sending the uniform from the compiled code (if I get a valid uniform location back from opengl) so the only thing that changed is reading the value from a uniform vs a const float.

Should I be doing something differently with this because it's a compute shader? I've never had issues passing uniform data with vert/frag/geometry shaders?

I had a similar issue trying to do imageLoad operations, so I think I'm not setting up stuff with my compute shader correctly, but it works in the constant hard-coded case, so I'm not sure.

This is my first forray into compute shaders- I've worked with CUDA a bit so I'm familiar with the paradigms, but not sure how to debug if the kernel is crashing or abandoning early or corrupting the texture somehow or what?

sentences: Suggest a simple Java math library for matrix operations for use with OpenGL (lwjgl) I'm writing an OpenGL app with Java. I need to do some math for camera and frustum culling (for AABB). Could you suggest a simple and fast Java math library for that?

sentences:
How do i draw depth complexity(overdraw) in directx 11? I want to read the stencil value in the shader so I can set colors for different depths.

What I understand. Make a loop after the scene is rendered but before is is presented.
so a loop with the number of colors(k) and in the loop, use the code:

 md3dImmediateContext->OMSetDepthStencilState(RenderStates::DrawDepthDSS, k);

This is what I know. What are the other steps? like to send the depth to the shader?

..I have this code for the shader

   Texture2D<uint> txStencil : register (t0); // set the corresponding register
float4 PSStencil(float4 pos: SV_Position) : SV_Target
{
    uint stencil = txStencil.Load(int3(pos.xy, 0));

    // debug output
    if (stencil == 1) return float4(0, 1, 0, 1);
    else return float4(0, 0, 0, 0);
}

But how do I send the shader the stencil value?

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:
Unity IUnityLifecycleManager already exists I followed this tutorial https://www.youtube.com/watch?v=OElh7wda4Qc in Unity version 2019.3.1f.1 Personal Edition, but I got 6 errors like this in the console, also I updated to version 3.4.4 via the package manager, because it said that the asset store version was not compatible anymore.

  Library\PackageCache\com.unity.ads@3.4.4\Runtime\Monetization\AndroidPlacementContentOperations.cs(55,40): error CS0433: The type 'IUnityLifecycleManager' exists in both 'UnityEngine.Advertisements.Editor, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Advertisements, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null'

This is the code I am using, its the same as the code in the official website, but personalized to my project.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;

public class adsController : MonoBehaviour, IUnityAdsListener
{
    public bool testMode = true;
    public Button rewardedAd;

    private string storeID = "3509232";

    private string rewardedVideo = "rewardedVideo";

    private void Start()
    {
        rewardedAd.interactable = Advertisement.IsReady(rewardedVideo);
        rewardedAd.onClick.AddListener(ShowRewardedVideo);

        Advertisement.Initialize(storeID, testMode);
    }

    private void Update()
    {

    }

    private void ShowRewardedVideo()
    {
        Advertisement.Show(rewardedVideo);
    }

    // Implement IUnityAdsListener interface methods:
    public void OnUnityAdsReady(string placementId)
    {
        // If the ready Placement is rewarded, activate the button:
        if (placementId == rewardedVideo)
        {
            rewardedAd.interactable = true;
        }
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        // Define conditional logic for each ad completion status:
        if (showResult == ShowResult.Finished)
        {
            // Reward the user for watching the ad to completion.
            Debug.Log("Reward");
        }
        else if (showResult == ShowResult.Skipped)
        {
            // Do not reward the user for skipping the ad.
            Debug.Log("Not Reward");
        }
        else if (showResult == ShowResult.Failed)
        {
            Debug.LogWarning("The ad did not finish due to an error.");
        }
    }

    public void OnUnityAdsDidError(string message)
    {
        // Log the error.
    }

    public void OnUnityAdsDidStart(string placementId)
    {
        // Optional actions to take when the end-users triggers an ad.
    }
}

EDIT:
Looks like I forgot a line in the code and reinstalling the unity ads package now it runs but still gives this warning.

  Please consider upgrading to the Packman Distribution of the Unity Ads SDK.  The Asset Store distribution will not longer be supported after Unity 2018.3

sentences:
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:
Most efficient 3d depth sorting for isometric 3d in AS3? I am not using the built in 3d MovieClips, and I am storing the 3d location my way.

I have read a few different articles on sorting depths, but most of them seem in efficient.

I had a really efficient way to do it in AS2, but it was really hacky, and I am guessing there are more efficient ways that do not rely on possibly unreliable hacks.

What is the most efficient way to sort display depths using AS3 with Z depths I already have?

sentences:
Can't use the hardware scissor any more, should I use the stencil buffer or manually clip sprites? I wrote a simple UI system for my game. There is a clip flag on my widgets that you can use to tell a widget to clip any children that try to draw outside their parent's box (for scrollboxes for example). The clip flag uses glScissor, which is fed an axis aligned rectangle. I just added arbitrary rotation and transformations to my widgets, so I can rotate or scale them however I want. Unfortunately, this breaks the scissor that I was using as now my clip rectangle might not be axis aligned.

There are two ways I can think of to fix this: either by using the stencil buffer to define the drawable area, or by having a wrapper function around my sprite drawing function that will adjust the vertices and texture coords of the sprites being drawn based on the clipper on the top of a clipper stack. Of course, there may also be other options I can't think of (something fancy with shaders possibly?). I'm not sure which way to go at the moment.

Changing the implementation of my scissor functions to use the stencil buffer probably requires the smallest change, but I'm not sure how much overhead that has compared to the coordinate adjusting or if the performance difference is even worth considering.

sentences:
3D camera - window resolution relation I'm having a bit of an issue when it comes to 3D- and 2D camera(s), in relation to a game's window resolution.
I want to let the player choose from different window resolutions, either from a menu or by just resizing the window by dragging the window border, and can't get the scaling of the graphics to work properly.
In games I've played, I can go into the options menu, choose a screen resolution and then the window resize itself and the graphic's, menu buttons etc just scales up to the correct sizes.

At the moment, I've tried two different window resolutions; 800x600 and 1280x720 (don't mind
the different aspect ratios).

800x600

1280x720

As you can see, more of the game world can be seen (more stone tiles can be seen, if that makes sense) in the window with a resolution of 1280x720 and I want my 3D/2D game(s) to be resolution independent and that the same amount of the game world to be seen, independent of what window resolution the player chooses to use.

My camera class consist of:

Camera matrix - used to translate and rotate my camera
View matrix - the inverse of the camera matrix
Perspective matrix - see code below
View projection matrix - view matrix * perspective matrix
Fov - 45.0f
Aspect ratio - camera width / camera height

Note: row-major matrices

Perspective matrix:

const float Tangent     = 1.0f / tanf(DEGREES_TO_RADIANS(Fov * 0.5f));
const float NearToFar   = FarClip - NearClip;

PerspectiveMatrix(Identity);

PerspectiveMatrix[0]    = -Tangent / AspectRatio;
PerspectiveMatrix[5]    =  Tangent;
PerspectiveMatrix[10]   =  FarClip / NearToFar;
PerspectiveMatrix[11]   =  1.0f;
PerspectiveMatrix[14]   = (-NearClip * FarClip) / NearToFar;
PerspectiveMatrix[15]   =  0.0f;

At each update, I'm also setting the viewport by calling glViewport(0, 0, CameraWidth, CameraHeight).
This might change in the future if I decide to make two cameras in a game, for a splitscreen game for example.

How can I solve the window resolution independence issue?

I have though about creating a framebuffer the size I want, attach it to a quad and then render the quad the size of the window, which will scale up/down the framebuffer if the window is bigger/smaller than the framebuffer's original size, but if it's an easier way of doing it, I would gladly use that instead.

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:
Where to start the coding of online leaderboards? I NEVER, EVER did ANY sort of network code in C++, I don't know even the libraries that exist, but a popular demand for my game is online leaderboards...

So, what sort of libraries I should research into?

My game is multiplatform (win, gnu, mac), uses C++, ClanLib 1.0 and Lua. Also the engine is zlib (so proprietary stuff that I cannot release source don't work)

sentences:
Enabling Unity GUI drawtexture permanently? I'm trying to get an image to show in Unity based on a certain criteria.
I would like the position of the image to be randomized every time on play.

However since GUI.DrawTexture shows the image for a single frame only, I end up with the image flashing across the screen in random areas. I would the first location to be randomized and the image to remain still there.

Any advice on how to perform this will be greatly appreciated.

Code:

void OnGUI(){
 if(HP>=0.9f){
   GUI.DrawTexture(new Rect (Random.Range(0,1000), Random.Range(0,700), 500, 300) aTexture);
  }
}

sentences:
Can you access the vertices passed into GLSL as an array? So in the vertex shader I receive my vertex data as:

layout(location = 0) in vec3 position; //(x,y,z) coordinates of a vertex
layout(location = 1) in vec3 norm; //a 3D vertex representing the normal to the vertex
layout(location = 2) in vec2 texture_coordinate; // texture coordinates

In particular I would like to access the first 2 fields as if they were arrays (Imagine an SSBO).

The reasoning for this is because I need the mesh information not only to render the mesh itself but also to shade (shadows). An obvious solution is to simply pass the mesh data as well as an SSBO, but this means that now I have passed twice the same information into the GPU once as vertices for rendering and once as mesh data.

I would like to be able to access all the vertex data as if it was an array, is this possible?

sentences:
PhaserJS: Detecting intersection I'm making a card game to get my legs with phaser. I have an row of overlapping, face down cards. I want to detect when any card is covered by another card.

The deck is shuffled before being placed on the board, so the order is known card[1] thru card[54]. It goes card.events.onInputDown.add(tap, this) on each card during setup to detect interaction, and then calls tap(this):

function tap(pointer){
    console.log(pointer.z);
    let zpos = pointer.z
    if (Phaser.Rectangle.intersects(pointer, *abovecard*)) {
        console.log("covered");
    } else {
        pointer.play("front"); // anim to show the card back
    }
}

(abovecard is asterisked as a placeholder because I'm not sure what to put there)

A simple boundary overlap check seems to be the model to use. But when I go abovecard = card[zpos + 1], it doesn't see a card above it. Even when I do in the console Phaser.Rectangle.intersects(card[37], card[38]), which are visibly overlapping, it says false.

Primary question: What am I missing here?

2ndary question: Is there a better way, than what I've described, to detect if one sprite is overlapping another sprite (whether the other sprite is known or not)?

sentences:
per pixel based collision detection I was wondering if anyone had any ideas on how to get per pixel collision detection for the android.  I saw that the andEngine has great collision detection on rotation as well but couldn't see where the actual detection happened per pixel. Also noticed a couple solutions for java, could these be replicated for use with the Android SDK?

Maybe someone here has a clean piece of code I could look at to help understand what is going on with per pixel detection and also why when rotating it is a different process.

EDIT:
Here is something I am working with right now.
public void getBitmapData(Bitmap bitmap1, Bitmap bitmap2){
     int[] bitmap1Pixels;
     int[] bitmap2Pixels;

    int bitmap1Height = bitmap1.getHeight();
    int bitmap1Width = bitmap1.getWidth();
    int bitmap2Height = bitmap2.getHeight();
    int bitmap2Width = bitmap2.getWidth();
    bitmap1Pixels = new int[bitmap1Height * bitmap1Width];
    bitmap2Pixels = new int[bitmap2Height * bitmap2Width];

    bitmap1.getPixels(bitmap1Pixels, 0, bitmap1Width, 1, 1, bitmap1Width - 1, bitmap1Height - 1);
    bitmap2.getPixels(bitmap2Pixels, 0, bitmap2Width, 1, 1, bitmap2Width - 1, bitmap2Height - 1);

}

sentences:
How to flip a BC6/BC7 texture? I have some code to load DDS image files into OpenGL textures, and I'd like to extend it to support the BC6 and BC7 compressed formats introduced in D3D11. Since DirectX and OpenGL disagree about whether a texture's origin is in the upper-left or lower-left corner, my DDS loader flips each image's pixels along the Y axis before passing the pixels to OpenGL.

Flipping compressed textures presents an additional wrinkle: in addition to flipping each row of 4x4-pixel blocks, you also need to flip the pixels within each block. I found code here to flip BC1/BC2/BC3 blocks, and from the block diagrams on MSDN it was easy to adapt the BC3-flipping code to handle BC4 and BC5. The BC6 and BC7 formats look significantly more intimidating, though. Is there a similar bit-twiddling trick to flip these formats, or would I have to fully decompress and recompress each block?

UPDATE: It turns out the texture flip was only necessary because my texture coordinates were being incorrectly inverted at export time. Removing both flips made the code both simpler and faster (thanks Humus!). Flipping BC6/BC7 blocks may still be an interesting challenge, but it's no longer relevant to my original scenario.

sentences:
What is actually moving in an endless runner? For example the famous Flappy Bird game, or anything that sort really,
is the player(in this case the bird, or the camera whichever you prefer) moving forward or is the whole world moving backwards(the bird only changes Y position and has a constant X position)?

sentences:
Change axis to view world from above in Unity Developing a 2d game where you view the "table" from above (think of a card game being played on a table).  I have a candlestick on the table, but I must have something wrong because when I run it, it thinks it's on a wall versus a table because the flame goes up to the top versus "at" the camera from above.

Here's the code of that "LookAt" script:

public class CameraFacing : MonoBehaviour
{
public Camera cameraToLookAt;
void Awake() {
    cameraToLookAt = Camera.main; }
void Update()
{
    Vector3 v = cameraToLookAt.transform.position - transform.position;
    v.x = v.z = 0.0f;
    transform.LookAt(cameraToLookAt.transform.position - v);
}
}

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:
Abstract games that are hard to play for AI/computer? Do you know any abstract multi- or single-player game that is hard to play for AI/computer but not so hard for humans?

Being simple and popular is better.

sentences:
Should I make a FPS game on Fixed Function Pipeline or Programmable Pipeline OpenGL? I have a “FPS” game I have programmed in Fixed Function Pipleline and one made in Programmable pipeline OpenGL. While the programmable pipeline has lots of weird things that you can edit, it does not have glLoadIdentity that I need for the gun to be attached to the camera. There is little to no information on this subject and most of the information that I can find is in the fixed function pipeline rather than the programmable one. Keep in mind that with the fixed function pipeline, I can just use the glloadidentity function and attach it then move on to another thing. On the programmable one, I don’t know how to do this, so I have spent a whole week looking up how I can do it.

Should I just use the fixed function pipeline one and abandon the programmable pipeline?

What shall I do?

Thanks!

sentences:
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:
Kinematic equations script fail I added the kinematic equations to my code and now none of it works.   I get the error rigidbody.torque assign attempt for 'Enemy' is not valid. Input torque is { 0.000000, NaN, 0.000000 }.
UnityEngine.Rigidbody:AddTorque(Vector3)
EnemyBehavour:FixedUpdate() (at Assets/_Scripts/Baddies/EnemyBehavour.cs:61)

it should be fine as far as I can tell, please help.

//speed of enemy
public float speed = .5f;
//base distance enemy will attack player
public float range = 3f;
//how far back enemy will stand
public float stopDistance;
//what the enemy will pursue
private GameObject target;
//targetable Enemies
private GameObject[] targetable;
//itself
private Rigidbody self;
//distance to check against
private float saveDistance;
//get the mass for physics stuff
float mass;
//gets drag for physics
float drag;
//gets angular drag for physics
float adrag;
//checks distance
float distance;
//the player
GameObject player;
GameObject[] turrets;
//the base
GameObject playerBase;
EnemyShoot Shoot;

void Start () {
    //get own rigidbody
    self = GetComponent<Rigidbody> ();
    //playerbase should be obviouse
    playerBase = GameObject.FindGameObjectWithTag ("Base");
    target = playerBase;

    Shoot = GetComponentInChildren<EnemyShoot> ();

    mass = self.mass;
    drag = self.drag;
    adrag = self.angularDrag;
}

void FixedUpdate () {
    target = FindFoe ();

    //checks range and
    if (Vector3.Distance (transform.position, target.transform.position) > range || target == playerBase) {
        target = playerBase;
    }
    Vector3 acceleration = AnglularAcceleration ();
    Vector3 torque = new Vector3 (0f, acceleration.y * mass,0f);
    print (torque.ToString ());

    //look at the pursueing target
    self.AddTorque (torque);
    //move towards the pursuing target
    self.AddForce (transform.forward * speed);

}

Vector3 AnglularAcceleration () {
    // the variables to figure out
    Vector3 AnglAcc;
    float radius;
    Vector3 theta;
    float time;

    //get the radius
    radius = Vector3.Distance (transform.position, target.transform.position);
    //get the dot product between the two points
    float dot = Vector3.Dot (new Vector3 (transform.position.x, 0f, transform.position.z),new Vector3 (target.transform.position.x, 0f, target.transform.position.z));
    //get the arccosine of the angle and convert that to radians
    theta = new Vector3 (0,(Mathf.Acos(dot))*180,0);
    print (theta.ToString ());

    //now find the time
    time = (2f * theta.y) / speed;
    AnglAcc = new Vector3(0f,(speed * speed) / (2f * theta.y),0f);

    return AnglAcc;

}

//checks if turrets or player is within range
GameObject FindFoe() {
    distance = range;
    targetable = GameObject.FindGameObjectsWithTag ("ETarget");

    //sets player base as default target

    foreach (GameObject test in targetable) {
        GameObject testing = test.transform.parent.gameObject;
        print (testing.ToString());
        saveDistance = Vector3.Distance (transform.position, testing.transform.position);
        if (saveDistance < distance) {
            distance = saveDistance;
            print (saveDistance.ToString());
            target = testing;
        }

    }
    return target;

}

}

sentences:
How does one go about offering a mobile game, or offering all in-app purchases to backers? I am planning on trying to get my android game kickstarted. Of course, it's too early in development, and I will wait on until 60% done to do the kickstarter.

Some of the rewards I am hoping to give my backers are:

The android game without having to pay
All in-app purchases unlocked for them

Since the google Play store (or other market places) would be where I would put my game up, how would I be able to reward my backers?

I could give them an apk, but I would want them to enjoy the freedom of downloading from play store, getting automatic updates, re-installing whenever they want etc.

I am hoping some of you have done something similar and can shed some light on how one goes about this?

Thank you.

sentences:
Why does Unity show dark regions on a model with animation created using Blender? I sculpted a model in blender, and I want to import that to Unity. When I import just the model(without animation), Unity shows as is. However, when I attach armature to the body and automatically assign  weights to it with the intention of creating an animation, Unity import shows dark regions all over the model. All the face normals look fine. I am not sure what the issue is.
Model in Blender:

Weights:

Dark patches in Unity:

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: Making color of sprite darker or lighter Is there any way to make a sprite darker or lighter in AndEngine? I dont want to use the alpha thing. Nor I want to loose the texture/design of the image.

sentences:
How to change the time dilation using C++ in Unreal Engine? I searched a bit and found a blueprint solution which does this but I've just started using Unreal and I prefer C++ instead of this visual programming thingy.

I'm looking for a Unity-like Time.timeScale property which could be easily set during runtime.

Is there a thing like that in Unreal?
I just want to play with changing the speed of time of the whole world.

sentences:
Android, how important is deltaTime? Im making a game that is getting pretty big and sometimes my thread has to skip a frame, so far I'm not using deltaTime for setting the speed of my different objects in the game because it's still not a big enough game for it to matter imo. But its getting bigger then I planned, so my question is, how important is delta Time?

If I should use delta time there is a problem, since speedX and speedY are integers(they have to be for eclipse to let you make a rectangle of them), I cant add delta time very functionally as far as I understand, but might be wrong?
Ive tried adding deltaTime to the code below, and sometimes my enemies just not move after spawn, they just stand there and run in the same place

Will add an some code for how I set / use speed:

     public void update(int dx, int dy) {
        double theta = 180.0 / Math.PI * Math.atan2(-(y - controls.pointerPosition.y), controls.pointerPosition.x - x);

        x +=dx * Math.cos(Math.toRadians(theta));
        y +=dy * Math.sin(Math.toRadians(theta));
    currentFrame = ++currentFrame % BMP_COLUMNS;
}

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

So if someone with some experience with this has any thoughts, please share. Thank you!

Changed code:

    public void update(int dx, int dy, float delta) {
        double theta = 180.0 / Math.PI * Math.atan2(-(y - controls.pointerPosition.y), controls.pointerPosition.x - x);
        double speedX = delta * dx * Math.cos(Math.toRadians(theta));
        double speedY = delta * dy * Math.sin(Math.toRadians(theta));
        x += speedX;
        y += speedY;
    currentFrame = ++currentFrame % BMP_COLUMNS;
}

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

with this code my enemies move like before, except they wont move to the right (wont increment x), all other directions work.

sentences:
How to move sprite as if not rotated when rotated 90 degrees? We're making a Tetris like game and need help rotating shapes.

Moving the shape works when there is no rotation.

However, after rotation, snapping the shape to the grid fails because the vector between the shape's current position and destination is affected by the amount of rotation (e.g., rotated 90 degrees).

As a simple example, let's assume a shape consists of one square and currently sits at (8, 0).

If the user rotates the shape 90 degrees (ignore that this functionally does nothing since the shape is only one square) then wants to move the shape to (1,0), what should the vector be? And how do you generalize the vector math?

We're using Swift 3 for an iOS game.

    if isShapePosValid(shape: curShape) {
        let firstTile = curShape.getLowestTile()
        let nearestBoardTile = getNearestBoardTile(shapeTile: firstTile)!
        let newTilePos = firstTile.parent!.convert(nearestBoardTile.position, from: nearestBoardTile.parent!)
        let moveVector = CGVector(point: newTilePos - firstTile.position)
        let move = SKAction.move(by: moveVector, duration: 0.1)
        curShape.run(move) {
            self.printShapeToBoard(shape: curShape)
        }
    }

fileprivate func rotateShape(shape: BoardShapeSprite) {
    let rotate = SKAction.rotate(byAngle: CGFloat(Double.pi/2), duration: 0.1)
    shape.run(rotate)
}

fileprivate func printShapeToBoard(shape: ShapeSprite) {
    let tiles = shape.getTiles().filter{ $0.value != .Empty }

    for t in tiles {
        let boardTile = getNearestBoardTile(shapeTile: t)
        boardTile?.setValue(value: .Taken)
    }
}

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:
Can I create mods for a D3D game made in C#? There is a game currently in development in C# (using Direct3D for graphics) that I want to make mods for.

Ideally, I would like to make the mods in C#, but after that I am lost. How would I (or other people) put the finished mod into their version (client) of the game? I know that for Java this is pretty simple (as shown by all the Minecraft mods in the wild) but is it harder (or even possible) for a language like C#? Is there something special the devs have to do to make sure modding is possible?

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:
Google Cloud Messaging (GCM) for turn-based mobile multiplayer server? I'm designing a multiplayer turn-based game for Android (over 3g).  I'm thinking the clients will send data to a central server over a socket or http, and receive data via GCM push messaging.
I'd like to know if anyone has practical experience with GCM for pushing 'real-time' turn data to game clients.  What kind of performance and limitations does it have?

I'm also considering using a RESTful approach with GAE or Amazon EC2.  Any advice about these approaches is appreciated.

sentences:
Simple collision detection for 2D match 3 gems game I'm building simple match 3 game.
I have the parts where I move the gems with the mouse only in the straight X or straight Y, up and down and both sides, no 45 degrees movements on grid.
I'm looking for simple collision detection algorithm for the situation when for example:

a gem is moved up or down or left or right and there is another gem.
How can it detect it touched a gem and which gem it is?

sentences:
Tips on how to architect your JavaScript game with classes OK, so I'm creating a <canvas> game using JavaScript (ES6+) features like Classes. It's straight from the vue-cli and webpack.

So, I have these Classes with the following (and such) variables

class Player {
    this.x = 1;
    this.y = 5;
    this.name = 'Guy';
    this.stats = [];
}

class Map {
    this.level = 1;
    this.config = {};
    this.images = Image();
    this.canvas = null;
    this.context = null;
    this.board = []; // From a tileset
}

// POINT OF ENTRY STARTS HERE
// const game = new Game();
class Game {
    this.map = null;
    this.player = null;
    this.assets = Images();
}

The problem I'm having is that sometimes, I'm having to access a created object that was instantiated elsewhere.

For example, this.player was instantiated inside the Game class. But in the Map class, I have the drawMouseSelection method where it needs the current Player's X and Y and Map's board array of tiles.

For example, I pass the all of board[2500] to a static helper method in UI class to get the correct tile hovered on.

** What I am doing**

I just pass the whole object and deal with it as such. Am I passing too big of objects?

sentences:
Android, apply a pixelshader on a canvas Can an opengl pixelshader be applied on a Canvas?

I want to render a bitmap on a canvas, then apply a pixelshader to get, for example, a blur effect. Is this possible?

I don't want to simulate the blur effect by creating a new bitmap and then blur this from java code because i'd like to be able to re-use the shaders in openGL apps too.

sentences:
SDL 2.0 OpenGL not drawing anything except background My 'hello triangle' compiles well, no errors, but doesn't drawing anything. Here's my code:

main.cpp

#include "src/App.h"

int main( int argc, char* args[] )
{
    App app(600, 400, false);
    app.Run();
    return 0;
}

App.h

#ifndef APP_H
#define APP_H

#include <SDL.h>

class App
{
public:
    explicit App(size_t win_width, size_t win_height, bool fullscreen_mode)
            : m_window_width(win_width), m_window_height(win_height),
            m_fullscreen(fullscreen_mode) {
        };

     void Run();

private:
    void Draw();
    void Update(double dt);
    void Resize(size_t width, size_t height);
    void ProcessEvents();

private:
    size_t m_window_width;
    size_t m_window_height;
    bool m_fullscreen;
    bool is_done;
    SDL_Window* m_window;
    SDL_GLContext m_glcontext;
};

#endif // APP_H

App.cpp

#include "../App.h"
#include <SDL_opengl.h>
#include <cassert>

void App::Run()
{
    SDL_Init(SDL_INIT_VIDEO);
    m_window = SDL_CreateWindow("Okno gry",
                                SDL_WINDOWPOS_CENTERED,
                                SDL_WINDOWPOS_CENTERED,
                                m_window_width, m_window_height,
                                SDL_WINDOW_OPENGL | (m_fullscreen?SDL_WINDOW_FULLSCREEN:SDL_WINDOW_RESIZABLE));

    m_glcontext = SDL_GL_CreateContext(m_window);
    Resize(m_window_width, m_window_height);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);

    glClearColor(0, 0, 1, 0);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_EQUAL);

    is_done = false;
    size_t last_ticks = SDL_GetTicks();
    while(!is_done)
    {
        ProcessEvents();

        size_t ticks = SDL_GetTicks();
        double delta_time = (ticks - last_ticks) / 1000;
        last_ticks = ticks;

        if (delta_time > 0 )
        {
            Update(delta_time);
        }

        Draw();
    }
    SDL_Quit();
}

void App::Draw()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glBegin(GL_TRIANGLES);
    {
        glColor3f(1, 1, 0);
        glVertex2f(1, 1);
        glVertex2f(0, 1);
        glVertex2f(0, 0);
    }
    glEnd();
    SDL_GL_SwapWindow(m_window);
}

void App::ProcessEvents()
{
    if (is_done) return;

    SDL_Event event;
    while (SDL_PollEvent(&event))
    {
        if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
        {
            Resize(event.window.data1, event.window.data2);
        }
        else if (event.type == SDL_QUIT)
        {
            is_done = true;
            break;
        }
    }
}

void App::Resize(size_t width, size_t height)
{
    m_window_width = width;
    m_window_height = height;

    glViewport(0, 0, static_cast<int>(width), static_cast<int>(height));
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrtho(0, 1, 0, 1, -1, 10);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

void App::Update(double dt)
{
    //printf("%d", dt);
}

Can anyone help? I don't know why it's not running.

sentences:
UDK and Protocol Buffers Actually two questions:

Can I use TCP sockets in UDK to implement my own networking protocol? (I guess TCPLink is an answer)
Is there any way I can user Protocol Buffers inside UDK? Or anything like that? (i.e. thrift, bson)

sentences:
How to combine the camera that follows the player and the camera shake effect in Unity? I need to combine both camera that follows the player and the camera shake effect in the same moment. The problem is in that, if I make the shake effect for the camera, then the camera doesn't follow the player and if I make the camera follow the player, then the shake effect doesn't appear. The basic idea of my script is next:`

Vector3 originalPos;
GameObject targetPlayer;
bool canShake;
void OnEnable()
 {
     originalPos = camTransform.localPosition;
 }

 void Update()
 {
         // Camera shakes
     if (CanShake)
     {
         transform.localPosition = originalPos + Random.insideUnitSphere * shakeAmount;
     }
         // Camera follows the player
     else
     {
         transform.position = new Vector3(targetPlayer.transform.position.x, transform.position.y, transform.position.z;
     }
 }

Does anyone have ideas how to combine these two things (camera shake effect and camera that follows the player) at the same moment?

sentences:
How to implement a system like the draft from NFL/NHL/NBA for an mmo? I want to build a soccer manager mmo and I'm currently thinking about how to get young players into the game.
The classic way would be to invest into the youth and produce better youth players each season. But that's kinda oldschool.
I'd rather implement a draft-like system that has a pool of young players and the teams can choose one of them.
Now since the users aren't necessarily online when they should be, it needs to be built in a way, that the draft takes place maybe over the whole season, but the players are available to the teams the season after.
There are a couple of questions that still need to be answered.
Like how to handle multiple leagues? Can all choose from the same pool or does every league have its own pool of players to choose from?
How would you do it?

sentences:
Making the player fall below the actual map I have a 2d map of integers

0000000000
0200000001
1111100011

0 = sky/empty
1 = ground
2 = player

When player falls in a hole/cliff I want the player to go below the map, so it will look like the player had died by falling in the hole/cliff.

Here is what I did:

if(player.getY()+player.getHeight() > map.getHeight()){
   //player has fallen in hole/clifff
}

The code above will test if the player's feet touch the end of map. But how to move him below the map?
Because if I move the player down then the array will be out of bounds.

Is there way without changing the map array?

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:
Swapping in game currency for virtual goods. Client vs server. Best practice I currently use a server back end to verify my managed in app currency purchases and update the user's coin value.

But what's the best practice to then deal with "in game purchases" where players swap their coin for virtual goods such as power ups etc.

I just realised that if I do it in the app then potentially a hacker could just remove the code so that they can buy some coins once then just perpetually buy whatever virtual goods they want.

Should I let my server back end deal with this instead, which would definitely solve the problem. Is this the best practice?

sentences:
Procedural Islands Voronoi Pattern I'm trying to keep this as simple as possible, as I've found out the last few days this is a very difficult topic. I'd like to generate multiple flat islands, formed by a voronoi diagram. I've followed a long and (for me) difficult tutorial of building a procedural hexagonal grid just to find out it looks to artificial.

I'd like to create a plane with faces divided in a voronoi diagram, and extrude multiple groups upwards to create islands. With that I'd like to achieve something similar as this: http://applemagazine.com/wp-content/uploads/2015/10/image2.jpg

Please help to get me started in the right direction, since my approach might be wrong in itself.

EDIT:

I've found this: https://github.com/jceipek/Unity-delaunay. Which draws lines in a voronoi diagram. Now I'm guessing the next step is to convert this to a mesh. Then I'd have to highlight random faces to be extruded to create the islands. Maybe this could be done with perlin noise, which I've just learned about. Extruding might not be the best way. Maybe deleting the faces that won't be land, and creating fall of edges (Like Wardy said).  I'm doing my best to figure this out on my own, but any help is greatly appreciated.

sentences:
With this MMOG architecture, how can I avoid losing games when the server goes down? I am fairly new to game designing and am trying to design game engine architecture for MMOG poker game. My major problem is scalability. Old Legacy code written in python runs everything on single process. Clients and server talks using xml based protocols. Following is old architecture.

admin -> DB (mysql) <-> backend <-> game-engine + login-server <-> client

I came across old reddit post and particular comment. What I feel, I need similar kind of architecture. So I am planning to implement following architecture along with admin and db.

backend cluster ( to interact with db)
Player Server cluster (handles player authentication and events from clients)
gamelogic server cluster (executes game logic)
redis-cluster (for caching states of ongoing tables)
directory-service + routing server(all clusters will talk with it and all communication will be done through it. initially planning to go with single such server and later make it distributed. Something like this. please see section 'Distributed Directory Service' and 'Distributed broker')

I need to build it using Twisted because of client constrains and legacy codebase.

In this architecture I am confused at one point particularly. Suppose I have multiple tables on one game-logic server and it goes down. How can I address this situation without losing game?

sentences: Where to purchase multitrack music loops? I've seen other questions about where to find royalty-free music available for purchase. But most of these tend to provide a single audio file with every instrument track already blended and mixed together. I'm more interested in the dynamic music route, and would want to download a bundle of audio files (one for bass, one for kick, etc) and in my game I can just bring them in and out based off of what's going on. When things are quiet just have the bass line repeating and when things get chaotic the full piece is going. Obviously each track would need to be on the same beat and designed to work well with each other part. Is there any place that such multitrack loops could purchased? Thanks.

sentences:
Opengl Best VAO model for voxel engine I make a voxel engine on LWJGL 3 (OpenGL binding for JVM).
I store all object data in world class.
World is subdivided into 32*32*32 chunks.
Chunks use octree storage.
The main part of all my rendering is cubes that share one mesh but have different transformation matrices and some other data.
To render those i use one VAO per chunk, it contains only one cube mesh instance and has all cubes data (like transformations) stored in its VBOs.
I construct each chunk VAO once and render it fully in one call - glDrawElementsInstanced.
If i need to change some cube data in a chunk, i will reconstuct VAO from ground up or change individual buffer data. That should be pretty efficient, right ?

But I need some other stuff to be rendered, like complex mesh objects or effects or some debug stuff.

How should I render those objects ?
Should I create a VAO for each mesh and then perform instanced rendering for each object with the same mesh ?
Or should I batch all objects with their meshes into one VAO for each chunk and render it fully ?

I was trying to create a VAO recently, that contained one instance of each mesh and all object data. But i could not render it correctly. Because each time I needed to somehow switch object data VBO while rendering an instanced mesh. It didn't work.

Code for the last VAO: http://pastebin.com/WanNsR5L

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:
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:
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:
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:
Options for UDK and version control repositories? Another developer and I have begun to experiment with the Unreal Development Kit and have installed the UDK to our local computers. He's been toying around and experimenting and has some basic code and assets already developed. We want to set up a VCS repository so we can collaborate on development of a UDK project.

Some things we've noticed:

Source code goes in Development/Src/GameName/.
Binary Content and other assets go in UDKGame/.
The rest of the folders in the root directory are for the core UDK installation.

In terms of repositories, we've already come up with several options:

Commit everything (even the core UDK code).

Pro: Easy
Con: We're committing lots of code that, while a dependency of our project, isn't technically part of the project.

Commit the two folders we contribute to in two separate repositories.

Pro: Isolates versioned code to stuff we create.
Con: Slightly more difficult to set up, commits for one fix span multiple repositories, and we're committing a lot of binary content.

Change the config so both the src and the assets live in one folder, then commit that.

Pro: Isolates versioned code, commits for changes are in one repo.
Con: Committing binary content.

Commit SRC to one repo, use another solution for assets (FTP, Dropbox, etc)

Pro: Isolates versioned code, no extra overhead in versioning binary content.
Con: Changes span multiple places and manual updates to a remote storage solution are needed.

As we assess the best way to go about this so we don't back ourselves into a corner later, I'm wondering if there are other options and what their pros and cons are. I realize we could easily just pick a solution and change it up once we ran into scaling issues, but version control has always been one of those things I like to do once upfront and then forget about when I work on projects.

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: Game development equivalent of Movie Director Is there a job in game development that is equivalent to being a movie director?

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:
Unity Initializing class of a script not working I have been trying to find a solution for the last couple of hours so please hear me out. At first I got a NullReferenceException, which I resolved(?) by initializing the class first (This is my problem! I can't seem to initialize my class sucessfully). However, here are my next errors. I tried using the new keyword, which resulted in You are trying to create a MonoBehaviour using the 'new' keyword. Next I tried GetComponent<>(), which resulted in a CS0120, that I didn't know how to fix. The AddComponent<>(), resulted in a CS0103 The name AddComponent does not exist in the current context. What I tried next was GameObject.AddComponent<>(), which threw a CS0120, and gameObject.Addcomponent<>() which threw a CS0236.

Here is my code for the class I am trying to initialize if it should be needed:

public class Dialogue : MonoBehaviour {
public TextMeshProUGUI textDisplay;
public string[] sentences;
private int index;
public float typingSpeed;

public GameObject continueButton;

void Update() {
    if (textDisplay.text == sentences[index]) {
        continueButton.SetActive(true);
    }
}

public IEnumerator Type() {
    foreach (char letter in sentences[index].ToCharArray()) {
      textDisplay.text += letter;
      yield return new WaitForSeconds(0.01f);
    }
}

public void NextSentence() {
    continueButton.SetActive(false);

    if (index < sentences.Length - 1) {
        index++;
        textDisplay.text = "";
        StartCoroutine(Type());
    } else {
        textDisplay.text = "";
        continueButton.SetActive(false);
    }
  }
}

Here is from where I tried to initialize:

public class Mace : MonoBehaviour {
//Dialogue dialogue = gameObject.AddComponent<Dialogue>();

private void OnTriggerEnter2D(Collider2D otherCollider) {
    if (otherCollider.CompareTag("Player")) {
        StartCoroutine(dialogue.Type());
    }
}

}

sentences:
Rotating around a non origin point I've been looking around the forums for some answers to the question I have. I've found some answer that seem to help but nothing that answers my specific question. That question being how to rotate an object in world space around a non origin point.

I have a grappling hook that I am trying to implement inside of a game I am making for a final college project. This grappling hook collides with another object in world space and I then want the player to rotate around this point as if a rope were present.

I have the point at which the grapple collides the point at which the player is located and the origin. I tried the standard translate to the origin rotate and translate back and that did not work.

This is being done in DirectX 9 and it is a C++ game. Any  help you could offer would be greatly appreciated. If you need anymore info please ask.

Edit: I should also add that we are doing a vector based storage for this setup. So I store the matrices in vectors(i.e Forward,Direction,Right,Position) and build the matrices on the fly

void CSpatialFrame::RotateAbout(D3DXVECTOR3 _Point, float _fDegPitch, float _fDegYaw, float _fDegRoll)
{
    D3DXMATRIX RotationMatrix;
    D3DXMatrixRotationYawPitchRoll(&RotationMatrix, D3DXToRadian( _fDegYaw ), D3DXToRadian( _fDegPitch ), D3DXToRadian( _fDegRoll ));
    D3DXVECTOR3 playerPos = m_Position;
    m_Position = _Point;

    D3DXMATRIX PlayerMatrix;

    PlayerMatrix._11 = m_RightVector.x;
    PlayerMatrix._21 = m_RightVector.y;
    PlayerMatrix._31 = m_RightVector.z;

    PlayerMatrix._12 = m_UpVector.x;
    PlayerMatrix._22 = m_UpVector.y;
    PlayerMatrix._32 = m_UpVector.z;

    PlayerMatrix._13 = m_DirectionVector.x;
    PlayerMatrix._23 = m_DirectionVector.y;
    PlayerMatrix._33 = m_DirectionVector.z;

    PlayerMatrix._14 = m_Position.x;
    PlayerMatrix._24 = m_Position.y;
    PlayerMatrix._34 = m_Position.z;

    D3DXMatrixTranslation(&PlayerMatrix, _Point.x, _Point.y, _Point.z);

    //D3DXMatrixTranslation(&PlayerMatrix, m_Position.x, m_Position.y, m_Position.z);

    D3DXMatrixMultiply(&PlayerMatrix, &RotationMatrix, &PlayerMatrix);

    //D3DXMatrixTranslation(&PlayerMatrix, _Point.x, _Point.y, _Point.z);

    m_RightVector.x = PlayerMatrix._11;
    m_RightVector.y = PlayerMatrix._21;
    m_RightVector.z = PlayerMatrix._31;

    m_UpVector.x = PlayerMatrix._12;
    m_UpVector.y = PlayerMatrix._22;
    m_UpVector.z = PlayerMatrix._32;

    m_DirectionVector.x = PlayerMatrix._13;
    m_DirectionVector.y = PlayerMatrix._23;
    m_DirectionVector.z = PlayerMatrix._33;

    m_Position.x = PlayerMatrix._14;
    m_Position.x = PlayerMatrix._24;
    m_Position.x = PlayerMatrix._34;
}

sentences:
How to draw tile edges when you don't know where they're going. This is more of an art question than a programing one but still game development.

I have a tile engine that makes a map randomly from tiles, each tile is a square 3x3 grid. The problem is that while the elements on each tile work well together such as having forests along the top three squares and grass on the other 6, the engine could put the forrests against anything such as rivers, grass, mountains or more forest.

how can i draw the edges of the tiles so the look good no matter what they are places against ?

sentences:
Make a sprite jump to a certain direction in libGDX I was wondering how you can make a sprite jump to a certain direction in libGDX just like the brick does in the famous mobile game "Amazing Brick'

I want to make my sprite jump up a bit to the right when I tap the right part of the phone and make it jump up but to the left direction when I tap on the left part of my phone.

I am using libGDX on android studio and I am on a beginner level, trying to develop a unique game for android. Plz help. Thanks in advance. ^o^

sentences:
How can I implement bounding volume subdivision for my sprite images? Lately, I have been researching different Collision methods, how to deal with multiple collisions and different types of bounding shapes, circles, rectangles, polygons and ellipsoids. Some common collision methods are the:

'Axis aligned bounding box'

if (rect1.x < rect2.x + rect2.width &&
   rect1.x + rect1.width > rect2.x &&
   rect1.y < rect2.y + rect2.height &&
   rect1.height + rect1.y > rect2.y) {
    // collision detected!
}

'Circle Collision'

double dx = (circle1.x + circle1.radius) - (circle2.x + circle2.radius);
double dy = (circle1.y + circle1.radius) - (circle2.y + circle2.radius);
double distance = Math.sqrt(dx * dx + dy * dy);

if (distance < circle1.radius + circle2.radius) {
    // collision detected!
}

The bounding box/shape dilema

For one my projects, I am using images, which are rectangle by nature. However, to simply check for intersections with the images' edges would result in unsatisfactory collision detection. As Gamasutra puts it:

  " The experience of playing some of the early flight simulators
  illustrated how bad collision detection can ruin a game. Flying
  through a mountain peak and surviving isn’t very realistic. Even some
  recent games have exhibited collision problems. Many game players have
  been disappointed by the sight of their favorite heroes or heroines
  with parts of their bodies inside rigid walls. Even worse, many
  players have had the experience of being hit by a rocket or bullet
  that was “not even close” to them. "

From that resource I discovered an interesting method of making bounding boxes or circles which Gamasutra calls subdivision

I am having trouble thinking how to do this subdivision process for my images (as I am working with images) and how to properly implement either subdividing process within my collision reliant app.

For example take mario and a koopa shell. I wouldn't want their transparent space to trigger intersection

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:
Making an auto patcher I'm currently in the last phases of an original release for my upcoming risk game - I'm looking at making a patching system to autopatch the game.

My current concept for it is-

1: Player opens the game

2: Game checks valid serial key

3: If valid, game checks latest version

4: If newer, game prompts opening of auto patcher

5: If opened, patcher downloads version list, with all version

6: Patcher loops through list to find all newer patches and downloads all version files with links to patch data

7: Patcher checks with the website for each file, checking if downloading all patches is smaller than downloading the latest version of the file: if smaller, downloads patches; if bigger, downloads latest file

8: If smaller patch file, patcher incrementally alters file with each patch applied by each small patch file, from oldest to newest. If larger, patcher simple overwrites the file

9: Patcher asks exit/launch game so players can enjoy the game

Does this sounds like a sane way to do the patcher or will it come back and bite me later on?

sentences:
Canvas isometric translations to integer coordinates I'm creating a canvas based game with an isometric playing board. I use the following transformations to get my square tiles to render on the screen:

'applyViewportTransformation' : function() {
    context.translate(this.settings.camera_x, this.settings.camera_y);
},
'applyIsometricTilt' : function() {
    context.scale(1, this.settings.tilt_ratio);
    // Rotating the grid around it's center.
    context.translate(this.settings.pixel_grid_width / 2, this.settings.pixel_grid_height / 2);
    context.rotate(Grid.degreesToRadians(45));
    context.translate(-this.settings.pixel_grid_width / 2, -this.settings.pixel_grid_height / 2);
},

My issue is I would now like elements rendered on specific tiles that aren't translated like this. I also need to be able to map mouse clicks to isometrically drawn elements etc.

So as far as I can tell I need a formula to go into the grid and a formula to go out of the grid.

Mathematically I'm lost and also a little stunned the 2d context doesn't have a public way of simply applying these transformations to a set of coordinates.

Help would be much appreciated.

Edit, if anyone wants a peek at the source or would like to suggest some edits you can view the source on github.

sentences: How can I make a "wet surface"/"shallow puddle" shader in Unity? In my game I need to create dynamic water puddles but I cannot find a tutorial that shows how I can make such an effect (an example of which is shown below). How can I do it?

sentences:
JBox2D becomes very slow on mobile phones after 80-90 dynamic and static bodies I have a simple game with 20-30 physics bodies (static, and dynamic)

If I add some additional Dynamic bodies and joints (over 80-90 item), then JBox2D will become very laggy, and a little slow.

Am I doing something wrong, or is this the limit of JBox2D? If I change to Box2D JNI via java native calls, will it be faster?

sentences:
How can I instantiate in the current rotation in Unity 2d? Backstory

I'm currently working on a 2D sidescroller/platform game as a hobby, and I just started recently. Followed a few tutorials and such I managed to wrote my own code for basic command like walk, jump, health and so on. However my basic code wasnt perforning as I would expect, I needed a more "Tight" feeling with the movements so I followed a suggestion to use a physics based controller (Prime31's PC2D, Acrocatic or even Corgi Engine...)

Well, now the movements are what I feel is good, So I kind of dived in the scripts to add/remove/customize some code.

Question

I'm stuck now on a simple issue, I added these lines

public Transform weaponMuzzle;
public GameObject projectile;
float fireRate = 0.5f;
float nextFire = 0;

then in my Update()

if (Input.GetButtonDown("Fire2"))
{
  animator.Play.Weapon();
  fireProjectile ();
}

and here is the problem I have

void fireProjectile ()
{
  if (Time.time > nextFire)
  {
    nextFire = Time.time + fireRate;

    if (_motor.facingLeft)
    {
      Instantiate (projectile, weaponMuzzle.position, Quaternion.Euler (new Vector3 (0,0,180f)));
    }
    else if (!_motor.facingLeft)
    {
      Instantiate (projectile, weaponMuzzle.position, Quaternion.Euler (new Vector3 (0, 0, 0)));
    }
  }
}

The prefabs are also physics based and they are fired with no problems, however they don't want to follow the current rotation of the player, they always go in the right X axis.

First of all, the facingLeft on my code is what I understand is the reference to the character controller motor, I tried with _motor.normalizedXMovement > 0 and _motor.normalizedXMovement < 0 (normalizedXMovement -1 is full left and 1 is full right) this just make it that you can only fire while moving, not stopped and the problem still persists.

I also tried with Quaternion.Identity instead of Euler and it's the same.

For a full source code : https://github.com/prime31/CharacterController2D

I'm kinda lost and it would means a lot if you can help me out on this issue.

Ps: I already searched here and other related forums but cannot find the answer, this is not a repost.

sentences:
Pygame's sprite.collide_circle() missing several frames of head-on collision I've spent hours trying to figure why my collision detection was so crappy, with sprites visibly ovellaping for several frames, when I noticed the culprit could be pygame's detection callback pygame.sprite.collide_circle().

I've stripped down the code and created a simple demo, and results were surprising: collide_circle() still returns False for several frames after its sibling collide_rect() correctly detects a collision and returns True.

Here is the code:

import pygame

RED   = (255,   0,   0)
GREEN = (  0, 255,   0)
BLUE  = (  0,   0, 255)
BLACK = (  0,   0,   0)
WHITE = (255, 255, 255)

SCREEN_SIZE = (800, 600)
FPS = 60
BG_COLOR = BLUE

class Ball(pygame.sprite.Sprite):
    def __init__(self, color=WHITE, radius=10, position=[], velocity=[]):
        super(Ball, self).__init__()

        self.color = color
        self.radius = radius
        self.position = list(position) or [0, 0]
        self.velocity = list(velocity) or [0, 0]
        self.bounds = (screen.get_size()[0] - self.radius,
                       screen.get_size()[1] - self.radius)

        self.image = pygame.Surface(2*[self.radius*2])
        self.rect = self.image.get_rect()
        pygame.draw.circle(self.image, self.color, 2*(self.radius,), self.radius)

    def update(self, dt=1./FPS):
        super(Ball, self).update()

        for i in [0, 1]:
            self.position[i] += self.velocity[i] * dt

            if self.position[i] < self.radius:
                self.position[i] = self.radius
                self.velocity[i] *= -1

            elif self.position[i] > self.bounds[i]:
                self.position[i] = self.bounds[i]
                self.velocity[i] *= -1

        self.rect.center = self.position

pygame.init()

screen = pygame.display.set_mode(SCREEN_SIZE)
clock = pygame.time.Clock()

background = pygame.Surface(screen.get_size())
background.fill(BG_COLOR)
screen.blit(background, (0,0))

balls = pygame.sprite.Group()
balls.add(Ball(color=RED,   radius=100, position=[  0, 300], velocity=[ 100, 0]))
balls.add(Ball(color=GREEN, radius=100, position=[700, 300], velocity=[-100, 0]))

done = False
while not done:
    for event in pygame.event.get():
        if (event.type == pygame.QUIT or
            event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
            done = True

    balls.update()
    if pygame.sprite.collide_rect(*balls):
        collision = pygame.sprite.collide_circle(*balls)
        print collision
        if collision:
            for ball in balls:
                ball.velocity[0] *= -1

    balls.clear(screen, background)
    balls.draw(screen)
    pygame.display.update()
    clock.tick(FPS)

pygame.quit()

And the output:

False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
True
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False
False

That's 17 frames of overlap before collide_circle() realizes that hey, there's a collision there! Even at 60 FPS that's huge.

The balls are almost halfway through each other, and this behavior seems to be velocity independent: if I change the balls' speed or the FPS, the visual result (halfway overlap) remains, but for fewer frames.

So, my question is: is this a pygame bug? Or did I completely misunderstood how detection works?

sentences:
How should multiplayer games handle authentication? I've been lurking around to understand how an authentication system would work in games, but after many searches, it seems that working with ssl/certificates could be a little complicated for just a multiplayer game with a lot less capacity than an MMO.

I know that successful multiplayer games need this, but I'd like to check if other multiplayer games commonly take this precautions.

EDIT: I'll describe what I have in mind. The server not only handles game logic, but also authentication. So, in order to play on a specific server (that everyone could start), you first need to register an account on the server, and each time you want to play there, login as usual (password/name user).

My question is, would not providing a secure channel for logging in/registering an account be forgivable/understandable in this context? Also I'm interested to know how games with a similar architecture would handle this matter.

sentences: Is it possible to be a game artist and not work on character/creature animation? If I don't want to develop and animate living characters (animals, humans, robots, et cetera) for games, but I do want to develop/animate objects (TVs, phones, cars, et cetera) or levels... is it possible to have a career as an artist in the industry?

sentences:
Load different grayscale images into the same texture I have a series of images loaded as

data1 = stbi_load_from_file(file1,&width,&height,&comp,1);
data2 = stbi_load_from_file(file2,&width,&height,&comp,1);
data3 = stbi_load_from_file(file3,&width,&height,&comp,1);

So that they're grayscale images. I then want to load these three images into a single GL_RGB texture. How can I do this? Do I have to allocate new memory and create a new image picking the channels info from the three different images?

sentences:
How can I make A* finish faster when the destination is impassable? I am making a simple tile-based 2D game, which uses the A* ("A star") pathfinding algorithm. I've got all working right, but I have a  performance problem with the search. Simply put, when I click an impassable tile, the algorithm apparently goes through the entire map to find a route to the impassable tile—even if I'm standing next to it.

How can I circumvent this? I guess I could reduce the pathfinding to the screen area, but maybe I am missing something obvious here?

sentences:
Which to use for game Development? SDL_Surface or SDL_Renderer I'm relatively new to game development compared to the pioneers in this field, and my question, as stated in the title is, Should I Be using SDL_Surface for game development or SDL_Renderer, I know that SDL_Renderer is the new, and more efficient way, but i still do have a doubt...

Thanks in advance...
Random Developer

sentences:
Instantiate two objects at random non-overlapping positions I'm making an endless runner game.

I have the script that make coins and walls appear at the same time in front of the player.

The problem is that sometimes the coin and wall appear in the same place/position.

How can I ensure that coins and walls do not appear in the same place/position?

public class Instantiate : MonoBehaviour
{
public float betweenSpawn = 1.05f;
public float angle;
public Vector3 spawnValues; //Range of appearing
public GameObject coinPrefab;
public GameObject wallPrefab;

public Transform coinInstantiate;
public Transform wallInstantiate;

void Start()
{
    InvokeRepeating("Spawn", 0f, betweenSpawn);
}

void Spawn()
{
    Vector3 coinPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), 1, Random.Range(-spawnValues.z, spawnValues.z));
    Vector3 wallPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), 1, Random.Range(-spawnValues.z, spawnValues.z));

    Instantiate(coinPrefab, coinPosition + coinInstantiate.TransformPoint(0, 0, 0), Quaternion.AngleAxis(angle, Vector3.forward));
    Instantiate(wallPrefab, wallPosition + wallInstantiate.TransformPoint(0, 0, 0), Quaternion.AngleAxis(angle, Vector3.forward));
}

}

sentences:
Unity 3d shooter tutorial animation I'm following this tutorial. I cannot get even simple animations to work. Here's a very simple case that was supposed to work but did not:

Add an animator component to the 'player' prefab
Create an animator controller and drag it to the corresponding field in the player animator component.
Open the 'animator' tab (right click on animator controller -> open), and drag an animation clip. This automatically becomes the default state.
Click play. Nothing happens. In the animator tab I can see a blue progress bar in the 'default' state (the only animation I dragged to the state machine). But the game screen shows no animation.

The player prefab inspector:

The very simple state machine

This is driving me nuts.

sentences:
Unreal Engine - spawning actor from content browser What is best way to spawn Actor from UFactory ?
I am trying to create custom asset based on AActor:
UObject * UMyActorAssetFactory::FactoryCreateNew(UClass * InClass, UObject * InParent, FName InName, EObjectFlags Flags, UObject * Context, FFeedbackContext * Warn)
{
    return NewObject<AMyActorAsset>(InParent, InClass, InName, Flags);
}

Now I can create MyActorAsset. But when I try to open it, it fails because of missing world.
Is there any way to access editor world, or do I need to create new instance of world and supply that one?
Thanks.

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:
How do I create a playing field of collapsing bubbles, as in Tsum Tsum? Tsum Tsum App is a pretty interesting game and I am wondering how the main play area's data structure is, erm, structured?

Characters are stacked, disappear as the player swipes over matching ones, causing the ones above to fall down and replace them.

Tsum Tsum ⓒ Disney, via games.disney.com

Initially, it seems that it is a 2D hex grid?  But I see a lot of physics going on (Tsum Tsum bounce and roll off of each other).  In fact, it seems that even as you try to connect them that the chain can be interrupted while the Tsum Tsum are falling away from its closest neighbor.  Also, if you connect enough Tsum Tsum, a power-up bubble appears in the chain, which  pushes the Tsum Tsum out of the way.  So I'm doubting that this hex grid is constantly updating with the position of the Tsum Tsum given that the Tsum Tsum rarely stops moving.

sentences:
Platformer Crouching problems I'm trying to implement a crouching system to my 2D platformer. The problem is, I don't want the character to be able to do anything else except jumping when it's crouching. I have many functions but I think posting the movement function here would be enough. When I gain velocity and then press crouch, I skid across the platform, and stop.
First, my crouch function:
private enum State { idle, running, jumping, falling, crouching}

    void Update()
{
    //crouch
    if(Input.GetButton("Crouch"))
        {
        animator.SetInteger("state", 4);
        Crouch();
        }
    else
    {
    boxCol.size = new Vector2(0.5454721f, 1.8065f);
    }
}

 void Crouch()
{
    boxCol.size = new Vector2 (0.6933689f,1.44953f);

}

And here is my movement function. I tried to fix it by adding the if condition on top of it, but when I run and crouch, it slides a lot before stopping. What can I do to fix that? The character already has a physics material with zero friction. I know I can make the velocity zero if the player is crouching but that would just kill the gameplay. I need to add a smooth stopper. I'm not sure how to make a decelerating script and use it in my case.
public void Move()
{
     if(animator.GetInteger("state") != 4)
     {
            float x = Input.GetAxis("Horizontal");
            float moveBy = x * speed;
            rb.velocity = new Vector2(moveBy, rb.velocity.y);
                if (x > 0f)
                {
                transform.localScale = new Vector2(1, 1);
                isRight = 1;
                isLeft = 0;

                }
                else if (x < 0f)
                {
                transform.localScale = new Vector2(-1, 1);
                isLeft = 1;
                isRight = 0;
                }

    }
}

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:
Distributing an Android game with plugins via the market I'm new to Android development, and was wondering how the following could be achieved within the confines of the Android market as a distribution channel:

One main application, which handles the main menu, networking, high scores, etc.
Several games which can be launched from the main menu, which all work within the same eco system. The main application is not just a pseudo launcher for other games, these different games will share high scores and other achievements/preferences.

In a traditional package management system such as apt, pacman or yum, this could be handled quite happily through dependencies. This does not appear to be possible via the Android market. The closest I've seen is when apps scan to check if the required app is installed, and if not, launches the market and asks the user to download the app.

This sounds like a very messy solution.

It also begs the question, would they download the game (plugin) first, which then downloads the main shell application? Or would they download the main shell application, and when they navigate to a menu item which says "Play game", then it scans for any installed games, and if none exist, redirects to the market? Also, I'm not even sure if it is possible to dig up the package from another application on the device, and start invoking classes from within (e.g. when you want to launch the game (plugin))

A final option is just to have a 3rd component which is a .jar that each game includes, which effectively contains the entire shell application. Then each game would appear to have the same menu, but it would become a nightmare as soon as you want to update the menu component and have to re-release each game. It would be especially worse if other people released games (plugins) based on the same framework and didn't update them.

Is there any other options which I haven't thought of?

Has anyone else solved this or seen a solution in any apps they've installed (doesn't have to be games)?

cheers.

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:
Bezier curve not drawn correctly I'm trying to draw a bezier curve using 3 points. If I use the quadratic form:

I get this result:

And I believe it's correct.

Now since I need to draw it with a variable number of points, I'm trying to apply the explicit definition:

This is the code that implements it:

typedef struct Point2D
{
    GLfloat x;
    GLfloat y;
    Point2D operator+(GLfloat c) const
    {
        return {x+c, y+c};
    }
    Point2D operator+ (const Point2D& other) const
    {
        return {x+other.x, y+other.y};
    }
    void operator+= (GLfloat c)
    {
        y+=c;
        x+=c;
    }
    void operator+= (const Point2D& other)
    {
        x+= other.x;
        y+= other.y;
    }
    Point2D operator* (GLfloat factor) const
    {
        return {x*factor, y*factor};
    }
    void operator*= (GLfloat factor)
    {
        x*=factor;
        y*= factor;
    }
}Point2D;

Point2D bezier(const vector<Point2D>& points, GLfloat u) // u is t
{
    Point2D point;
    unsigned int n= points.size();
    vector<int> factorials(n);
    // For efficiency, I put all factorials in an array instead
    // of recalculating them each time.
    GLfloat c1= pow(1.0-u,n-2);
    // This is (1-t)^(n-1)
    GLfloat c2= 1.0;
    // This is t^i , I'll progressively multiply it for u.
    factorials[0]=1;
    for(unsigned int i=1; i<n;i++)
    {
        factorials[i]= factorials[i-1]*i;
    }
    point= points[0] * (GLfloat)(n-1) * c1; // This is the first point
    for(unsigned int i=1; i<n; i++)
    {
        c2*= u;
        GLfloat bCoeff= factorials[n-1]/(factorials[i]*factorials[n-2]);
            // bCoeff is the binomial coefficient: n! / ( i! * (n-1)! )
        point+= points[i] * bCoeff * c1 * c2;
    }
    return point;
}

void display()
{
    glClearColor(0.75,0.75,0.75,1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(1.0,0.0,0.0);
    glBegin(GL_POINTS);
    vector<Point2D> points{Point2D{200,200}, Point2D{400,400}, Point2D{600,200} };
    for(GLfloat u=0.0; u<=1.0; u+=1.0e-4)
    {
        Point2D point;
        point= bezier(points,u);
        glVertex2f(point.x,point.y); // For now I use the immediate mode
                                         // I'll put it in a vbo.
    }
    glEnd();

    glutSwapBuffers();
}

Unfortunately this is the result that I get:

Which I believe is incorrect. I guess I'm not applying correctly the explicit definition, but I don't know where's the mistake, I would like to know what I'm doing wrong.

sentences:
Importing World of Warcraft models into Unity I'm following some tutorials to create a simple game with Unity in order to learn, and I would like to enhance my learning experience by adding World of Warcraft models. Don't worry, this is all just for learning and won't see public eyes in any way.
I downloaded a model viewer and I can export textures and animation from WoW with it, but when importing into Unity I'm having some problems.

Which extension should I export the model to, and what is the process I should follow in order to have an object with a model I just exported?

I'm really new to Unity, so any help would be great!

sentences:
How to set parent for prefab in Unity I have a prefab of a button (btn) that I need to set parent (_canvos) for it after it spawned (online)...

I have try this code:

public Transform btn;
public Transform mkn;
public Image _canvos;

public void test ()
{
    Transform InTank = Network.Instantiate (btn, mkn.transform.position, Quaternion.identity, 0)as Transform;
    btn.SetParent(_canvos);
}

But it doesn't work.

  error: MissingReferenceException: The object of type 'Object' 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.
  what's the problem??

sentences:
Selection with region (when rendering with shaders and VAO) I am currently render my geometry using "Modern OpenGL" approach (with shaders and buffers). I have already implemented picking of single primitives using glReadPixels. Now I am faced with problem how to implement selection of multiple objects. I cannot use glReadPixels because maximum (and it seems meaningful for me) number of objects that I could select with 10x10 box is 100. But it is really necessary for my purposes to have ability to select thousands of objects in small selection area.

I already read answer to similar question where was recommended to test each point against selection rectangle. But it gives new problems: all my vertices are already stored in buffers and it looks like huge performance to test each point on CPU.

Could someone help with such issue?

sentences:
How to determine lowest PC requirenments for my game to run so I've created my first game in UE4 (4.9.2 version) and want to publish it. But i really don't know how to determine lowest possible environment my game runs on.Also I am unsure what other files apart from actuall build I should redistribute. I am building game via file->package project->window.

1) How to determine minimum required DirectX version?

2) How to check what other dll's I need to include into installer (apart from actuall build)? For example will I need to install VC redistributable packages? If so then which ones? The same goes with directx.

3) How to determine minimal windows version? This is limited by directx compatibility right? If my game runs on DirectX10 or higher then all OS versions with at least direct10 will be OK?

4) This may seem as stupid question but in which version 64 or 32 bit I should distribute my game? 32 is always better because anybody can run it right?

thanks for Your answers ;)

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:
is there any different solution for different buildings different behaviours I'm trying to make different behaviours for workers of different buildings, let's say an agricultural worker would need to sow wheat seed and collect the wheat grain when it's grown. let's call that Behaviour0
For carpentry a worker would get wood and make arrows.
I have 2 different behaviours and I would like to implement them all in the simplest way possible.
 class agricultural{
     Workr Work
     void Working(Work W){
         Behaviour1();
     }
 }
 class Carpentry{
     Workr Work
     void Working(Work W){
         Behaviour2();
     }
 }
 template <tipename T> class BuildWork{
     T BW
     Work(){
         BW.Working();
     }
 }

I tried doing it with template so the behaviour would be inside agricultural and carpentry but problem occurred when I tried to declare template as only 1 can be inside it and getting it with ifs would make it the same as a non-templated version.
 class Workr{
     // here I would need to make it only for 1 is possible
     BuildWork <agricultural> BW
 }

So is this how I should use it?
The next thing occurred to me is this
 class Building{
     bool beh[2];
     void Work(Workr W){
         if beh[0]{
             if (beh[1]){
                 behaviour0(Workr W);
             }
             else{
                 behaviour1(Workr W);
             }
         }
         else{
             if (beh[1]){
                 behaviour2(Workr W);
             }
             else{
                  behaviour3(Workr W);
             }
         }
     }
 }

The last code is workable but I wonder if there is a better solution for this? here I can just change the bits in the beh[ ] and it's working
Each building has different behaviours and each worker in that specific building has same behaviour. Specific behaviour is always in the same building type.

sentences:
Should the interaction between the player and world objects be handled from the player class or as an event from the object classes? Suppose you're making a 3D platformer like Super Mario, if you jump on a Goomba, does Mario (the class) know that it just landed on a Goomba and then tell that Goomba to die, or does the Goomba realize that he is being smashed and dies ?
I want to go with the first approach but it will end up with a huge If/then (or Switch/Case) script, also the reason why this is "problematic" is that many objects will make the player have a "reaction", for example if you land on a Goomba, you don't just kill it, but it forces you to jump, that jump event, what's the best way to handle it ?
Thanks

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:
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:
HDR and Alpha Blending I've been reading a lot about HDR techniques and came across Alpha Blending compatibility. Searched even more and found this snippet from the Ogre Forums:

  With source alpha blending, it sometimes looks ok provided the range differences aren't too high, but most other blend modes fail completely, particularly add. You really have to do your own separate composition in another fragment shader targetting a second texture and pulling the 'background' values in so you can do accurate blending, rather than render the transparent effects into the same original surface.

Why is alpha blending an issue when it comes to rendering HDR (values above 1.0) in 16FP FrameBuffers?

sentences: How to Simulate Height in a Tiled Top-Down Game How can I simulate height in a top-down tiled 2D game? One way I thought was to make tiles which are supposed to be higher brighter, but I was wondering if there was a standard or better implementation.

sentences:
Converting an XNA game from WINDOWS to XBOX I have an XNA game for WINDOWS which I want to work on XBOX also.

I've designed the game so that when I want to connect it to an XBOX, all I have to do is supply a different input class,

And I would do that by checking with the preprocessor macros and checking if it's windows or xbox.

But then, when I tried to do Create a copy of this project for XBOX in VisualStudio, it created several new projects (the real XNA project and some of it's dependencies), and it complained about things not working for C# 3.0 and that I should use C# 4.0 instead, which I didn't find out how to do either.

What's the correct way to make both WINDOWS and XBOX versions of an XNA game?

And also, how do I really run the game on XBOX? I haven't found a good tutorial on how I do that... also I don't have an XboxLive membership so if there's a hacky way to do that, it's better

sentences:
Collision Detection Tips I need collision detection for my 3D racing game but it isn't going well right now. I think I understand the concept of testing boxes and generating a response, however implementation part is a nightmare for me. OpenGL makes everything more complicated than it has to be.

How can I use a shape that is constructed with glVertex*? Should I create the bounding boxes with some Vector3D class?

sentences:
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:
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 can I move an object around a canvas in a random direction at random times? I am currently trying to move an object (circle ball) around the canvas in a random direction.

I have already written the code for the wall collisions so the ball bounces back into canvas when the ball hits any of the canvas sides.

The canvas size is 600 x 500

in order to move the object around the canvas I have used;

   xPosition += ySpeed;
   yPosition += ySpeed;

From the code above, the ball moves from one end to the other end of the canvas in the same angle and direction, then bounces back at a different angle.

How can I go about doing this, if I wanted my object to move in the same speed but in a random direction around the canvas.

Any help is appreciated, thanks!

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:
What do you think about Ogre3d as first time engine for first time 3d Game? This is a question for the experienced 3d game developers.

I'm a long time programmer (c++/java), and after 15 years, I'd like to get into 3d gaming.

After some internet research, I saw that the trend is mostly with Ogre as a 3d engine.

What do you think? I'll be targeting OSX, Linux and Windows.

sentences:
Array with multiple linked objects in Unity This might be too primitive, but for my use case, I need to maintain an array in which two attributes are linked to each other... For example - If I want to do Score gathering... Then I need an array which has scores and corresponding player names as each element.

So, when I do Array.Sort(PlayerScorearray) I even need the playername to be sorted in the order so that if I want to know the player with lowest score, I just go for the first element and then go to the corresponding player name.. Is it possible to do it in a simpler way? My mind can't think of a simple way to do this.

Edit : I am using C# for scripts

sentences:
Most effective way to manage a gamestate system that is easy to use? I just started working on my game, mostly the game management. I plan and using game-states to make the menu's and other stuff easier.

My main idea for implementing the game-states is creating a game object and passing it as a reference to classes which control the current state, then storing the game-state classes via references inside a vector.
My main concern is that is this the better way to do it? Or should I implement it differently? Also, when you do use game states, where does the game loop go? Does it go inside a state such as gamePlaying or is it put somewhere else?

Hopefully someone can clear this up for me, thank you!

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:
SDL blitting multiple surfaces at once I'm trying to write a platforming game where the sprites for the level backgrounds are broken up into 512x512 chunks. I keep 3 chunks in memory at a time and I'm trying to write code to blit all three to the screen. Here is the current code I have:

SDL_Rect where;
where.y = -game->camera->y;

where.x = -game->camera->x - MAP_WIDTH;
SDL_BlitSurface(left_chunk, NULL, screen, &where);

where.x = -game->camera->x;
SDL_BlitSurface(center_chunk, NULL, screen, &where);

where.x = -game->camera->x + MAP_WIDTH;
SDL_BlitSurface(right_chunk, NULL, screen, &where);

The issue I'm running into is that whichever chunk gets blitted first is the only one that shows up. The rest fail to appear onscreen. I think the issue might have something to do with alpha transparency, but even if the chunks don't overlap at all they still fail to blit. In other parts of the code I'm blitting multiple things to the screen at once, such as characters and backgrounds, and they all show up correctly. This particular segment of code is the only area I'm encountering this problem.

If I comment out the line that blits left_chunk, it changes to 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:
Selective Image Effects with Stencils I am trying to create an image effect where only a part of the image has the effect applied to.

One way I can think of to do this is to define the portion of the image using the stencil buffer.

Stencil Mask Shader:

Stencil
{
    Ref 1
    Comp always
    Pass replace
}

Image Effect Shader:

Stencil
{
    Ref 1
    Comp equal
    Pass keep
}

OnRenderImage Function

void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    saturationPassMat = CheckShaderAndCreateMaterial(saturationShader, saturationPassMat);

    saturationPassTex = RenderTexture.GetTemporary(source.width, source.height, 24);
    Graphics.SetRenderTarget(saturationPassTex.colorBuffer, source.depthBuffer);

    Desaturate(source, saturationPassTex, saturation);

    Graphics.Blit(saturationPassTex, destination);

}

Applying the stencil portion of the image effect shader to any other object produces a desirable stencil effect (aka: it works).

The Problem:

By the time OnRenderImage is called, it seems that the stencil buffer has already been cleared. Changing Ref to 0 in the Image Effect shader will apply the effect to the entire screen. Any other value will result in a black screen. This can only mean that the stencil buffer has been cleared to 0.

Is there a way to prevent the stencil buffer from clearing? Or is this the right method to use the stencil buffer with image effects? Or perhaps there are other solutions that are still efficient, without the use of Stencils?

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:
Lua GameDev iOS - Code on win and mac I am searching for a simple framework like http://getmoai.com where you can simply code a game in lua for iOS. I want to build it along with a friend. I am using a Mac, he prefers windows so the fw needs to be used in Windows 7. Preferably something like LOVE2D but then offcourse also for iOS!

Thanks in advance

sentences:
How 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: How to collect objects from map in blueprints I have a plate with trigger(TriggerVolume) on it. When it overlapped cubes from map deleting. I've manually created references on cubes in blueprint to delete them but it seems very hard-coded. Is there any way to collect all references with "for loop"? And for more clarity - I'm using FPS template for this project.

sentences:
How to check if a variable is an integer? I'm going through my C++ book and have currently made a working Guess The Number game.

The game generates a random number based on current time, has the user input their guess, and then tells them whether it was too high, too low, or the correct number.

The game functions fine if you enter a number, but returns 'Too High' if you enter something that is not a number (such as a letter or punctuation). Not only does it return 'too high', but it also continually returns it.

I was wondering what I could do to check if the guess, as input by the user, is an integer and if it is not, to return 'Not a number. Guess again.'

Here is the code.

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
    srand(time(0)); // seed the random number generator
    int theNumber = rand() % 100 + 1; // random number between 1 and 100
    int tries = 0, guess;

    cout << "\tWelcome to Guess My Number!\n\n";

    do
    {
        cout << "Enter a guess: ";
        cin >> guess;
        ++tries;

        if (guess > theNumber)
                cout << "Too high!\n\n";

        if (guess < theNumber)
                cout << "Too low!\n\n";

    } while (guess != theNumber);

    cout << "\nThat's it! You got it in " << tries << " guesses!\n";
    cout << "\nPress Enter to exit.\n";

    cin.ignore(cin.rdbuf()->in_avail() + 1);
    return 0;
}

sentences: Farseer Physics for Xna missing ConvertUnits class Im using Farseer Physics with Xna 4.0. Im following a starter guide. It said that to draw, I need to convert the meters to pixels with the ConvertUnits namespace. I looked through all of the engine, but I cant find the ConvertUnits class. Im basicly stuck without it. Where is it stored, or do I need another resource?

sentences:
In today's video game industry, why isn't every game released on PC? In this day and age, you absolutely must use a computer to make a video game; and, no, "users making their own content using our editor built into the game itself" doesn't count. I'm talking about the base game that you purchase to use that editor.
Given that you made the game using a computer and special hardware is required to test/run it on anything else (PS4/5 Dev machines, etc). Why do games come out on, say, just a console? The basic testing prior to copying files over to a console for specific-issue testing is performed on a computer, programming is done on a computer, compiling is done on a computer, etc.
You actually have to do more work to release something exclusive to a console.
So, to re-iterate, why aren't games always released for home computers?

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

sentences:
PHP browser game energy recover time I would like to create something very simple. A browser game, where user can waste its energy and ability points. Unlike other games here there won't be no levels. So energy and ability points restore with the time.

How can I do that in the most efficient way?
For example, i have 100 energy points, one point restores every 2 min.

I was thinking about cron-jobs, but that will be not so efficient.

Thank you in advance!

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:
What is Opengl ES ? What is gl and GLES20 mean? I am new in opengl. I saw tutorial some have gl at the beginning and some have GLES20 at the beginner and some has GL10.

What are the differences? Is GLES20 mean opengl es2 whereas GL10 mean version 1

sentences:
I need some help with stopping individual sound effects in OALSimpleAudio I'm trying to find out how to stop a specific sound effect rather than having to stop all of them.

I'm using OALSimpleAudio.

I can't seem to find how to do it. simple google searches result in nothing, which means my searches are crap, it's REALLY easy to do and i'm ... stupid :p, or it isn't possible.

I hope you guys can help me.

In the background i have a humming engine sound, but when the object takes damage, the humming sound is stopped, that's not what i want.

case kStateTakingDamage:
        CCLOG(@"Ship taking damage");
        [self playTakingDamageSound];
        self.characterHealth = self.characterHealth - 1.0f;
        action = [CCActionAnimate actionWithAnimation:damageAnimation];
        [[GameManager sharedGameManager] stopSoundEffect];
        break;

- (void) playSoundEffect: (NSString *) soundEffect {
    [self playSoundEffect: soundEffect andLoop: NO];
}

- (void) playSoundEffect: (NSString *) soundEffect andLoop: (BOOL) loop {
    [[OALSimpleAudio sharedInstance] playEffect:soundEffect loop: loop];
}

- (void) stopSoundEffect {
    [[OALSimpleAudio sharedInstance] stopAllEffects];
}

- (id) isSoundPlaying {
    //TODO: find out how this works ;
}

sentences:
How can I optimise collision checks for a large number of AI units? Let's say I got 100 Orcs in my 3D world and they all aim to kill each other.

That means for every 1 Orc I have to check for collision with the 99 others. That will give me 99^2 which is about 10,000! That many collision checks every update (24-60 times a second) only for the AI will probably use my whole GPU + CPU.

How can I handle such a large number of AI?

How is this is done in games with large numbers of NPCs (e.g. Skyrim, Fallout, Red Dead Dedemption...).

sentences:
Should a game clean up after itself when exiting? Should a game/engine clean up after itself(close windows, shut down renderers, close files, free memory) when its closed?

The OS should do that anyway, and usually in a faster way.

I guess most developers don't really care as they need proper cleanup for everything anyways(With dynamic asset-loading, and changing maps, etc.), but won't ensure that everything gets cleaned perfectly.

But is there any positive to cleaning up vs not cleaning up or the reverse?

I am using C++.

What about game consoles? Do they all clean up after themselves?

sentences:
The most correct/efficient way to update millions of entities that change over time in an mmo? We have a server and a database in the cloud. We have a game where each player can grow a farm on a massive x,y grid. Each hour is a grow cycle. All players can harvest anyone's plants.  Player A plants some seeds and logs off. Player B logs in five hours later and harvests Player A's plants. At 3:00 PM there is a global rain on the x,y grid that gives plants a bonus grow cycle.

scenario 1: The server timestamps each players actions and the global rain adds a counter to global effects, which is read when the player logs in and applied to the area they see, this effect can only happen once per day and removed by nightly maintenance.

Player A: Plants seeds 1:00 PM. (Server timestamps plant entities with 1:00 PM) and logs off.
Player B: Logs on harvests seeds at 6:00 PM (Plants grow cycle is 5 + 1 (rain)) = 6. (the grow cycle is calculated when Player B sees the plants in his view area)

scenario 2: The server does global updates on all entities.

Player A: plants seeds 1:00 PM. (no time stamp). Logs off
grow cycles occur each hour: 2:00 PM +1, 3:00 PM (rain) +2 etc.
Player B: Logs on and harvests the plants.

Scenario one seems like the best case, with also checking the view area around the player and updating plants on the hour or after a rain so the player that is staying logged in will see the plants grow.

I feel like I am missing something, such as a global save on server shutdown.

Are both scenarios useful for different functions?

sentences:
physics engine without time steps I'm looking for physics engines that doesn't use time steps. I don't think time steps are reliable, and I don't like how without tweaking the engine a bullet going too fast can pass through a wall without colliding it. Moreover I suspect they do a lot of unnecessary computations.

I thought of a physics engine concept where all the movements are represented by forces and movement beginning time. In such an environment as long as no event occur the engine would not do any computation.

I imagine the following:

I shoot a bullet in space, an object is created representing its physics properties.
The engine compare the bullet trajectory with other's to find if it's gonna collide with an other object.
It finds a collision, in 3 seconds.
An callback is programmed to trigger in 3s to process the collision.
In the meantime if no other event occur (like shooting an other bullet, changing an object trajectory, etc...) no other computation is done.

Does such an engine exists?
Is there a name to this technique?
Have you ever tried using this approach?

sentences:
How to detect a touch on transparent area of an image in a (libgdx) stage? Can some one please help to detect a touch on an image which I am using as an actor in a stage. The image is actually a long diagnol brush which has plenty of transparent area. The problem is when I touche the transparent area of the brush image it is also triggering the clicklistener of the image. I need the click listener should only be called when the finger actually touched the visible image not the area which is empty.

I am using libgdx-0.9.4 libraries. Here is my simple piece of code.

import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ClickListener;

Image brushImg = new Image(ImageCache.getTexture("brush"));
brushImg.width = mStage.width()*0.75f;
brushImg.height = mStage.height()*0.75f;

brushImg.setClickListener(new ClickListener() {

@Override
public void click(Actor actor, float x, float y) {
    SoundFactory.play("brush");
}

sentences:
How To Destroy/Deactivate one enemy without affecting other enemies of the same type? In my game, you jump on zombies'heads to squash them.

Currently I'm only able to have one zombie in my game. When I add another (duplicate or drag from prefab), then run the game, I can squash one enemy but when I try to jump on the second zombie's head it says "Coroutine couldn't be started because the game object "Zombie (1)" is inactive".

Here's the player's stompbox script code & below that the ZombieController script code:

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

public class StompEnemy : MonoBehaviour {

    private Rigidbody2D playerRigidbody;
    public ZombieController zombieController;

    public float bounceForce;
    // a bounce force of 12 is wonderful (set in unity's inspector)

    // Use this for initialization
    void Start () {
        playerRigidbody = transform.parent.GetComponent<Rigidbody2D>();
        zombieController = FindObjectOfType<ZombieController>();
    }

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

    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if(other.tag == "Zombie")
        {
            zombieController.Stomped();
            playerRigidbody.velocity = new Vector2(playerRigidbody.velocity.x, bounceForce);
        }
    }

}

Now here's the ZombieController script code:

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

public class ZombieController : MonoBehaviour {

    Animator zombieAnimator;
    Rigidbody2D myRigidBody;
    [SerializeField] float moveSpeed = 1f;

    public bool isAlive = true;

    // Use this for initialization
    void Start () {
        zombieAnimator = GetComponent<Animator>();
        myRigidBody = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update () {
        if (!isAlive) { return; }
        if (isFacingRight())
        {
            myRigidBody.velocity = new Vector2(moveSpeed, 0f);
        }
        else
        {
            myRigidBody.velocity = new Vector2(-moveSpeed, 0f);
        }
    }

    bool isFacingRight()
    {
        return transform.localScale.x > 0;
        // if it's positive he's facing right, and if negative, facing left.
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        transform.localScale = new Vector2(-(Mathf.Sign(myRigidBody.velocity.x)), 1f);
    }

    public void Stomped()
    {
        isAlive = false;
        transform.localScale = new Vector2(-(Mathf.Sign(myRigidBody.velocity.x)), 1f);
        zombieAnimator.SetBool("Squash", true);
        if (isFacingRight())
        {
            myRigidBody.velocity = new Vector2(Mathf.Epsilon, 0f);
        }
        else if (!isFacingRight())
        {
            myRigidBody.velocity = new Vector2(-Mathf.Epsilon, 0f);
        }
        gameObject.layer = 11;
        StartCoroutine(WaitXSecond());
    }

    public IEnumerator WaitXSecond()
    {
        yield return new WaitForSeconds(2f);
        gameObject.SetActive(false);
        zombieAnimator.SetBool("Squash", false);
    }

}

How do I implement multiple zombies using the same script attached to each one?

When I've tried having three zombies I'd jump on the first one's head and another zombie would die (show the squashed animation, then disappear after two seconds) and the remaining zombies would no longer be jump-on-head-able, displaying the coroutine error above.

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

bird

-Outline

--mask

--filler

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

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

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

Here is the GIF to explain the issue:

Any idea what the issue here?

sentences:
What is the meaning of >> and & in this code context and what they are trying to accomplish? I am following a tutorial on YouTube for making a 2D game. There is no clear explanation on what its actually doing.

I get bit-shifting and & operator but I don't know what they mean in this context and I understand basic Java implementation.

I've done some basic trial and error with the below code by seeing how it works, I see the effects happening but don't quite comprehend on what it is supposed to be doing in the code.

Could someone please explain how the lines marked with "//*******" work in the given context?

public class Screen {
    public static final int MAP_WIDTH= 64;
    public static final int MAP_WIDTH_MASK= MAP_WIDTH - 1;
    public static final int PIXEL_SIZE= 8;
    public static final int PIXEL_SIZE_MASK= MAP_WIDTH - 1;
    public int[] tiles = new int[MAP_WIDTH*MAP_WIDTH];
    public int[] colours = new int[MAP_WIDTH*MAP_WIDTH*4];
    public int xOffset = 0;
    public int yOffset = 0;
    public int width;
    public int height;
    public SpriteSheet sheet;
    public Screen(int width, int height, SpriteSheet sheet) {
        this.width = width;
        this.height = height;
        this.sheet = sheet;
        // ************ explain what the for loop is doing
        for(int i=0; i< (tiles.length); i++) {
            colours[i*4+ 0] = 0xff00ff;
            colours[i*4+ 1] = 0x0000ff;
            colours[i*4+ 2] = 0xffff00;
            colours[i*4+ 3] = 0xffffff;
        }
    }
    public void render(int[] pixels, int offset, int row) {
        //current x and y offset is 0 meaning that the player/map isn't moving in either direction - changing them repeats the map
        // >>3 - same as multiplying by 8 (size of pixel)
            //(0 * 8 ) + yOffset,        (height * 8) + yOffset
        // ************ what is the >> doing in this context?
        for(int yTile = (0 + yOffset) >> 3; yTile<=(height + yOffset) >> 3; yTile++) {
            // ************ what actually is yMin?
            int yMin = (yTile * PIXEL_SIZE) - yOffset;
            // ************ what actually is yMax?
            int yMax = yMin + PIXEL_SIZE;
            //sanity check if you go off the map - otherwise would crash
            if (yMin<0) yMin=0; // yMin could be below 0 because of the yOffset variable being changed is greater than (yTile * PIXEL_SIZE)
            if (yMax>height) yMax = height; // yMax could be above height because of the yOffset variable being changed
            // see above; applies to xTile as well
            for(int xTile = (0 + xOffset) >> 3; xTile<=(width + xOffset) >> 3; xTile++) {
                int xMin = (xTile * PIXEL_SIZE) - xOffset;
                int xMax = xMin + PIXEL_SIZE;
                if(xMin<0) xMin=0;
                if (xMax>width) xMax = width;
                 // ************ obviously this gives current tile you're on but what does & do in this context?
                int tileIndex = (xTile &(MAP_WIDTH_MASK)) + (yTile &(MAP_WIDTH_MASK))* MAP_WIDTH;
                for (int y = yMin; y < yMax; y++){
                    // ************ what does & do in this context?
                    int sheetPixel = ((y + yOffset) & PIXEL_SIZE_MASK)*sheet.width + ((xMin + xOffset)& PIXEL_SIZE_MASK);
                    // ************ is the tilePixel individual pixels in the tile?
                    int tilePixel = offset + xMin + y * row;
                    for(int x = xMin; x< xMax; x++) {
                        // ************ what is tileIndex * 4 doing?
                        int colour = tileIndex * 4 + sheet.pixels[sheetPixel++];
                        pixels[tilePixel++] = colours[colour];
                    }
                }
            }
        }
    }
}

sentences:
Question of tilesheet efficiency For a 2d side scrolling game made in Java, should I make a sprite sheet for my character walking left and for walking right, or should I just do the one, and flip it when it loads?

Also, the way I've been doing it, both left and right would be in the same image file, if that makes any difference.

sentences:
When to call GLBindTexture when using a spite-sheet? Originally, I was using individual textures (ie, individual .png files) for my sprite's animation and recently altered my code so that I could put all my animation frames into 1 file (so it basically is like a mini sprite sheet - I say 'mini' because I'm using 1 file per sprite, I'm not using 1 file for all my sprites).

Anyway my question relates to glBindTexture.  Originally, I was switching textures when I wanted to update the animation frame so was calling this in my sprite's draw method:

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texID);  //texID being the texture ID

However, now what happens is that I work out the texture offset and just point to part of the texture that I require.  The texture itself does not change anymore, so do I still require this line every time I draw?

I tried removing the line from my draw() method and just calling it once when I loaded the texture initially, but the sprite doesn't draw with the correct texture, it uses a completely different, un-related texture.  So what is the correct course of action in cases like this where a sprite-sheet is being used?

At the moment, I'm not sure why this would be any faster than using individual files and switching the texture every frame.  In fact as I'm now having to work out the texture offset (whereas previously it was fixed), there is more overhead.   So I'm guessing the advantage comes from not having to call this glBindTexture line every time I draw (as it's expensive). So how do I correctly choose the texture to assign to this sprite other than within the draw method?

Any help would be appreciate, if you need code please ask I didn't post my whole draw method as I didn't think it was necessary to explain the issue.

This is what I was doing previously

Bind texture 1 (Animation frame 1, textures 1-8 belong to this sprite)
Draw Sprite 1

Bind texture 9
Draw Sprite 2

Repeat binding texture 2, then 3 etc for sprite 1 to animate it

I am now using a single texture for sprite1 which contains all 8 animation frames

Bind texture 1 (all frames)
Draw Sprite 1 (pointing to frames 1, 2, 3 etc)

Bind texture 5
draw sprite 2

sentences:
Slick 2D Image move along with shape I am trying to move my image along with the shape so I can make the collider with the shape (some kind of space shooter) but my image does not move along with the circle I make for it. It dissapears to the next spawned circle instead of completing it's track towards the bottom of the screen (I want to make a vertical linear move from top to bottom but everytime another circle+image spawns, the previous circle goes down but the image spawns to the next circle and so on)

update method:

    timePassed+=delta;
    if(timePassed>700){
        timePassed=0;
        RandomInt = random.nextInt(400);
        gigis.add(new Circle(200+RandomInt,0,40));
        gigiSkin.add(new Image("img/gegi.png"));
    }

    for(Circle c: gigis){
        c.setCenterY(c.getCenterY()+(delta/6f));
        gigiY= c.getCenterY()+(delta/6f);
    }

    for(Circle c: bullets){
        c.setCenterY(c.getCenterY()-(delta/1.25f));
        projY = c.getCenterY()-(delta/1.5f);
    }

render method:

    for(Circle c: bullets){
        g.draw(c);
    }
    for(Image skin: bulletSkin){
        skin.draw(projX,projY,80,80);
    }

    g.setColor(Color.red);
    for(Circle c: gigis){
        g.draw(c);
    }
    for(Image skin: gigiSkin){
        skin.draw(200+RandomInt,gigiY,80,80);
    }
}

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

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

sentences:
Mac OSX GLFW Fullscreen Crash Whenever I run my code to make a fullscreen GLFW window, it crashes.

Here is the code:

package ext.tpz.test;

import static org.lwjgl.glfw.GLFW.*;

public class Main {

    public Main() {
    }

    public static void main(String[] args) {
        if (glfwInit() == false) {
            System.out.println("GLFW failed to init.");
            System.exit(1);
        }
        long fullscreen = 0;
        if(args.length >= 1) {
            if (args[0].equals("-fullscreen")) {
                fullscreen = 1;
            }
        }
        long win = glfwCreateWindow(640,480, "Test", fullscreen, 0);

        glfwShowWindow(win);
        while(glfwWindowShouldClose(win) == false ) {
            glfwPollEvents();
        }

        glfwTerminate();
    }
}

Here is the crash report:

  A fatal error has been detected by the Java Runtime Environment:

  SIGSEGV (0xb) at pc=0x000000012dd11841, pid=13565, tid=1811

  JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
   Java VM: Java HotSpot(TM) 64-Bit Server VM (25.65-b01 mixed mode bsd-amd64 compressed oops)
   Problematic frame:
   C  [libglfw.dylib+0x9841]

  Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

  An error report file with more information is saved as:
   /Users/a677c774/IdeaProjects/LWJGL 3 Tests/hs_err_pid13565.log

  If you would like to submit a bug report, please visit:  http://bugreport.java.com/bugreport/crash.jsp
  The crash happened outside the Java Virtual Machine in native code.
   See problematic frame for where to report the bug.

  Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

sentences:
Direct3D 11 : Pixel shader and Vertex shader getting set at every draw call I'm working on my own (much tinier) version of Monogame. Right now I've been able to draw triangles to the screen with custom shaders using Direct3D 11. The problem is that I can't get it to be as perfomant as Monogame. I did some graphics debugging and noticed something :

The above picture is my implementation and the other is Monogame. For some reason the pixel shader, vertex shader and constant buffers are assigned at every draw call. I don't understand why this is happening since in my code I only ever set those parameter once an then draw a buffer containing 2 triangles 1000 times (as a performance test).

sentences: GMod Lua Scripting - Playing sounds only for specified player entities I'm making a game mode for Garry's Mod, and I'm trying to write a system in which I play sounds only for certain players. The problem I'm running across is that doing so from server-side would take a lot of bandwidth, but I'm not sure how I could reliably do it from the client side. None of the Garry's Mod sound functions seem to take player entity arguments, and surface.playsound would resort back to the method of server telling the client what sounds to play for every sound played.

sentences:
Python/PyGame mixer.music playback of OGG file has intermittent clicking sound - how to proceed? I have a class within my python + pygame game that handles sound - it worked well until I tried use pygame.mixer.music to switch between streaming .ogg music files. The class switches between them on the pause event.

The issue I'm having is that the music will play, and even switch between tracks fine, but about half the time I'm getting a quiet, regular clicking noise over the sound track. I've checked, and the pygame mixer is set to the same bitrate as my .ogg files. I've tried playing with number of channels and tracks, all to no avail. I'm not sure what the root cause of the clicking is - whether I've chosen a poor file encoding / bitrate, or just not initialized/called pygame mixer correctly.

Here is the problimatic code:

class SoundMgr():

def __init__(self):
       pygame.mixer.init(22050, -8, 4, 4096)
       self.musicFilename = ""
       self.musicPos = 0
       self.musicVolume = .35
       self.musicMuteVolume = .1

def playMusicTrack(self, which):
    pygame.mixer.music.load("data/music/" + which + ".ogg")
    pygame.mixer.music.set_volume(self.musicVolume)
    pygame.mixer.music.play(-1)
    self.musicFilename = which

def dampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + "b.ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicMuteVolume)

def undampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + ".ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicVolume)        </code>

When I call dampenMusic / undampenMusic the track plays correctly, but about half the time it has a clicking sound over it. The other half of the time it plays perfectly. I've tested, and I can't discover any pattern to when it will / won't have the static.

The clicking noise is about 2 times a second, and is about 50% the volume of the track.

Anyone who is more experienced with pygame / sound encoding able to give me any tips?

sentences: How to get the point of collision in Separating Axis Theorem? I'm interested in the relatively precise point (not line) of collision for calculating angular velocity on impact for use in a impulse calculation. At first I thought, perhaps naively, that I could use the closest point along the shortest overlapping axis, but closest to what exactly?

sentences:
Direct3D11: Directional Shadow Maps I've recently implemented shadow maps on my project.  However, I'd like to add a feature that allows the light direction to be dynamically changed, so that the terrain can be viewed using different light angles.  Unfortunately I'm struggling to understand how to do this, as I'm not sure how to 'fake' the position of the light to create a depth texture from.

Essentially, I want to mimic the sun and I'm having trouble getting my head around the fact that directional lights do not have a position, so how can I create a fake position to render the shadows from, while still keeping my scene in view of the orthographic projection.

I'm currently setting up my lights matrices in this way:

    mPosition = XMFLOAT3(-30.0f, 30.0f, -30.0f); //Bottom left corner
    mProjMatrix = XMMatrixOrthographicLH(400.0f, 120.0f, 1.0f, 1200.0f);
    XMFLOAT3 la3 = XMFLOAT3(126.0f, 0.0f, 126.0f); //Look at center
    XMFLOAT3 up3 = XMFLOAT3(0.0f, 1.0f, 0.0f);
    XMVECTOR eye = XMLoadFloat3(&mPosition), la = XMLoadFloat3(&la3), up = XMLoadFloat3(&up3);
    mViewMatrix = XMMatrixLookAtLH(eye, la, up);

    mViewProjMatrix = XMMatrixMultiply(mViewMatrix, mProjMatrix);

And you can find the pixel shader I use here.

Thank you very much for your time

sentences:
Blender-to-Unity Animation Issue I've been programming games for quite a few years now, but I recently thought I would try my hand at some simple 3D modeling and animation.  I'm currently using Unity and Blender.  In Blender, I was able to make a model and animate it using bones without too many issues.  I created an extremely simple walking animation for my basic character I modeled.  However, when I import it into Unity, the left leg always does a weird rotation around its Y axis halfway through the animation.  All the other parts work just fine.  I messed with it forever trying to fix it.  Eventually, I created a whole new skeleton from scratch, and it's still doing the exact same thing.  I've exported it in every format that Blender/Unity support and the issue persists.  I've included some screenshots below to better describe my issue.

The animation starts out fine.  All I'm doing here is rotating the left leg up and back down.

We've moved up a little further. Still going good.

Right about halfway up, the leg spins quickly once around its Y axis.

It spins all the way around and stops back where it's supposed to be in about half a second.

Then it continues on normally until it reaches the top.  One the way back down, it does the exact same thing at the exact same spot, just in reverse.

My animation in Blender plays perfectly and is very simple.  It's just a rotation on a single axis over 60 frames.  The screenshots are from my most recent attempt (I've done this animation at least a dozen times now.)  So all I did was just try animating the left leg and nothing else.

This never happens with any other bones.  The right leg animates perfectly, the arms animate just fine, etc.

Any help would be greatly appreciated.  Like I said, I'm very new to all of this.  This is my first attempt at modeling and animating.  I apologize if I missed something obvious.  I've been Googling for an answer to this issue for two days now.

sentences: In Physijs, how do I detect that an object is still? I have a cylinder that simulates a flipping coin. I am using Physijs. The coin might bounce off the surface multiple times before stopping. How can I know when the coin has completely stopped moving?

sentences:
How can I model a star? I'm trying to model a star in Unity, and it, sort of works, but it's not ideal. Currently, I'm using a large sphere with a self-illuminating material containing a star texture applied to it's surface, and a spotlight to create the effect of starlight, like this:

While it works, it doesn't look the greatest. I'm looking for an effect more along the lines of how Kerbal Space Program models a star:

How can I achieve this effect?

sentences:
List of Lists for sending paths from client to server? I have a client server scenario and I'm looking into distributed AI. I want the server to move x amount of ai characters around a map by pathfinding and then send the x amount of paths to the client which will apply each path to its corresponding AI character. This is for research purposes to see if this approach, by sending the new path of each server AI to the client AI for it to follow, is better than constantly sending a positional update across a network everytime a server gameobject moves slightly. I would like this X amount to range anywhere from 10 to 2000, a big ask i know, but i'll go into what I have atm.

Atm I have this working for 2 AI characters and it can be expanded, but with my existing code it would mean an awful lot of copying and pasting! So on the server when the path is created it is sent to a script which can bundle it into an RPC an send it on its way:

public class GrabbingArrayFromUnitScript : NetworkBehaviour {

public List<Vector3> receivedArrays = new List<Vector3>();
public List<Vector3> receivedArrays1 = new List<Vector3>();

    [ClientRpc]
    void RpcPosFromServerToGoTo(Vector3 [] path, String name)
    {

    if (name == "SeekerPrefab")
    {
        receivedArrays.AddRange (path);
        UnityEngine.Debug.Log ("Received");
    }
    if (name == "SeekerPrefab (1)")
    {
        receivedArrays1.AddRange (path);
        UnityEngine.Debug.Log ("Received 1");
    }

    }

public void PrintPath(Vector3 [] path)
{
    if (isServer)
    {
        UnityEngine.Debug.Log("Send Array ...");
        RpcPosFromServerToGoTo (path, transform.name);
        UnityEngine.Debug.Log("Sent!!");

    }
}

}

So as you can see from the above if I wanted to add more AI characters in I would have to add more if statements to the RPC call, and if I wanted 2000 AI in that would be alot of copying. So what could I do here to reduce this code down? Would I use a list of lists? Any help would be greatly appreciated!

sentences:
enemy View Range , chase player for 3D:
Q1 : I want to make zone range for each enemy in the game , so that when the player in the view range he will be chased .

Q2 :if I want to make enemy walk a little bit around his position ( from -10  to 10 ) for example , i.e as he is searching for some one , can you give me just steps ! thanks

Q3 : How to make enemy moves toward Player if he is being detected ?
Sorry for question , but I am new to this world :)

sentences:
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:
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:
Resizing canvas to match screen size in Unity WebGL I'm learning how to make a browser game with Unity. I have set up the screen display dimensions to 960 x 640 (I read that it's a safe resolution to use. Feel free to correct me). I created a Canvas and set it to match with width or height, and I set Reference Resolution to 960 x 640.
The problem is that the canvas doesn't match the screen properly and empty leaves bars at the top and bottom. I get the same result using both Render Modes for Camera and Overlay. I understand that the matching options choose either width or height, depending on the slider setting.
Can I somehow match the canvas to the display properly?
Screenshot of the Canvas
Screenshot of the Canvas setting
Screen as displayed in the browser

sentences:
Simple Update loop to show questions one at a time I have two lists which work with an XML file which holds questions and answers. At the moment the project displays all the questions at the same time so they "flicker" on the screen and iterate between each item in the list.

Whats the easiest way (coding) to pause the random generated list on any particular questions?

Question class:

class question
{
    public string questionString;
    public string apple;
    public string pear;
    public string orange;

    //the ? indicate the int can be nullable so it can accept the string item
    int? correctAnswer;

    public question(string newquestionString)
    {
        parseQuestion(newquestionString);
    }

    public void parseQuestion(string newquestionString)
    {
        List<string> questionComponents = newquestionString.Split('|').ToList<string>();

        questionString = questionComponents[0];
        apple = questionComponents[1];
        pear = questionComponents[2];
        orange = questionComponents[3];

        correctAnswer = Int32.Parse(questionComponents[4]);

    }

In Game1:

    Random q = new Random();
    int i = q.Next(questions.Count);

    spriteBatch.Begin();
    spriteBatch.DrawString(myfont, questions[i], new Vector2(100 + 100 *i, 100), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].questionString, new Vector2(100 + 100, 100), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].apple, new Vector2(100 + 100, 200), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].orange, new Vector2(100 + 100, 300), Color.Black);
    spriteBatch.DrawString(myfont, myQuestions[i].pear, new Vector2(100 + 100, 400), Color.Black);
    spriteBatch.End();

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:
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:
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:
Unity3D - How to make partially selected EditorGUI.Toggle? I have nested group of toggles created with EditorGUILayout.ToggleLeft().

I want to change state of the parent toggle to partial check if child toggles have mixed states, like here:

But EditorGUILayout.ToggleLeft value is a boolean value, so how can I do that?

sentences:
Dealing With Multiple requestAnimationFrame Calls I am having issues with requestAnimationFrame calls stacking on top of each other. I am developing a platformer game, which has three separate functions that need animating (main menu, cutscene, in game). Currently, I have flags to determine when to run requestAnimationFrame. For example, I only call requestAnimationFrame in the runCutscene() method if !onMainMenu and !inGame. These flags are reset in the init() method, which decides which of the three methods to run.

Specifically, my problem occurs when I return to the main menu from the cutscene (at seemingly random times, I can not continuously replicate the error). The main menu appears to run at double its normal speed (which I assume is because of stacked requestAnimationFrame calls).

What is the most efficient way to call requestAnimationFrame? If I put the requestAnimationFrame call in the init() method, the game breaks. Thank you in advance.

sentences:
Dealing with sprite loading and setting in an entity-component system I've just started using an entity-component system for the first time and I'm having trouble making some decisions.

Currently I've got a SpriteComponent that holds a sprite, a ContentManagerComponents that holds an instance of a content manager so systems can load the content they need, and a SpriteSystem that requires both components and only has a method to set the sprite, possibly loading it beforehand (sprite rendering and animating is taken care of by other systems).

This kinda looks good, but my main concern is... how is a system that's not SpriteSystem supposed to set the sprite?

Here are my options, as I see them:

Have systems that need to change the sprite comunicate with SpriteSystem somehow. Probably a bad idea since it introduces a dependency between systems (?).
Move the method to set the sprite to SpriteComponent. Problem is, the method needs a content manager to load the sprite if needed.
Get rid of ContentManagerComponent and give SpriteComponent a content manager. But the content manager doesn't only load sprites.

Any help is appreciated.

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:
Networking for Real Time Strategy games I'm developing a real time strategy game for a computer science course I'm taking. One of the harder aspects of it seems to be client-server networking and synchronization. I've read up on this topic (including 1500 archers), but I've decided to take a client-server approach as opposed to other models (over LAN, for instance).

This real time strategy game comes with some problems. Thankfully, every action the player takes is deterministic. However, there are events that happen on scheduled intervals. For instance, the game is made up of tiles, and when a player takes a tile, the 'energy level', a value on that tile, should grow by one every second after it's taken. This is a very quick explanation that should justify my use case.

Right now I'm doing thin clients, which just send packets to the server and wait for a response. However, there are several problems.

When games between players develop into endgame, there are often over 50 events per second (due to the scheduled events, explained earlier, piling up), and synchronization errors start to show up then. My biggest problem is that even a small deviation in state between clients could mean different decisions the clients take, which snowball into entirely separate games. Another problem (which isn't as important right now) is that there is latency and one has to wait a few milliseconds, even seconds after they make their move to see the result.

I'm wondering what strategies and algorithms I could use to make this easier, faster, and more enjoyable for the end-user. This is especially interesting given the high amount of events per second, along with several players per game.

TL;DR making an RTS with >50 events per second, how do I synchronize clients?

sentences: Is it legal to copy stats and abilities of characters from another game? Is it legal to copy stats and abilities of characters from another game?.Please note that my game does have a similar gameplay to the game I am copying. My characters will look different of course.

sentences:
Changing multisample count or disable/enable multisampling while the program runs? How can I disable or enable multi-sampling live while the program is rendering?

I tried this.

    public override void Draw(GameTime gameTime)
    {

        GraphicsDevice.PresentationParameters.MultiSampleCount = 0;

        ... draw stuff ...

    }

But it doesn't disable the multisampling while drawing, because setting "PreferMultiSampling" to true under the presentation parameters when starting the program apparently overwrites this. Or am I wrong?

How can I do this?

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:
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:
Monogame Startup Memory Spike I am currently porting a game from WP7 using XNA to WP8.1 using MonoGame. I have been putting considerable effort into optimizing my game to be under the 185MB memory limit for low-memory phones.

I was making headway until I discovered a memory spike on startup. I continued to reduce the quality of my assets until the memory usage (while the game is running) is at about 140MB. However, on startup, the memory usage spikes to 205MB, sits there for about 10 seconds, and then drops to standard operating memory usage. It does this every time. Increasing or decreasing the asset sizes only changes how high the spike goes and the usage in general, but it does not change the 10 second delay at all.

One idea I thought about was to delay the user with a longer splash screen, giving me time to load all the assets without blowing the hatch. But this seems to me like detracting from the user experience out of convenience.

Any ideas? Has anyone else had this problem?

sentences:
Texas hold'em game logic loop Ok, so I was thinking of making a Texas Hold'em game, and I wanted to write down the game logic loop before starting. Here's what I have. Tell me if I missed anything or if anything is wrong.

Game sets or determines the number of players.
Game hands out 2 cards to each players.
Game takes a minimum amount of tokens from each player
Game lets players fold, play, or raise
If someone raise, the game let's other players fold or play, and then loop through the players who decided to play, but haven't put in the amount of required tokens.

If someone goes all in and one other person accepts, then the cards
of both players are shown.

Game draws 3 random cards and show it to the players.
Steps 4 to 5 are repeated to the player who didn't fold.
Game draws 1 more card and show it to the players
Steps 4 to 5 are repeated to the players who didn't fold.
Game draws 1 more card and show it to the players.
One player wins the lot
Repeat until one player is left.

Is this the correct loop? Is there anything to add or modify? Can you make this clearer?

sentences:
Word Puzzle: Less or more difficult I'm working on an app which is a Word Puzzle. Player has to arrange about 10 words in correct order to solve it.
I have two options to build it:

Give user feedback (right or wrong) when he has put each word
Give user feedback (right or wrong) when he has put all words

In first option, the player gets quick feedback (as early as putting first word). But it is easy to brute-force the puzzle and hence the difficult of the game is low.
In second option, the player has to wait for long time (until he/she puts all words). But the puzzle is difficult to brute-force and the difficulty of the game is high.
I'm not sure which option should I choose?

sentences:
How to handle player actions in a multithreaded gameserver I'm working on a multiplayer game, and today I implemented basic "spatial hashing" in my entity-component-system.

Before implementing that algorithm, I was sending players actions to all connected players :

public void onPlayerMovement()(auto ref PlayerMovementMessage message, ClientSocket socket)
{
    this.m_gameServer.sendToAll(message);
}

My code is now :

public void onPlayerMovement()(auto ref PlayerMovementMessage message, ClientSocket socket)
{
    auto entity = this.m_gameServer.findEntity(socket);

    auto nearbyEntities = this.m_gameServer.world.getNearbyEntities(entity.get!PositionComponent().bucket)
        .filter!(e => e.hasComponent!PlayerComponent()).array();

    if(nearbyEntities.length)
    {
        this.m_gameServer.sendTo(nearbyEntities, message);
    }
}

As you can see im now calling this.m_gameServer.world.getNearbyEntities() from SpatialHashingSystem.d to get nearby players.

onPlayerMovement function is called by class GameServer.d in a new thread, so it might be called before SpatialHashingSystem.d executes his algorithm,
therefore calling getNearbyEntities() directly returns invalid data.

What can I do at this point ? Event system ? isnt that bad for a real time game ?

Thanks

sentences:
Collision Detection doesnt work because some things move more than 1px at a time I'm writing a 2d scrolling game in javascript using canvas and since I'm limited to setInterval running at minimum once every ms, I need to have some objects moving at greater than 1 pixel a second. I have this for collision detection between objects:

// ** oversee collisions
collisionsInterval = setInterval(function() {

    // outter object
    for(i = 0; i < objectsToCollision.length; i++) {

        // inner object
        for(j = 0; j < objectsToCollision.length; j++) {

            // dont compare an object to itself
            if(i==j) continue;

            // check if they touch on x axis
            if(Math.abs(objectsToCollision[i].centerX - objectsToCollision[j].centerX) <= (objectsToCollision[i].halfWidth + objectsToCollision[j].halfWidth)) {

                // check if they touch on y axis
                if(Math.abs(objectsToCollision[i].centerY - objectsToCollision[j].centerY) <= (objectsToCollision[i].halfHeight + objectsToCollision[j].halfHeight)) {

                    // a collision was detected, do something useful
                    alert();

                }

            }

        }

    }
}, 1);

The problem is, since it wont alert() when two things are about to touch because my objects move at more than 1px at a time. The problem is, some objects might move 3px at a time, some might move at 8px at a time, and I also have gravity occurring so in the Y direction especially the velocity of my objects will really vary.

In my code above objectsToCollision is an array which contains all the objects I'm checking for collisions with. I've modelled what I've done so far after this https://gamedev.stackexchange.com/a/587 but it doesn't discuss how to solve the problem I'm experiencing!

sentences:
What are the usual tools for importing models and animations? I'm a total noob with regard to game programming (though not a noob to programming) and I'm using pygame + opengl to do some experiments with a little game I've been thinking of.

I've been trying to import OBJ files into my pygame OpenGL "game", but there's apparently different formats of OBJ files, and writing a loader is a fairly nontrivial process. At least from my experience, which is not too large.

So I guess my question is: What do people generally use in the industry to read 3d model files? What about animation? Is there a place I can look into to understand?

Thanks,
Marcelo.

sentences:
Flixel Development in Ubuntu/Linux I've been trying to setup a development environment for Flixel on Ubuntu using this guide http://forums.flixel.org/index.php?topic=4545.0 but thus far have been unsuccessful mainly due to the guide being dated and using an outdated and inactive plugin for Eclipse (axdt).

I was wondering if anyone currently develops Flixel based games using Ubuntu/Linux, and if so how you got yourself setup. Ideally I would want to use an IDE like Eclipse but I would be open to other options.

sentences:
c# Unity - Matrix output incorrect on vector rotation I have a input Vector (1,1,0) when I run it through a  Unity Matrix4x4 class with a rotation of 90 degrees around the Z axis the output is (-0.9999999,1,0) which is nearly correct but strange. But (2,0,0) with the same degrees and axis rotation I get (1.192093e-07,2,0). The Y vector coordinate is correct, but why on earth is X set to 1.192093e-07? I cant explain why this is happening. I thought it would be set to (0,2,0).

The code I am using

using UnityEngine;
using System.Collections;

public class test : MonoBehaviour
{
public Vector3 translation;
public Quaternion rotation;
//public Vector3 eulerAngles;
public Vector3 input;
public Vector3 output;
public Matrix4x4 m;
// Use this for initialization
void Start ()
{
    //transform.rotation = Quaternion.Euler(60F, 0, 45F);
}

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

    input = new Vector3 (2, 0, 0);
    rotation = Quaternion.AngleAxis(90, Vector3.forward);
    m = Matrix4x4.TRS (Vector3.zero, rotation, Vector3.one);
    output = m.MultiplyPoint3x4(input);

    }
}

You can see Vector forward is the Z axis. I have scale as (1,1,1) and no transformation set. I have Unity set to 2D view. I have a main  camera with a Orthographic view, clipping plane near is 0 and far is 1000 and its depth is -1, its vector is (0,0,0).

When I use (2,0,0) as the input this is the result of the matrix

[E00] = 5.960464e-08 [E01]  = -0.9999999 [E02] = 0 [E03]  = 0
[E10] = 0.9999999 [E11]  = 5.960464e-08 [E12] = 0 [E13]  = 0
[E20] = 0 [E21]  = 0 [E22] = 1 [E23]  = 0
[E30] = 0 [E31]  = 0[E32] = 0 [E33]  = 1

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:
What is eigenvalue decomposition and why would it be useful in games? In various math libraries developed for game engines, I see 2x2 and 3x3 square matrices having this function (along with some helper functions). I tried to find information regarding it but did not come across game specific material (wikipedia entry is quite heavy and does not relate to games).

It would be great if in your answer, you could provide an example or two on how it is used in games.

sentences:
How to apply a color transform to textures when using pre-multiplied alpha? I'm trying to apply a color map to my textures. The map is a 4x4 matrix that adjusts the contribution of each RGBA channel returned from the fragment shader. My texture needs to use pre-multiplied alpha because it has transparent parts and I don't want artefacts when the color values at opaque/transparent boundaries are interpolated in the fragment shader.

Unfortunately, the only way I've managed to get this to work is by undo-ing the pre-multiplication step in the fragment shader which seems wasteful as it adds overhead (e.g. from the division). I'm wondering if it's possible to avoid this, perhaps by modifying the color map matrix before it's set as a uniform or by using a different blend function?

My blend function is currently: (ONE, ONE_MINUS_SRC_ALPHA)

I've tried to work through the matrix multiplication with and without alpha pre-multiplication but I get a bit lost. Any help would be appreciated. Here's my (abbreviated) fragment shader code:

precision mediump float;

uniform sampler2D u_texture;
uniform mat4 u_color_map;

varying vec2 v_texcoord;

void main() {
  vec4 color = texture2D(u_texture, v_texcoord);

  // Recover the RGB channels before alpha pre-multiplication.
  color.rgb /= color.a;

  // Apply the color map.
  vec4 mapped = v_color_map * color;

  // Re-multiply by alpha.
  mapped.rgb *= mapped.a;

  gl_FragColor = mapped;
}

Thanks

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:
Vector for bullet direction XNA C# im creating a platform shooter. the gun can be rotated using the thumbsticks. i want to use a line of fire newBullet.bulletVel variable as a Vector 2. this variable will be used to send the bullet in the direction that the barrel of the weapon is pointed at. How could i do this?

for gun rotation i have declared a float named rotation and use spritebatch.draw method to show that the variable is for rotation of the image.

public float WMrotation;

public void UpdateMe(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y < -0.1)
        {
            WMrotation += 0.03f;
        }
        if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y > 0.1)
        {
            WMrotation -= 0.03f;
        }
    }

public void DrawMe(SpriteBatch sb)
    {
        sb.Draw(WMtxr, WMpos, null, Color.White, WMrotation, WMorigin, 1f, SpriteEffects.None, 0);
    }

ive set the bullet position when fired to be at the tip of the gun.

newBullet.bulletPos.X = player1.playerPosition.X + 15;
newBullet.bulletPos.Y = player1.playerPosition.Y + 15;

i think i need to use newBullet.bulletVel to calculate the vector in which the bullet travels

newBullet.bulletVel = i don't know what to put in here

Any help would be appreciated.

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:
How can I reference C# objects in GDScript (and vice versa)? I am using Godot Engine 3.0.6 Mono for Windows x64.
I am prototyping the majority of my project in C# before I rewrite the game in C++ for release. I installed this plugin mostly to help with testing and debugging value-sensitive functionality. To make this possible however, I will need to be able to make references to my C# classes from GDScript (or vice versa) for binding commands. I could not find any instructions on how to do this in the official documentation.
Can this be done currently in either direction?

Note: If the references are made from C# to GDScript classes, I need to be able to cast the Nodes respectively to make function calls.

sentences:
Can I run my own loading script during the Unity splash screen? Can I load data in the background while the Unity splash screen is up?  If so, how?

I am trying to run code during the splash screen, not just load assets.

I have not been able to find any information on this in Google or the Unity Documentation.

sentences:
Switching screens in a game I am working on a simple 2D game in Java.

I want the game to have an opening screen, instructions screen, and the screen with the game itself.

From the opening screen the user presses buttons to get to the instructions screen or to the game screen. From the instructions the user should be able to get back to the opening screen. When a game is finished, the user is automatically sent back to the opening screen.

I want all of this to happen in the same JFrame. Each screen should be a class that extends JPanel.

What would be the best way to do that? I thought of making a method inside the Main class (the one with the main() method), the switches screens and can be called from anywhere in the program.

But how will this method switch screens? What would be the best way to replace the JPanels?

Thanks a lot

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:
How to make the transparent parts of a sprite also clickable using a Raycast I have been making using the following code to add mouse clicks to my game objects.

RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
    if ((hit.collider != null && hit.collider.gameObject.name == gameObject.name)
    )
    {

    //do something here
}

I have a game object which I made using a sprite with transparent areas. I would like the transparent areas to also be recognized as the game object being clicked. I am not sure if this can be achieved using a raycast. If not, I am open to other ways of achieving the same result.

sentences:
What are the ways to deal with elevated tile blocking the view of the tile behind it? I'm trying to make an isometric tactical rpg type of game. One issue I encountered is that if I elevate an tile, then it starts to block the view behind it. The game is 2D, so there is no freely rotating cameras.

Example:

Flat ground with a person on the top tile

Elevated ground blocking the person

Some of the options that I've thought about include:

When the character is blocked by a tile, display the outline of the character. But I don't like this option because it kind of breaks immersion, and makes it difficult to do "surprise" kind of factor where an enemy character jumps out from behind a blocked tile.
Have the option to rotate the camera by 90 degrees, 180 degrees, and 270 degrees, so you can have see all around it. However, this still doesn't solve the issue where if you have a 4 really tall tiles blocking a single tile in between since no matter how you rotate it, it's still being blocked.
Bigger character and smaller elevation so that even when there's elevation, you can still see part of the character behind it. This only mitigates small elevation differences like hills, but not when you are trying to make a cliff type of terrain.
Have only higher tiles near top of the map, and lower tiles near the bottom. This avoids blocked tile completely, but sets constraints on map making.
Have the option to toggle flattening the map. Such that when turned off, you can see the elevation but blocks the tile behind, and when it is turned on, you don't see elevation, but you can see all tiles.
Combination of the above

So the question is, is there any other ways to solve this issue?

sentences:
How to improve batching performance I am developing a sprite based 2D game for mobile platform(s) and I'm using OpenGL (well, actually Irrlicht) to render graphics. First I implemented sprite rendering in a simple way: every game object is rendered as a quad with its own GPU draw call, meaning that if I had 200 game objects, I made 200 draw calls per frame. Of course this was a bad choice and my game was completely CPU bound because there is a little CPU overhead assosiacted in every GPU draw call. GPU stayed idle most of the time.

Now, I thought I could improve performance by collecting objects into large batches and rendering these batches with only a few draw calls. I implemented batching (so that every game object sharing the same texture is rendered in same batch) and thought that my problems are gone... only to find out that my frame rate was even lower than before.

Why? Well, I have 200 (or more) game objects, and they are updated 60 times per second. Every frame I have to recalculate new position (translation and rotation) for vertices in CPU (GPU on mobile platforms does not support instancing so I can't do it there), and doing this calculation 48000 per second (200*60*4 since every sprite has 4 vertices) simply seems to be too slow.

What I could do to improve performance? All game objects are moving/rotating (almost) every frame so I really have to recalculate vertex positions. Only optimization that I could think of is a look-up table for rotations so that I wouldn't have to calculate them. Would point sprites help? Any nasty hacks? Anything else?

Thanks.

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:
Large Sprite Performance I've got a large Sprite generated using a set of vertices(x,y coordinates) and a bitmap pattern (using moveTo, lineTo, beginBitmapFill, endFill ...etc). It's about 15000 pixels wide and between 1500 - 2000 pixels high depending on the level -it's the terrain for a 2D game.

My question is: what is the best way to display/move it on the stage - performance wise?

Currently I'm just adding it to the stage as is...I get decent frame rate/ memory/ cpu usage but I want to optimize it for slower PCs.
Any ideas? I've been reading a little about blitting but I'm not sure how to implement it in my case.

Thanks.

sentences:
What exactly is the "blend factor" t in Color.Lerp? I had a bit of a look around and couldn't see anywhere this was addressed, my apologies if it has been.

In Color.Lerp, I understand that the 3rd parameter t is not in fact the time that it takes to change between the colors but is rather the "blend factor". If the first color is at 0 and the second is at 1, then a blend factor of e.g. 0.2 would indicate it is closer to the first than the second.

My confusion is this - how exactly is it determined how long it takes the lerp to occur? I assume it's something to do with the frames per second? e.g. if the blend factor is 0.001 and frames per second are 50, with lerp in the update function then it should take 0.001 * 50 = 0.05 of a second for the change to occur?

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:
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:
Is texture 1D array a valid way to handle object coloring? I would like to render game UI, and for that I need rectangles. However, since a button could be textured just as well as solid color or (multistop)gradient a problem arises. I would also like all types of rectangles(buttons) somehow at least partially uniform at handling.
I have been puzzled by this issue for quite a time and idea came across my mind - what if I stored colors to a 1D texture array and treat all rectangles as textured. Could you give me some example how to do this? Or event better a reason not-to solve it this way and point to better solution?

sentences:
Is this technique for stat tracking without a database workable? If I wanted to create a chess game, for iOS, that tracked both player moves (for retracing the progression of a game and for player stats), what would be the simplest route to take?

To clarify, I want to track not only the moves a player has made in a particular game, but how often that player has made that move in past games. For example I want to be able to track:

How many times a given player has opened by moving the king pawn up two squares (e4) as white, on move number one.
What is the percentage of time the player responds to white's e4 opening move, with moving his own king pawn to e5?
What percentage of time does he respond by moving his queenside bishop pawn to c5?

And so on. If it's not clear, the stat tracking system should also be able to report how many times this player, as black, move his queen to h1, on move number 30.

I'm using Parse.com for my back-end as a server (BaaS) service. If I were to create a class that

writes strings that identify move number, player color, moved piece, algebraic notation of the square (e.g. "d8") to a file, locally in the file system
saves the file to Parse, and deletes the temporary file from file system
upon opening the same game in my tableview (a la a "With Friends" game), download this file from Parse, parse through it and retrieve all stats/history, assign all relevant values to variables

Is this plan viable, or is there an easier way?

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: 2d Tower Defense - Projectile Prediction For my map, it's very curvy and the node sizes aren't consistent. I have everything finished so that projectiles will actually fly at an enemy, however if a projectile is going too slow it will miss. I am wondering if I should just go the easy route, and just make the projectile homing, or if I could get help here on where to start. The enemy is changing directions, and moving around, although never changes speed.

sentences:
Proper way to handle Movement/Animation/AI functions of an AI character in Unity3D My team is currently building a 2D game in Unity and we've run into some workflow/script organization blockades for many of our game's characters.

For example, we're not sure what the standard method of encapsulating/organizing a character's movement, animation, and more complex AI code is so that things don't become a behemoth mess.

Originally, we had all a character's code in one file -- movement, animation, and AI decision-making code. Needless to say, this became messy really quickly and horrendous to debug.

Then, we redesigned it so that there were three scripts on the character: a movementHandler, animationHandler, and AIHandler. These scripts would communicate to each other, but encapsulate their own functions. This worked better than before, but also grew to a point where it was a bit messy organizationally and debugging is becoming a nightmare again.

We're interested in knowing how people typically organize their scripts. Is there a way people know to organize these code sections so that they're more scalable and don't become headaches to manage once the project grows and grows?

sentences:
Fastest 3D collision detection between two oriented bounding boxes (OBBs) I am at the point in my game where I need to add a collision system. I tried jBullet, and while it did work, it wasn't what I was looking for. I just want a simple way to test if two oriented bounding box (OBB) trees are colliding.

I was going to do collision by using the tree.  Make an AABB for broadphase, then if that passes test if each OBB in tree collide with the other tree.

I did find a few things on the internet, but I couldn't understand them completely. What I am asking for is a website or resource that explains 3D OBB collisions well?

I learned that GJK is faster than SAT, and it appears to be able to tell me how far the boxes penetrate each other. I found some GJK stuff, but they were not boxes; instead, more complex and confusing things.

I just want to be able to make an OBB from 3 vectors: center, size, and rotation of each axis. Then be able to test collisions with those. Thank you in advance for anything you post.

sentences: What is the purpose of the beginning of HL1, from the perspective of game design? At the beginning of Half Life 1, player is locked into watching an introductory film that can't be skipped and doesn't teach anything about game mechanics. Player can only move their camera around. A similar technique was applied in Deus Ex 4. Given that it's irritating not to be able to skip it on subsequent gameplays, what is the purpose of those?

sentences:
Calculate 2D tile map tiles within a "field of view" cone I need to calculate which tiles make up a "cone", originating at my player and extending outward for a specific tile distance.

My player can only face North, South, East, West and I'm not sure yet on the angles I'll use for the cone.

I've found several posts/articles already covering this but they're trying to determine visibility and are a lot more complex than I need. I'm not lighting a room or calculating shadows/occlusions.

sentences:
Introducing generic commands in text-based interactive fiction game Writing a compact text-adventure engine I was thinking about possible commands a player could use. For each location i have special commands described in the text but what about generic commands like

examine
open / close
trigger
...

So here are my questions concerning this:

Is there anywhere a good enumeration of commands which should be mandatory? If no, what commands would you expect in such game?
Concerning usability, should I suppose that the player knows the commands so he can try to use them from the beginning or should I implement tutorial-like explanations which  unlock the usage of those commands?

sentences:
OpenGL ES respecting alpha for background but not for objects I have a problem with the alpha of my game, maybe it is solved in another post but as I am new in OpenGl and Game developemnt I dont understand most of the vocabulary and cant find a solution.

The problem is I have enemies with alpha and coins with alpha that works great, but when an enemy pass through the coin it take seem the background instead of the coin(same with shoots)

there is a image explaining it

There is the code to draw enemys and coins

public void drawEnemy(GL10 gl)
{
    gl.glFrontFace(GL10.GL_CCW); // Front face in counter-clockwise
                                    // orientation
    gl.glEnable(GL10.GL_CULL_FACE); // Enable cull face
    gl.glCullFace(GL10.GL_BACK); // Cull the back face (don't display)

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Enable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glTexCoordPointer(3, GL10.GL_FLOAT, 0, texBuffer); // Define
                                                            // texture-coords
                                                            // buffer (NEW)

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // front
    switch (type)
    {
        case 0:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.textureIDs[0]);
            break;
        case 1:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.naveEnemigaIDs[0]);
            break;
        case 2:
            gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.naveEnemigaIDs2[0]);
            break;
    }

    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
}

public void drawCoin(GL10 gl)
{
    gl.glFrontFace(GL10.GL_CCW); // Front face in counter-clockwise
                                    // orientation
    gl.glEnable(GL10.GL_CULL_FACE); // Enable cull face
    gl.glCullFace(GL10.GL_BACK); // Cull the back face (don't display)

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
    gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Enable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glTexCoordPointer(3, GL10.GL_FLOAT, 0, texBuffer); // Define
                                                            // texture-coords
                                                            // buffer (NEW)

    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    // front
    gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureLoader.CointextureIDs[0]);
    gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

    gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // Disable
                                                            // texture-coords-array
                                                            // (NEW)
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDisable(GL10.GL_CULL_FACE);
    gl.glDisable(GL10.GL_BLEND);
}

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:
Creating a working game with Unity3D? I recently start learning Unity3D and following VTC's video tutorials and others tutorial, so far i've found it very easy to work it and to create stuff, i havent got to the part where i need to script anything YET.

While i still havent hit the scripting part yet i did like to ask:

Do i really need to script anything to
make a simple game with it ? (why am i asking this ? until now from the tutorials i've been watching it seems that unity3d has most of the physics and codes needs to create a working version of a simple game, for example making falling crates, the rigidbody functions, it taking into account flags and grass being touched by the wind and moving)
What are some simple examples of
where will i be scripting for ? (just wondering if there will be something to script for even for a simple game and what would that be)
When i build the finish project will it compile everything as if it was a VS project and make a working version without the need of any other wrappers for it is data, etc ? (this is sort of self replied by their webpage but i just wanted to confirm if i got this right)

I am aware those might be subjective questions but while i am unexperienced with it and havent found anything related to those questions yet or havent meet the end of a project to be able to confirm for myself i would like to receive some advices and information in regards this.

PS: i did a search but i was not sure of what should i look for to find answer for this kinda of questions so if this is a duplicate of any sort let me know and i will delete it once i am pointed out for the duplicate.

Best regards.

sentences:
How to download material files (including shaders) from external source on runtime? My game has a lot of different materials, shaders and textures. When a bunch of players are dropped into the same game, I want those assets to be loaded from an external source instead of being built into the game from the start.

Problem is, with C# being such a non-agile language, and UnityWebRequest being unable to read .mat or .shader from the box, I don't know how to work with those files.

Ideally, I just want to write:

UnityWebRequest req = UnityWebRequest.Get("http://pathToMaterials/material.mat");

Material material = req.downloadHandler;

Or something...

sentences:
Alternative to Dictionary serialization I am working on a set of ScriptableObjects that represent base stats for characters in my game. Think Strength, Speed, Intellect, etc. A whole laundry list of em (about 20 stats).
I'd like to later be able to reference these specific stats via an enum. Therefore, the easiest way to store them in the object seemed to initially be a Dictionary<StatType, int>. These then get linked to sliders in a custom editor (which works fine).
However, Unity appears to have no idea how to serialize a Dictionary, so between sessions all my finely tuned values get removed.
I need some sort of workaround for this. Either I need another data structure Unity will serialize (but see below), OR I need to find a way to force Unity to serialize my data some other way.
Requirements for an alternate data structure: Integer values should be able to be read and written through reference to the enum value alone. It should be possible to check whether an enum key has been added to the structure or not. It should not allow duplicate enum keys, but duplicate values are fine. Obviously, Unity should be able to serialize it.

sentences:
What's the use and difference between Forward, Deferred and Physically Based Rendering? Maybe I'm still confused about my own understanding,

Forward Render: render the lighting of an object according to the light source in the scene. (e.g Phong)
Deferred Render : render the scene to get geometric information, store it in a buffer, and then apply lighting. (e.g ?)
PBR : treats lights in the scene the way it behaves in the real world. (e.g Ray tracing, Photon Mapping)

I don't see how Forward and Deferred render are going to give much difference to the scene. Why do we need to store the geometrical value in Deferred Render before applying lighting ? Why don't we just compute lighting right away like Forward Render ?

Also for Physically Based Rendering, computing each light takes a lot of time, and almost impossible to be done in real time. But why this technique is always considered the best ?

sentences:
odd line artefacts on my screen? (C++ DirectX11) I'm getting some odd lines on my screen in my program:

They seem to be in a static location on the screen and occur at regular intervals. They are also on the horizontal too but are harder to see in the image.

So far I have tried:

turning anti-aliasing off,
turning multi-sampling off,
rendering my images at full size (no scaling) and
using texture sizes of a power of 2.

And none of that seems to work. Right now I am working on adding fonts in, but this issue means that lines of the fonts can disappear (the bottom of an 'o' the middle of a 'B' (so it looks like a 'D'), etc).

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:
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 update individual sprites within a spritegroup in pygame? I have a for loop that takes values from a text file, and then creates and adds a bunch of sprites to a group platformlist_list. The for loop will continue until every line of the text file is read.

self.object = Wall(firstarray[0] , int(firstarray[1]), int(firstarray[2]))

print int(firstarray[3]), ' x ', int(firstarray[4]), ' y'

self.object.rect.x = int(firstarray[3])
self.object.rect.y = int(firstarray[4])

initialization.platform_list.add(self.object)

What I want to be able to do is access these created sprites and move them, but if I use this code to try and move all of the sprites in the platform_list group:

if (loadterrain.character.direction == self.left):
    loadterrain.wall.rect.x += self.movementspeed
    loadterrain.object.rect.x += self.movementspeed
if (loadterrain.character.direction == self.right):
    loadterrain.wall.rect.x -= self.movementspeed
    loadterrain.object.rect.x -= self.movementspeed
    loadterrain.floor.rect.x -= self.movementspeed

The only object on screen that will move is the last object that my for loop has created.

I want to be able to access and modify the x and y positions for every sprite inside of the platform_list but have no idea how to do so because from the research I have done indexing the platform_list is unreliable as it is not ordered.

What is the best way for me to access and modify the positions of all the sprites in that group?

sentences:
How to achieve light effect on a car panel icons? I'm making a car and I want to make lightable icons on its panel. I want to add 'on' and 'off' effect to them separately. The Sprites are plane objects, with one material and UV texture for each plane.

If I change material property - it will change in all objects which use this material. I don't think creating 10 materials for 10 sprites is the best choice, what should I do in this situation?

sentences:
Check if coroutine crashed I can check if coroutine still running by setting boolean variable outside the coroutine and then letting the coroutine itself set the value to true when it runs and set it to false when it decide to stop .
But this method of detecting whether coroutine still active or not doesn't work when the coroutine crashed due to error (invalid input, null reference , ect) because the boolean variable remain true while the coroutine itself has stopped due to error.
How do i check if coroutine still running or not in current frame ? i can't spend my code checking for next frame .
Preferably C# , but answer in javascript also accepted.

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:
How do I fix "Invalid character '' in input string at LitJson.Lexer.NextToken ()" when trying to use JSON from URL? When trying to use a Json file served by a url I am getting the error

JsonException: Invalid character '' in input string

it happens when I use this method:

IEnumerator GetText()
{
   UnityWebRequest webjson = UnityWebRequest.Get("http://awebsite.com/Art_.json");

    yield return webjson.SendWebRequest();

    if (webjson.isNetworkError || webjson.isHttpError)
    {
        Debug.Log(webjson.error);
    }
    else
    {
        // The following line is giving me the error:
        // ItemDatabase_+<GetText>d__3.MoveNext () (at Assets/Version2.0/Scripts/ItemDatabase_.cs:38)
        itemData = JsonMapper.ToObject(webjson.downloadHandler.text);

        Debug.Log(itemData);

        ConstructItemDatabase();

    }
}

I have tried to use Trim()

itemData = JsonMapper.ToObject(webjson.downloadHandler.text.Trim());

But still have the same result.

I have tried what is suggested in this question/answer, but it seems to not fix the issue I have.

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:
How to deallocate/release/delete of a glTexStorage2D? I tried to find this but found nothing.

Does anyone know how to 'deallocate' textures/mipmap from glTexStorage2D once you don't need it anymore?

sentences:
How do I create this windblown snow effect? How do I create this snowy wind kind of effect, where wisps of snow appear to blow through the air close to the ground?

I have seen this in several games like Skyrim, the new God of War, but I don't know what name to call it by.

I found this God of war gameplay https://youtu.be/b7u59Iutb0c

sentences:
How to apply friction on the car so that car slow down I am working on a driving game. I am able to move the car using arrow key.I am accelerating the car by applying a force in what ever direction that car is.But I need to apply friction to the car so that the car slow downs more quickly.How can I do it.Here is the code I am using for the movement

if(Input.GetKey(KeyCode.UpArrow) ) {
        rb.AddForce( transform.up * speedForce);
    }

after some search.I found that some used this line of code

rigidbody2D.drag=friction;

And I edited my script as below

if(Input.GetKey(KeyCode.UpArrow) ) {
        rb.AddForce( transform.up * speedForce);
        rb.drag=friction;
    }

Will this make any sense in applying friction.Can anybody please help me .

sentences: Best way to learn iphone game development? I know php and some python, but not much c. Where should I start to learn iphone game development? Is there some recommended books/tutorials for beginners? I'm looking at using cocos2d but I'm open to anything that isn't too limited.

sentences:
Need some help to move sprite in XNA when a sprite, like a space ship, reach the window border I call a method to "turn off" the engine by setting the speed to 0. But then it's impossible to move the sprite back, because the speed is set to 0! I would preciate some help to solve this! Perhaps there is another way to do this? Thanks!

Some of the code

if (position.X > 800)
EngineOff();

direction = new Vector2((float)Math.Cos(rotation - 1.62), (float)Math.Sin(rotation - 1.62));
position += direction * speed;

And the method that controls the engine

 // Engine on
    public void EngineOn()
    {
        speed = 1;
    }

    // engine off
    public void EngineOff()
    {
        speed = 0;
    }

EDIT: Would it be possible to rotate the ship, so it's point inwards the game area? Would it be possible to rotate it 1/2 of a turn or 1/4 of a turn? My thought was that when the spaceship hit the border, it just turn around and continue moving inwards the game area.

sentences:
How to animate objects in Unity 3D Yesterday I played around with Unity 4.6 and I came up with a question about animation.

I have an fps-survival project (most for educational purpose).

I use the default build-in fps camera controller that comes with unity asset and adding a script for head-mob.

Now I animate a "falling" animation. The animation is in the  First Person Controller object. Although I have two "arms" as children in my FPS controller, I want in each frame of my animation to move the arms but when I click in the each arm , the animation window don't show me the correct state of the animation, and I need to get back to where I attach my animation to show again. I don't know what to do. I can't animate the hands in seperate file cause I don't see the falling frame from the FPS controller.(which is more a visual than a technical problem)I want to point out that I need to use both my hand objects and I am preety novice so if you could tell me in steps what to do.

I attach some images bellow to see how my enviroment is setted up.

When I select the FPS controller

After I select each hand

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

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

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

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

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

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

From the shader:

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

The Java code:

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

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

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

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

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

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

sentences:
How are imaginary numbers useful in video game creation? I learned about imaginary numbers in school and they seemed so impractical, so I asked my teacher what they were used for and he said "video game creation".

I just want to know if this is true and if so how is it used during the creation process.

sentences:
Game loop alternatives for efficiency Understand where I'm coming from - I've been taught that a game is implemented something like this (pseudocode):

while (!win_condition)
{
   waitforinput();
   updategraphics();
   //etc..
}
exit();

Is there another way to implement the "game loop" without limiting the game to finite "turns"?

This

while (true)

business seems to eat a lot of CPU, especially for how simple a game I'm making!

sentences:
How to re-calculate orientation vectors when one of them is being changed? I want to implement a Unity-like API for my transforms, with the ability to set forward, right, up vectors directly and change object's rotation quaternion accordingly.
I got stuck at the math behind it, though. What algorithm should we use to change the other 2 vectors?
I feel that the function should have 2 if branches and check which of the other two vectors to use to compute a cross product with the new vector, to decide which vector to use as the first and which is the second, and vice-versa in another branch.
I came up with something like this so far:
void Transform::SetForward(const glm::vec3& v) {
    mForward = glm::normalize(v);
    if (abs(abs(glm::dot(mForward, mUp)) - 1.0f) <= 1e-5) {
        // dot is either -1 or 1 (straight up or down)
        mUp = glm::cross(mRight, mForward);
        mRight = glm::cross(mForward, mUp);
    }
    else {
        mRight = glm::cross(mForward, mUp);
        mUp = glm::cross(mRight, mForward);
    }
    FixRotationQuat();
}

sentences:
2D lighting causes black rings to appear A year ago I implemented 2d lighting in XNA using sprites.
The sprites I used were created by placing a soft white photoshop brush on a transparant background.

The result was this: (lights only)

And this seemed right to me.

I returned to the subject this week to try replacing the sprites with a texture created with code and a formula:

As you can see, there is a black ring around every light.

This is the code I used for creating the textures:

int diameter = 250;
int radius = diameter / 2;

Color[] colors = new Color[diameter * diameter];

for (int y = 0; y < diameter; y++)
{
    for (int x = 0; x < diameter; x++)
    {
        Vector2 l = new Vector2(radius, radius) - new Vector2(x, y);
        float attenuation = MathHelper.Clamp(1 - Vector2.Dot(l / radius, l / radius), 0, 1);

        colors[x + y * diameter] = Color.White;
        colors[x + y * diameter].A = (byte)(attenuation * 255);
    }
}

Texture2D texture = new Texture2D(device, diameter, diameter);
texture.SetData(colors);

I got the attenuation formula from here.

Aside from that I now create the textures using code, the rest of the code has remained the same.

Where do the black rings come from, and how do I prevent them from appearing?

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:
Game mechanics patterns database? Do you know http://tvtropes.org ?

It's a kind of wiki/database with scenaristic tropes, patterns that you can find in tones of stories, in tv shows, games, books, etc.

Each trope/pattern have a (funny) name and there are references to where it appears, and the other way arround : each book/game/etc. have a list of tropes that it contains.

I'm looking for an equivalent but for game mechanics patterns, something like "Death is definitive", "Perfect physical control (no inertia)", "Excell table gameplay", etc.

I think it would be really useful. I can't find an equivalent for game mechanics (tvtrope is oriented to scenario, not game mechanics).

Do you know any?

sentences:
How to securely retrieve game stats from clients in a p2p game network? I'm working on a P2P game and I know I should never trust the clients. I my architecture, there is a "Master Server" that stores game room (host) informations. Players can create their own rooms (hosting) and play with together.

There is another server that is "Info Server", it stores character informations like inventory, level etc. Now, I need to make a stats table with kills/deaths and I have to get these kill/death events from host player (host player >> [event] >> master server). But I think host player can send a lot of kill events because it is authoritative, so master server will process/handle all events from the host player.

How can I trust these events? Can't a server just send fake kill/death events?

sentences:
How can I add a delay for each moving object? The waypoints script :
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class Waypoints : MonoBehaviour
{
    public Transform objectToMovePrefab;
    public int numberOfObjectsToMove = 1;
    //with this approach, you use GameObjects to represent your waypoints
    //(they can be empty if you want the waypoint to be invisible)
    [SerializeField] private List<Transform> waypoints;

    private void Start()
    {
        for (int i = 0; i < numberOfObjectsToMove; i++)
        {
            var parent = GameObject.Find("Moving Object Parent");
            var objectToMove = Instantiate(objectToMovePrefab, parent.transform);
            objectToMove.name = "Platfrom";
        }
    }

    public int Count => waypoints.Count;
    public Vector3 GetWaypoint(int index)
    {
        return waypoints[index].position;
    }
}

Then in the editor I added this script to the prefab :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WaypointsFollower : MonoBehaviour
{
    [SerializeField] private Waypoints waypoints;
    [SerializeField] private float speed = 5f;
    [SerializeField] private bool goBack = false;
    [SerializeField] private float delay;

    private float startTime;
    private int waypointIndex = 0;

    private void Start()
    {
        startTime = Time.time + delay;

        waypoints = GameObject.Find("Waypoints").GetComponent<Waypoints>();
    }

    void Update()
    {
        if (Time.time < startTime) return;

        Vector3 waypoint = waypoints.GetWaypoint(waypointIndex);
        //movement
        float distance = speed * Time.deltaTime;
        transform.position = Vector3.MoveTowards(transform.position, waypoint, distance);

        //check if we've reached the waypoint
        float threshold = .1f; //how close is considered having reached the waypoint
        if (Vector3.Distance(transform.position, waypoint) < threshold)
        {
            //wraps back to 0 when we reach last waypoint
            if (goBack)
            {
                waypointIndex = (waypointIndex + 1) % waypoints.Count;
            }
            else
            {
                if (waypointIndex != waypoints.Count - 1)
                    waypointIndex = waypointIndex + 1;
            }
        }
    }
}

The delay is working but it's delaying all the WaypointsFollower's so they move at the same time after the delay.
I want that even if all the Followers have the same delay value for example 3 so the first one will start moving after 3 seconds then the next follower will start moving after another 3 seconds and so on and not that they all delay for 3 seconds and move together but to make delay so there will be spaces between the followers when they are moving.

sentences:
Pack four alpha maps into one I have read an article about texture splatting that says:

  Because the alphamap only has to be in a single channel of a texture,
  we can pack up to four alphamaps into a single texture – one in red,
  one in green, one in blue, and one in alpha.

But it does not mention a way to this. Can anyone tell me or point me to an article on how to do this? I've been googling it the whole afternoon but can't find any. Or maybe I just don't know the correct terms to search. :?

Thanks.

sentences:
Panning a 3d viewport in 2d direction with rotated camera I am using below code to pan the viewport (action script 3 code using flare3d framework)

_mainCamera.x-= Input3D.mouseXSpeed;
_mainCamera.z+= Input3D.mouseYSpeed;

Where as Input3D.mouse[X|Y]Speed gives the displacement of the mouse on the X/Y axis starting from the position of the last frame.

This works perfect if my camera is not rotated. However, if I rotate the camera (x by 30, y by 60) and pan the camera then it goes wrong. Which is actually correctly panning according to the code. But this is not desired and I know I need to do some math to get the correct x/y which I am not aware of it.

Can some one help me achieving it?

Update:

I am getting an Idea but I am not sure how to do it :(

Get the mouseX/Y deltas (xd,yd)
Get the current camera coords (pos3d)
Convert to screen coords (pos2d)
Add deltas to screen coords (pos2d+ (xd,yd))
Convert above coords to 3d coords

sentences:
Determining the probability of a successful attack based on the equipped weapon? Take this example, a player has a sword composed of the handle and a blade. Together, they generate a strength of X and that combination adds qualitative attributes (induce more damage to fire creatures). If the player encounter 2 enemies, both at same defence level, but one is made of fire. Then, I need to calculate the probability of hitting the enemies, knowing that it may be higher for the fire creature.

Given the example, I need to calculate the:

Weapon's strength, by combining different parts?
Probability of the outcome of an encounter?
Inclusion of qualitative attributes in the calculation?

So far, I though of the following and I am not sure if it is good enough.

For the weapon, I would associate a value to each component. Then, I would determine that the handle represents 25% of the total strength; allowing me to calculate the total strength
The enemy will get a defence value.
For the encounter, I would generate a random number between 1 and the (player strength)+(enemy defence). If that number is higher than the enemy's defence, than it's a hit. This means that if they are equal, then it's 50% chance of success.
For the physical attributes, if the enemies has a weakness towards an elements, then I would deduct a certain value of he's defence before calculating the probability.

Is this a viable approach? If not, what would be a suitable implementation? or where can I find more ressources on these kinds of problems.

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: Alternative to soundeffect.play()? I have been using a profiler to optimize my game for the Xbox, my aim is as with any optimization to reduce excess CPU and memory usage. I have managed to cut down a lot of the processor time and memory used by my game. However i have a lot of bullets in my game that the player fires and every-time a bullet impacts with something the soundeffect.play() method is called to play the explosion. I would like to know if there is a more efficient way of playing the explosion soundeffect?

sentences:
How can I determine the extreme color values in a texture? I am looking for a way to determine the most extreme color values for all of the texels in a texture. So for a texture consisting only of black and white texels, the extreme values should be (0,0,0) and (1,1,1) expressed in RGB format. For a color gradient from red to green I should get the values (1,0,0) and (0,1,0).

Now obviously I could do this on the CPU by iterating over all the pixels/texels of the texture and keeping track of the color values found to be most apart from each other, but this is probably relatively slow, so I am looking for a way to do this using the GPU/shaders.

Is this possible using shaders? I am not experienced with GPGPU, so a solution in HLSL/GLSL would be preferred. Or maybe there is a fast algorithm I could use on the CPU?

sentences:
When I select one vertex it selects multiple vertices? I'm trying to do some kind of a face. When I select a vertex it selects two other vertices. However, when I try to select one of the two other vertices it doesn't select them.

I want to move only one vertex to make it right.

My model is an editable poly.

Link to my model so if you want to inspect it properly.

Front view :

Linked vertices :

sentences:
Unity run-time creating material has performance impact? Just found creating a material in a script for the first time would have performance impact.
(Using Unity 5.6.5f)

A very simple script for testing is to create a game object with MeshRenderer in Start(), assign a new material each time in Update(),

gameObj.GetComponent<MeshRenderer>().material = new Material(Shader.Find("Standard"));

From Unity Profiler the first function call took much longer than following calls, the first one took 100ms and others less then 1ms.

Can someone give it an explanation? Thanks.

sentences:
Resource protection in cocos2d-x 2 and 3 I am developing a game in cocos2d-x 2.2.3 and I want to protect my resources from being extracted. Is there any way I can do this?

I don't know much about encryption.

sentences:
Facilitator UI on desktop screen for VR Hey and thanks in advance for any help/pointers

The solution is probably straight forward but i am still a little inexperienced (while creating quite a few different VR unity projects mostly study related, i never really build anything so the editor allowed for some shortcuts. see below).

I am currently developing for Windows mixed reality with unity. I am struggling to figure out how to make a (possibly secondary) application window run on the desktop that can be used during facilitated VR-experiences to change settings and generally provide facilitator input to the application while the participant would just perceive the VR world.

Edit:
I have a similar project that is developed with Steam_vr library / Open_VR that works exactly as expected and portrayed by the unity editor; i.e. the desktop will shows the ingame footage + the screenspace overlay UI (which is interactable).Nevertheless quite a few features where implemented with the MixedRealityToolkit so I'd prefer to stick with that. And was wondering if there is a way to achieve the same/similar behavior with it.

Now with MRTK everything works straight forward when running from unity editor just making a canvas screenspace will prevent it from showing in vr while it can still be interacted with. the problem is that the facilitators themselves are a third party and having a build would just make their handling of the solution much easier. Not to mention performance gains from building and cleaning the project(?).

it will probably come down to creating a secondary window that runs on the desktop since my understanding is that uwp with MRTK just runs in the wmr portal rather than a separate app; and that the WMR portal simply copies the Headset render to the desktop. But i am completely blank on how to achieve this and was hoping that someone might have struggled with this before. But i couldn't really find anything. I'd prefer not to have to resolve to Networking, and will attempt to convert to Steam_VR /OpenVR in the meantime..

sentences:
Browser-Based Game Design: Keeping track of NPC stats (Attack, Defense, Health, etc) Hope this is a proper question to ask here. If not, I'd appreciate somebody pointing me to other game developer communities.
Since I am creating my game by myself it'd be nice to communicate with other developers.

Is it best to keep NPC stats in the database, or calculate them using code?
I store the NPC's level in my database table. So from there I could use code to calculate it's Attack & Defense, and any secondary stats.

I can't think of any "Cons" to using just code.
But a "Pro" would be that I can easily adjust the NPC's stats using different algorithms.

sentences:
How can I un-bloat my player input processing in my text based game? I'm writing a text based game, and I hit a snag with the user commands processing: so far I have a huge hardcoded ifelse block, and that does not seem good or scalable.

With single word non session commands it is easy:

> quit

Here I know I simply have to quit; but when it comes to multi word commands, like:

> help skills
> use bag
> take sword from bag

the if/elseif/else pattern is so cumbersome and not scalable.

Also, with regards to commands in one session, like so:

> open box
> look inside box
// you see next items inside box: one, two, three
> take one

how can I process different options depth, when each command received from client is processed from the beginning? How to respond with "first you must open box to take items from it" if user enters "take one" without prior "open box"?

How can I organize and process user input efficiently here?

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:
XNA- Texturing problem, exporting model How,can I disable coloring when texture is applied, because right now
the texture is being colored over.

foreach (BasicEffect effect in mesh.Effects)
{
    effect.TextureEnabled = textureApplied;

    if(textureApplied)
        effect.Texture = Texture2D.FromStream(GraphicsDevice,System.IO.File.OpenRead(texturePath));
    else
    {
        effect.DiffuseColor = ti.DiffuseColor;
        effect.EmissiveColor = ti.EmissiveColor;
    }
    ...
}
mesh.Draw();

Also, is there any easy way for xna to export models? Or do I have to write my own?

sentences:
OpenGL ES 1.1 - How to batch draw particles with different translations? Assuming that 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:
How to create a "border" effect in Unity? Okay let me start off by saying I have searched for several days on this topic, and it seems that either nobody posted anything about it, or it is on the internet, but too far buried under piles of useless information for me to find. I have created a custom terrain algorithm in Unity and have built a parser to read provinces onto the map.

The short version description of the parser is that it goes into the assets folder, finds "map/provinces.png", reads the borders of the provinces as vertices, reads "map/height.png" to determine the height of the visual terrain, and reads "map/terrain.png" to determine how much of each province is of each terrain (for example, Paris can be 95% urban, and 5% forest in my setup).

I want to make each and every one of the 500 european provinces start with a player. The idea is that the players will fight small-scale wars for 30-40 turns, by which point most or all small players will be absorbed into the most successful players country. These will then fight for 60-80 turns for dominance, with alliances being forged and broken and countries being destroyed. The problem is described below;

Each player has his own unique color. Many of the players will obviously have similar colors, and I do not want 2 dark red countries bordering eachother without some easy way to see the border. I want to basically draw a line in between any two provinces that belong to different players and border each other. I am having trouble finding a way to easily do this, as my current solution tests all provinces if they border foreign provinces, and runs a rather expensive test on each of the bordering provinces vertices to see if they border eachother, then stores those vertices as vectors and draws a line from each vertex to its others.

I have considered using a shader to accomplish this, but was unsure if that was the right approach and whether or not that would (or could?) be more efficient.

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:
How to load a text file from a server into iPhone game with AS3 in Adobe AIR? Im creating an iPhone game with Adobe AIR, and I want to be able to load a simple text msg into an dynamic text box on the games front screen from my server (and then be able to update that text file on the server, so it updates automatically in the game after the game is on the app store) How would I go about acheiving that? is it as simple as using a getURL? are there any specifical issues with trying to do this on the iPhone via AIR that I should be aware of?

Thanks for any advice.

sentences:
How to progress an entity-component gamestate in a turn-based game? So far the entity component systems I've used have worked mostly like Java's artemis:

All data in components
Stateless independent systems (at least to the degree that they don't require input on initialization) iterating over each entity that contains only the components that particular system is interested in
All systems process their entities one tick, then the whole thing starts over.

Now I'm trying to apply this to a turn based game for the first time, with tons of events and responses that must occur in a set order relative to eachother, before the game can move on. An example:

Player A receives damage from a sword. In response to this, A's armor kicks in and lowers the damage taken. A's movement speed is also lowered as a result of getting weaker.

The damage taken is what sets off the whole interaction
Armor must be computed and applied to the incoming damage before the damage is applied to the player
Movement speed reduction cannot be applied to a unit until after the damage has actually been dealt, since it is dependent on the final damage amount.

Events can also trigger other events. Reducing sword damage using armor can cause the sword to shatter (this must take place before the damage reduction is completed), which in turn can cause additional events in response to it, essentially a recursive evaluation of events.

All in all, this seem to lead to a few problems:

Lots of wasted processing cycles: Most systems (save for things that always run, like rendering) simply doesn't have anything worthwile to do when it's not "their turn" to work, and spend most of the time waiting for the game to enter a valid work-state. This litters every such system with checks that keep growing in size the more states are added to the game.
To find out if a system can process entities that is present in the game, they need some way to monitor other unrelated entity/system states (the systaem responsible for dealing damage needs to know if armor has been applied or not). This either muddles the systems with multiple responsibilities, or creates the need for additional systems with no other purpose but to scan the entity collection after each processing cycle and communicate with a set of listeners by telling them when it's okay to do something.

The above two points assume that the systems work on the same set of entities, that end up changing state using flags in their components.

Another way to solve it would be to add/remove components (or create entirely new entities) as a result of a single systems work to progress the games state. This means that whenever a system actually have a matching entity, it knows that it is allowed to process it.

This however make systems responsible for triggering subsequent systems, making it difficult to reason about the programs behaviour since bugs won't show up as the result of a single system interaction. Adding new systems also gets harder since they can't be implemented without knowing exactly how they affect other systems (and previous systems might have to be modified to trigger the states the new system is interested in), kinda defeating the purpose of having separate systems with a single task.

Is this something I'll have to live with? Every single ECS example I've seen have been real time, and it's really easy to see how this one-iteration-per-game-loop works in such cases. And I still need it for rendering, it just seems really unfit for systems that pause most aspects of itself every time something happens.

Is there some design pattern for moving the game state forward that is suitable for this, or should I just move all logic out of the loop and instead trigger it only when needed?

sentences:
Cache misses and usability in Entity Systems Lately I have been researching and implementing an Entity System for my framework. I think I read most articles, reddits and questions about it that I could find, and so far I think I am grasping the idea well enough.

However, it raised some questions about overall C++ behavior, the language I implement the entity system in, as well as some usability issues.

So, one approach would be to store an array of components in the entity directly, which I didn't do because it ruins the cache locality when iterating through data. Because of this, I decided to have one array per component type, so all components of the same type are contiguous in memory, which should be the optimal solution for quick iteration.

But, when I am to iterate component arrays to do something with them from a system on an actual gameplay implementation, I notice that I almost always am working with two or more component types at once. For example, the render system uses the Transform and the Model component together to actually make a render call. My question is, since I am not iterating linearly one contiguous array at a time in these cases, am I immediately sacrificing the performance gains from allocating components this way? Is it a problem when I iterate, in C++, two different contiguous arrays and use data from both at each cycle?

Another thing that I wanted to ask about, is how one should keep references to components or entities, since the very nature of how the components are laid in memory, they can easily switch positions in the array or the array could be reallocated for expanding or shrinking, leaving my component pointers or handles invalid. How do you recommend to handle these cases, since I often find myself wanting to operate on transforms and other components every frame and if my handles or pointers are invalid, its quite messy to make lookups every frame.

sentences:
What is the fastest way of drawing simple, textured geomtries and keeping the depth test? I'm looking for a fast way to draw simple 3D geometries - that will consist of up to 10 vertices. Each of them will have a texture (though varying between geometries). I also want to store the fragment depth for depth testing.

There will be no lighting and only very simple transformations (this actually is for isometric game).

So far what I did was trying to achieve top performance using OpenGL for drawing simple quads (what the problem actually boils down to). For my machine (from around 2008), I had the following results:

Using immediate mode 4800 quads took 120ms
Using vertex arrays and VBOs this took around 40 ms

What I see as a problem is the bottleneck of glDraw* calls. I want to somehow get below 4-5 ms , as there will be really a lot of objects on the screen. Any ideas about how could (or perhaps couldn't) achieve that?

sentences:
How would I load a new scene when a score that is stored in a string is reached? This is a code that I am working on for a space shooter. Part of it works and my score does increase by 7 every second while being loaded into a GUI box, but my script does not load my scene when the number reaches 1000. I have made sure that my scene is a part of my build settings and I have tried some fixes but it doesn't load even though I don't get any sort of error. Any Ideas?

#pragma strict
function Start(){
InvokeRepeating("EachSecond",1.0,1.0);
}

var score: int = 0;
var addscore = 7;

function EachSecond()
{
score=score+addscore;
}

function OnGUI(){
GUI.Box(Rect(1000,10,100,25), score.ToString());
}
function WinningScore()
{
     if (score >= 1000 )
     {
          Application.LoadLevel("Win");
     }
  }

sentences:
Using a rule engine for a text-based web game I have a database table that stores basic player data for the game.

It looks like this:

_________________________________________________________
player_id | player_level | player_class_ref | player_exp
    P1            8              W1            68349518
_________________________________________________________
level | required_exp
  1         100
 ...
  8         80000000
____________________

The game itself is text and browser based.

I decided to use a rule engine to adjust player data when needed.

It executes after every player event - for example, killing a monster or finishing a quest.

The sample rule looks like this

when
    player_exp > closest_level_exp
then
    player_level + 1
    player_exp = abs (closest_level_exp - player_exp)

There might be a lot of similar rules - for example, quest accepting.

So my question is - Is my approach viable for a web and text based game?

I am not sure how such things are usually implemented in games, such rules be hard coded, or they are stored another way?

sentences:
Help making a visual transition with pygame and NumPy Perhaps this could be better answered on Stack Overflow, but I thought it would be worth posting here. Right now I'm trying to make visual transitions with pygame's surfarray module which uses NumPy. I'm using Cave Story's diamond-checkerboard transitions as a model right now (you can see them in this video http://www.youtube.com/watch?v=mJbAs-sSX4A).

I'm new to NumPy and I'm a little bit over my head. Is there an easy way to accomplish this, or are there any tutorials I should be following? Google brought up a bunch of general NumPy tutorials which I didn't find very helpful for my specific needs.

sentences:
Correct way to use Farseer Physics in XNA I am using Farseer Physics for my 2D sidescroller game and I'm not sure how to proceed with it. I currently have a Sprite class (handles nothing but graphics), a GameObject class (contains specific object info like hit points), a World object which contains the list of Bodies, and a Level object which contains all of these objects.

Originally I was trying to keep track of the Sprites, GameObjects, and Bodies separately because I felt that would provide loose coupling but it quickly became a headache.

So my new idea was to add a Sprite member to the GameObject class but I'm still not sure how to maintain the Bodies because they have to communicate with GameObject.

Specifically, my issue is this: The position of the Body is used to draw the Sprite inside of the Level. In order to do that I would have to maintain a link between GameObjects and Bodies. Is this correct or is there a better way to architect my game?

If any of this is unclear please ask and I'll try to clarify. Thank you in advance for any help.

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:
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: 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:
How to draw only visible tiles? I have a big map with isometric tiles(3d camera), how can i draw only visible tiles ?

Whats the best way to do that ? space partitionning (octrees etc...)?

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:
Interactively edit UV mapped, textured mesh in Cinema 4D without distorting texture? I'm fairly new to Cinema and I'm building a rigged flat (2d) character out of illustrated pieces. I want the meshes to have an efficient number of polys but sufficient resolution where they'll bend most, so I'm starting with planes and mostly knifing away. Part of this process is roughly following the contour of the piece (say, an arm) with the edge of the mesh. I'm fine with the modeling, but I think I may be doing the texturing in a somewhat roundabout way, and I'm wondering if you can suggest a better technique.

My pipeline requires that all the textures be UVW mapped with no offset or scale. (I'm exporting to Unity through FBX)

Basically it's like this:

Set the texture tag to Flat projection
Modify the mesh (moving vertices, adding and removing vertices, etc)
Go back to UVW projection
In BodyPaint's UV Manager, in UV Poly Edit Mode, choose Flat projection fitted to object system.

The only problem with this is that if I have to tweak the mesh later, I'll have to go back into Flat projection so that moving the mesh vertices doesn't stretch the texture... and for some reason, after I've made a bunch of edits, the frontal mapping ends up requiring scale and offset to align again. Of course, I have to zero these out again when I'm satisfied and go back to UVW mapping. It really seems like an awful workaround to what should be a simple task.

Is there a better way to do this? Can I interactively move the vertices around while keeping a flat UV mapping, without switching back and forth in the Texture tag?

sentences:
OpenGL ES 2 jittery camera movement First of all, I am aware that there's no camera in OpenGL (ES 2), but from my understanding proper manipulation of the projection matrix can simulate the concept of a camera.

What I'm trying to do is make my camera follow my character. My game is 2D, btw. I think the principle is the following (take Super Mario Bros or Doodle Jump as reference - actually I'm trying to replicate the mechanics of the latter): when the caracter goes beyond the center of the screen (in the positive axis/direction), update the camera to be centred on the character. Else keep the camera still. I did accomplish that, however the camera movement is noticeably jittery and I ran out of ideas how to make it smoother.

First of all, my game loop (following this article):

private int TICKS_PER_SECOND = 30;
private int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
private int MAX_FRAMESKIP = 5;

@Override
public void run() {
    loops = 0;

    if(firstLoop) {
        nextGameTick = SystemClock.elapsedRealtime();
        firstLoop = false;
    }

    while(SystemClock.elapsedRealtime() > nextGameTick && loops < MAX_FRAMESKIP) {
        step();
        nextGameTick += SKIP_TICKS;
        loops++;
    }

    interpolation = ( SystemClock.elapsedRealtime() + SKIP_TICKS - nextGameTick ) / (float)SKIP_TICKS;

    draw();
}

And the following code deals with moving the camera. I was unsure whether to place it in step() or draw(), but it doesn't make a difference to my problem at the moment, as I tried both and neither seemed to fix it. center just represents the y coordinate of the centre of the screen at any time. Initially it is 0. The camera object is my own custom "camera" which basically is a class that just manipulates the view and projection matrices.

if(character.getVerticalSpeed() >= 0) { //only update camera if going up
        float[] projectionMatrix = camera.getProjectionMatrix();

        if( character.getY() > center) {

            center += character.getVerticalSpeed();

            cameraBottom = center + camera.getBottom();
            cameraTop = center + camera.getTop();

            Matrix.orthoM(projectionMatrix, 0, camera.getLeft(), camera.getRight(), center + camera.getBottom(), center + camera.getTop(), camera.getNear(), camera.getFar());
        }
    }

Any thought about what I should try or what I am doing wrong?

Update 1: I think I updated every value you can see on screen to check whether the jittery movement is affected by that, but nothing changed, so something must be fundamentally flawed with my approach/calculations.

sentences:
Canvas not visible in my GearVR Project with Vuforia (Unity) I created a simple AR project with vuforia and my Samsung GearVR, like described here : https://developer.vuforia.com/library/articles/Solution/Integrating-Gear-VR-and-the-AR-VR-Sample-in-Unity-5-3-and-above . This works fine so far. Now I want to add some canvas elements, I don't want them to move, just fixed canvas elements. I tried to place my canvas on different positions in the scene :

Root
Child of CameraRig
Child of LeftCamera
Child of TrackableParent
Child of an ImageTarget in TrackableParent

But for all of these cases the canvas is not visible. I know, this question is really specific, but maybe someone with knowledge in this specific thing can help me.

This is my Canvas :

sentences:
Have body resume constant velocity after collision I want to have a body move at a constant velocity, but react to collisions.

My example game is a train, I want it to move at 1 meter a second. If an obstacle appears on the tracks, I want it to react by smashing through it (which will normally slow it down). But when the obstacle is cleared, I want the train to accelerate back to 1 m/s and continue on.

It seems like the applyLinearImpulse() and applyLinearForce() methods are the place to start, but those are one-shot methods.

Thanks

sentences:
Upside down ground correction? How would you go about making ground correction for a platformer but upside down(reversed gravity)? I used this formula: P.Y+=(P.Y-2)%8-1 but the character just keeps bumping up and down like a pogo stick.
By ground correction I mean checking if the player is inside a solid tile while falling and moving him up (or down in my case) until he isn't.
if pd.dy<0 then
pd.f=true
pd.g=false
pd.j=false
if col_map(pd,"up",1) then
pd.f=false
pd.dy=0
pd.g=true
pd.y+=(pd.y-1)%8
end
elseif pd.dy>0 then
pd.j=true
if col_map(pd,"down",1) then
pd.dy=0
end
end

sentences:
How can I make my camera follow the player movement in a different position Basically my camera follows the character rotation and position, although the position of it its pretty uncomfortable to use, this is what I needed:

But this is what the I get:

I used a code that someone suggested me yesterday to use, I got a bit creative with it and changed some stuff to get other camera positions, but no matter how much I tweak the values the camera never gets the position that I need:

void LateUpdate()
{
    transform.position = player.transform.position - (player.transform.up * -10) + (player.transform.forward * -15);
    transform.LookAt(player.transform);

}

I have no idea how I can make it show less of the player back

sentences:
How to implement a component based system for items in a web game Reading several other questions and answers on using a component based system to define items I want to use one for the items and spells in a web game written in PHP. I'm just stuck on the implementation.

I'm going to use a DB schema suggested in this series (part 5 describes the schema);
http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

This means I'll have an items table with generic item properties, a table listing all of the components for an item and finally records in each component table used to make up the item.

Assuming I can select the first two together in a single query, I'm still going to do N queries for each component type. I'm kind of fine with this because I can cache the data into memcache and check there first before doing any queries. I'll need to build up the items on every request they are used in so the implementation needs to be on the lean side even if they're pulled from memcache.

But right there is where I feel confident about implementing a component system for my items ends. I figure I'd need to bring attributes and behaviors into the container from each component it uses. I'm just not sure how to do that effectively and not end up writing a lot of specialized code to deal with each component.

For example an AttackComponent might need to know how to filter targets inside of a battle context and also maybe provide an attack behavior. That same item might also have a UsableComponent which allows the item to be used and apply some effect onto a different set of targets filtered differently from the same battle context. Then not every part of an item is an active part, an AttributeBonusComponent might need to only kick in when the item is in an equipped state or when displaying the item details page.

Ultimately, how should I bring all of the components together into the container so when I use an item as a weapon I get the correct list of targets? Know when a weapon can also be used as an item? Or to apply the bonuses the item provides to a character object?

I feel like I've gone too far down the rabbit hole and I can't grasp onto the simple solution in front of me. (If that makes any sense at all.)

Likewise if I were to implement the best answer from here I feel like I'd have a lot of the same questions.
How to model multiple "uses" (e.g. weapon) for usable-inventory/object/items (e.g. katana) within a relational database

sentences: What's the difference between a game engine and a physics engine? What's the difference between a game engine and a physics engine? How do they work together, and what's the meeting point between them?

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 kind of databases are usually used in an MMORPG? Do people write their own DB for some reason?

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 access and change a Tilemap's Order in Layer? I'm making a game about two ghosts, and an important thing that I want to add is the possibility to pass through walls. I have managed to make the passable behaviour and everything.
Next, I need to change the Tilemap's Order in Layer number. That's because I want to add some things inside the Tilemap that should be shown until player passes the wall. The way I though of to do this is to decrease the tilemap's layer order when the player is inside it, and put it back to the previous value when player exits.

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:
Brighter pixels around area (OpenGL ES 2) I'm trying to achieve an effect like in the image bellow. Basically I will have a 2D texture and I want a small area around a point (let's call it "light source") to be slightly better lit (i.e. be brighter). The light source will never move from its original position nor will it seem to "pulse" like the light of a fire for example. All the other areas further away will have some default brightness.

From my understanding, this can be done using a light map, but I was wondering whether it was possible to come up with a formula in the fragment shader of the texture below that changed the brightness of my pixels so that it is very bright around a particular point and quickly faded to a default value for the pixels further away. I tried working with something like this:

precision mediump float;
uniform sampler2D u_Texture;

uniform vec3 u_LightPosition;
varying vec3 v_Position;
varying vec2 v_TexCoordinate;

void main() {
    float dist = length(v_Position - u_LightPosition);
    gl_FragColor = (1.0 / (c + b * dist + a * dist * dist) + 0.15) * texture2D(u_Texture, v_TexCoordinate);
}

where c, b and a are hardcoded and adjusted by myself. However I wasn't able to find any combination of c, b and a that achieved an effect like the one from the image, because the brightness doesn't fade away quickly enough and it's very gradual. I think that's expected behaviour from a quadratic expression anyway, so my approach is clearly wrong and it's not a matter of adjusting c, b and a. What should I try then?

sentences:
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:
Unity3D - JsonUtility returns empty string i have the problem that when I convert an instance of highscores through JsonUtility.ToJson the value of my value of it is always {"highscoreEntryList":[{},{},{},{},{},{},{},{},{},{},{}]}...

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

public class HighScoreTable : MonoBehaviour
{
    private Transform entryContainer;
    private Transform entryTemplate;
    private List<HighScoreEntry> highScoreEntries;
    private List<Transform> highScoreEntryTransformList;
    private void Awake()
    {
        entryContainer = transform.Find("HighScoreEntryContainer");
        entryTemplate = entryContainer.Find("HighScoreEntryTemp");

        entryTemplate.gameObject.SetActive(false);

        highScoreEntries = new List<HighScoreEntry>()
        {
            new HighScoreEntry { Score = 9999, Name = "T1"} ,
            new HighScoreEntry { Score = 9282, Name = "T2"} ,
            new HighScoreEntry { Score = 9942, Name = "T3"} ,
            new HighScoreEntry { Score = 2419, Name = "t4"} ,
            new HighScoreEntry { Score = 2390, Name = "t5"} ,
            new HighScoreEntry { Score = 9282, Name = "t7"} ,
            new HighScoreEntry { Score = 2918, Name = "t6"} ,
            new HighScoreEntry { Score = 4921, Name = "t8"} ,
            new HighScoreEntry { Score = 1318, Name = "t9"} ,
            new HighScoreEntry { Score = 8818, Name = "t10"} ,
            new HighScoreEntry { Score = 9231, Name = "t11"} ,
        };

        highScoreEntryTransformList = new List<Transform>();
        highScoreEntries.Sort((first, second) => second.Score.CompareTo(first.Score));

        foreach (var highScoreEntry in highScoreEntries)
            CreateHighScoreEntry(highScoreEntry, entryContainer, highScoreEntryTransformList);

        Highscores highscores = new Highscores {highscoreEntryList = highScoreEntries };
        string json = JsonUtility.ToJson(highscores);
        PlayerPrefs.SetString("highscoreTable", json);
        PlayerPrefs.Save();
        Debug.Log(PlayerPrefs.GetString("highscoreTable"));
    }

    private void CreateHighScoreEntry(HighScoreEntry highScoreEntry, Transform container, List<Transform> transformlist)
    {
        float tempHeight = 40f;
        Transform entryTransform = Instantiate(entryTemplate, container);
        RectTransform entryRectTransform = entryTransform.GetComponent<RectTransform>();
        entryRectTransform.anchoredPosition = new Vector2(0, -tempHeight * transformlist.Count);
        entryTransform.gameObject.SetActive(true);

        entryTransform.Find("posText").GetComponent<Text>().text = "" + (transformlist.Count + 1);
        entryTransform.Find("scoreText").GetComponent<Text>().text = "" + highScoreEntry.Score;
        entryTransform.Find("nameText").GetComponent<Text>().text = "" + highScoreEntry.Name;

        transformlist.Add(entryTransform);

    }

    private class Highscores
    {
        public List<HighScoreEntry> highscoreEntryList;
    }

    [Serializable]
    private class HighScoreEntry
    {
        public int Score { get; set; }
        public string Name { get; set; }
    }
}

My List property is public and i also tried to write [SerializeField] over it.

sentences:
Is my game at risk of fines due to CVAA if I don't support text-to-speech in chat? Looking at a similar game like Among Us: as far as I know, it only has in text chat as a norm of communication. Shouldn't the game be obligated to have more options for disabilities like text to speech to meet the requirements of the US laws of CVAA?
I want to develop a game with voice and text channels, and I am concerned this may expose me to risk, because adding special things for disabilities will simply not work and it would be so costly by me.
https://www.reddit.com/r/GamerGhazi/comments/ac774q/starting_this_year_games_will_need_to_implement/
https://www.youtube.com/watch?v=0GROVGdetG4
https://www.thenerdmag.com/video-games-in-us-will-now-require-text-to-speech-and-vice-versa-to-cater-disabilities/
Neither PUBG, CSGO, VALORANT, DESTINY has text-to-speech options. Are companies ignoring the rule, or for as long as you are a big corporation with good lawyers this doesn't apply to you?
I as an indie developer with my idea won't stand a chance. What should I do?

sentences:
Unity5 - Create navmesh for a random generated environment I am following this tutorial to create a game with random generated mazes:

http://catlikecoding.com/unity/tutorials/maze/

I want to add some monsters to roam around the newly created maze. How can I create navmesh for this kind of random generated environment?

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:
How to handle mesh update in its vertex buffer suppose i have a mesh, it can undergo any kind of changes - bend, stretch, even been torn. How should i update vertex buffer in DirectX for this mesh. For now i recreate it every time, and i don't see any chances for another approach because i don't know what part of vertices array can change between steps.

Is there any known approaches for this problem?

sentences:
Realistic slow-falling snow algorithm? Is there a good algorithm that simulates falling snow? I'm particularly interested in snow that falls slowly, so it doesn't quite fall in a straight line but deviates a bit. Maybe even including simulation of flurries (drafts of wind), variable size, etc. Are there any papers or articles on an algorithm that mimics real-life snow movements or simulates it in the context of a game?

I'm particularly interested in a 2D algorithm, but I imagine any algorithm can be taken to 3D easily.

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:
Create Random Platformer-Gameworld Evening.

I created a xna-game like the iOS Platformer game "Banana Kong".
The level-layers are currently saved as XML files.

Example:

<level>
    <layer1>
        <tile type="0" x="50" y="70"></tile>
        .. And so on
    </layer1>
    .. And so on
</level>

Its a temporary solution, yes, but when I sell/release it, static levels are not very good.

So How I could create levels randomly?

The engine would have to pay attantion, to not create tiles, the player can't reach, or create tiles an other tiles.

My current concept is, that the engine could create random tiles as long a tile fits every condition - but there is a unlikely chance that this will never happen and I think there are better methods to do this.

So, I hope anybody could give me some resources, theories or anything, what can help me.

sentences:
Lua script for World of Warcraft: Get Quest Info I'm looking to make a very simple addon or even a macro where I can enter a quest ID and get the quest completion status.  As it is, I know I can use IsQuestFlaggedCompleted to get the quest status, but I wanted to also get the name of the quest so the return in the chat log will show something a little more understandable.
For example:
Enter /questDone 43502
instead of just 43502: true as the output, I want it to look like A Change of Seasons: Quest Completed.

I see a function C_TaskQuest.GetQuestInfoByQuestID that's supposed to return the quest's title, but it doesn't seem to work as expected.  It always seems to return nil for the quest name...

sentences:
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:
Can I use my self made piano version of a popular copyrighted song as my game background music? I am making a game, the theme of the game is kind of romantic, and I, myself, have made a piano version of a modern pop song that would fit with that theme. The song in question is still under copyright, and I'm not the owner of the copyright.

Can I use it as a background in my game? Would there be any legal issue regarding copyright/IP etc?

sentences:
What would cause my script generated buttons and text to show in Unity and not on my phone? I am using Unity 5 and the built in GUI tools.  My static GUI shows up just fine which makes me think it's not a text/font issue or some such. Again, it all looks good in the Unity editor when I hit Play.

I have tried the different canvas options as far as what space to work in and how to scale. I have messed with the build options.  I have tried turning batching off. I have tried building for Android 4 through 5. (Ice Cream, Jelly Bean, etc) I have tried turning dynamic text on and off.  I have ensured the Buttons and text are made to be children of the canvas. I have only uploaded the game onto my Galaxy Note 4. I moved my background texture out of screen space in case it somehow covered the buttons on Android.

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

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:
C++ Object management/deletion I am working on a game with a lot of bullets, currently every second it loops through a vector of bullet objects and checks if its marked for erasure or not.

if (timer2>=120){

    auto it = Bulletlist.begin();
    while (it != Bulletlist.end())
    {
    if ((it->del)) {
             it = Bulletlist.erase(it);
         }
         else {
             ++it;
         }
    }
    timer2=0;
    }else{
    timer2++;
    }

This works fine for around 0-200 bullets, however when I try to scale it larger the delay becomes very noticeable. I am still very new to C++, And was curious if there is a better way of doing this. The bullet class automatically marks itself for deletion when it goes out of bounds.

    int update(){
    if (acceleration!=0){
    if (speed < acceleration){
    speed+=increment;
    }
    }
    x=(speed*cos(angle)) + x;
    y=(speed*sin(angle)) + y;

    if (x<0) del=true;
        if (x>1000) del=true;
        if (y<0) del=true;
        if (y>750) del=true;
    circ.setPosition(x,y);
    window.draw(circ);
};

Edit: Bullets are generated right now on a loop within a enemy class

void shoot(int which){
    Bullet B1;
    B1.setsprite();
    currentangle+=(6.2832/bnum)+0.05;
        B1.setvars(x,y,currentangle*which,1.f,2.f,0.01f);
    Bulletlist.push_back(B1);
    }
    void update(){
     movtimer+=0.01f;
     //x += sin(movtimer);
     //std::cout<<x;
     //printf("\n");
     sprite.setPosition(x,y);
      if (timer>=10){
      for (int i=0; i<bnum; ++i) {
      shoot(1);
      }
      timer=0;
      }else{
      timer++;
      }
      window.draw(sprite);
      for (std::vector<Bullet>::iterator it = Bulletlist.begin() ; it !=    Bulletlist.end(); ++it){
       it->update();
      }
```

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:
Fast software color interpolating triangle rasterization technique I'm implementing a software renderer with this rasterization method, however, I was wondering if there is a possibility to improve it, or if there exists an alternative technique that is much faster. I'm specifically interested in rendering small triangles, like the ones from this 100k poly dragon:

As you can see, the method I'm using is not perfect either, as it leaves small gaps from time to time (at least I think that's what's happening).

I don't mind using assembly optimizations. Pseudocode or actual code (C/C++ or similar) is appreciated.

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:
Layout problem when implementing chat UI in Unity I want to implement UI layout in Unity:

And here's what I've already done in Unity using an scroll view and putting a Vertical Layout Group and a Content Size Fitter on its content

Now the problem is because I'm using Vertical Layout Group on scroll view's content I'm unable to assign the x value of these chat bubbles because I have to align the other user's chat bubbles to the left and align the self chat bubbles to the right just like the first image. Any ideas on that?

sentences:
Shadows are choppy on Android, but look fine in Unity Editor on my PC Here is a gif of what I'm seeing with my shadows on my Android device:

https://gfycat.com/VapidTestyFrigatebird

That shadow looks perfectly fine from any angle / distance in my Unity editor, however.  I don't know much about shadows in Unity yet, but here's a bit more info about my settings:

Directional Light Settings

Shadow Quality Settings

Has anyone experienced an issue similar to this before?  How do I fix this shadow choppiness?

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:
XNA Skinned Animated Mesh Rendering Exported from Maya I am working on translating an old RTS game engine I wrote from DirectX9 to XNA. My old models didn't have animation & are an old format, so I'm trying with an FBX file. I temporarily "borrowed" a model from League of Legends just to test if my rendering is working correctly.

I imported the mesh/bones/skin/animation into Maya 2012 using an "unnamed" 3rd-party import tool. (obviously I'll have to get legit models later, but I just want to test if my programming is correct). Everything looks correct in maya and it renders the animations flawlessly.

I exported everything into a single FBX file (with only a single animation).
I then tried to load this model using the example at the following site:
http://create.msdn.com/en-US/education/catalog/sample/skinned_model

With my exported FBX, the animation looks correct for most of the frames, however at random times it screws up for a split second. Basically, the body/arms/head will look right, but the leg/foot will shoot out to a random point in space for a second & then go back to the normal position. The original FBX from the sample looks correct in my program.

It seems odd that my model was imported into maya wrong, since it displays fine in Maya. So, I'm thinking either I'm exporting it wrong, or the sample code is bad & the model from the sample caters to the samples bad code.

I'm new to 3D programming & maya, so chances are I'm doing something wrong in the export. I'm using mostly the defaults, but I've tried all 3 interpolation modes (quaternion, euler, resample).

sentences:
How to blur image using glsl shader without squares? I want to blur image with Gaussian blur algorithm. And I use the following shaders:

Vertex shader

attribute vec4 position;
attribute vec4 inputTextureCoordinate;

const int GAUSSIAN_SAMPLES = 9;

uniform float texelWidthOffset;
uniform float texelHeightOffset;

varying vec2 textureCoordinate;
varying vec2 blurCoordinates[GAUSSIAN_SAMPLES];

void main()
{
    gl_Position = position;
    textureCoordinate = inputTextureCoordinate.xy;

    // Calculate the positions for the blur
    int multiplier = 0;
    vec2 blurStep;
   vec2 singleStepOffset = vec2(texelHeightOffset, texelWidthOffset);

    for (int i = 0; i < GAUSSIAN_SAMPLES; i++)
   {
        multiplier = (i - ((GAUSSIAN_SAMPLES - 1) / 2));
       // Blur in x (horizontal)
       blurStep = float(multiplier) * singleStepOffset;
        blurCoordinates[i] = inputTextureCoordinate.xy + blurStep;
    }
}

Fragment shader

uniform sampler2D inputImageTexture;

const lowp int GAUSSIAN_SAMPLES = 9;

varying highp vec2 textureCoordinate;
varying highp vec2 blurCoordinates[GAUSSIAN_SAMPLES];

void main()
{
    lowp vec3 sum = vec3(0.0);
   lowp vec4 fragColor=texture2D(inputImageTexture,textureCoordinate);

    sum += texture2D(inputImageTexture, blurCoordinates[0]).rgb * 0.05;
    sum += texture2D(inputImageTexture, blurCoordinates[1]).rgb * 0.09;
    sum += texture2D(inputImageTexture, blurCoordinates[2]).rgb * 0.12;
    sum += texture2D(inputImageTexture, blurCoordinates[3]).rgb * 0.15;
    sum += texture2D(inputImageTexture, blurCoordinates[4]).rgb * 0.18;
    sum += texture2D(inputImageTexture, blurCoordinates[5]).rgb * 0.15;
    sum += texture2D(inputImageTexture, blurCoordinates[6]).rgb * 0.12;
    sum += texture2D(inputImageTexture, blurCoordinates[7]).rgb * 0.09;
    sum += texture2D(inputImageTexture, blurCoordinates[8]).rgb * 0.05;

    gl_FragColor = vec4(sum,fragColor.a);
}

This produces an image with a lot of blurred squares.

But. How to get something like this?

sentences:
Cannot create EAttachmentRule variable in a Blueprint struct I'm trying to add a EAttachmentRule variable in a struct but the enum doesn't appear in the list of available types

I managed to create a variable in a BP by dragging the pin from an AttachActorToComponent node and promoting it to a variable. But I can't do the same thing to create a variable in a struct

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:
Error OpenGL null Cocos-2D/Visual Studio When I try to execute a game code fully functional on Visual Studio 2013, using Cocos-2D (3.8.1) library this error jumps on screen. (I'm working on a laptop)

  OpenGL 1.5 or higher is required (your version is (null)). Please upgrade the driver of your video card.

And then this one:

My Graphic card is an AMD Radeon HD 7600M (OpenGL version 4.x), with de drivers fully updated.

Neither my college teacher nor me know how to fix it.

What can I do to fix it?

sentences:
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:
Speed seems random with constant impulse I'm shooting an object from the top vertex of a triangle using Box2dWeb. The issue I'm having is that the projectile speed seems to be fairly random, even with applyimpulse set to a constant. The gravity is set to zero.

I thought it could be the physics step, changing these settings hasn't made a difference. The projectile will shoot out at very very fast speeds, then it will shoot out at its defined speed.

bodyman[0].GetBody().ApplyForce(
    bodyman[0].GetBody().GetWorldVector(new b2Vec2(0,-50)),
    bodyman[0].GetBody().GetWorldCenter());

sentences:
Are there legality issues using a company's name in a game? I'm working on an RPG of sorts where the character has a "day job" that determines how much money they make each time the day cycles and other things like that.

Are there any legality issues with using the names of companies like "Barnes & Noble" or even "Apple"?

sentences:
Is Unity 5.6 NavMesh Data Available to Gizmos/Editor? I have a script from Dungeon Architect that basically draws Gizmo lines along all connections between neighboring waypoints, which is nice.  However, I'd like to draw a secondary line the follow the lowest cost path on the NavMesh between two points (in the scene view as a gizmo, preferably).  There's a sample I'm trying to work from here:

https://docs.unity3d.com/ScriptReference/AI.NavMesh.CalculatePath.html

However, if I debug through it, path never gets any values.  I created agents on the objects at the two points, thinking maybe that would make a difference (I'm not sure why I thought that).  Does this script need to be attached to one of those points?  With a NavAgent?  Or am I missing something completely obvious?

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:
Implementing Online Leaderboards for indie windows PC Game I've just finished my game and I'd like to add some ranking functionality to it. I have a mySQL database running on my website and want to be able to insert and retrieve data from it. My knowledge in server side programming is basic to none and I'm wondering if you could provide me some tips on how to approach this. My game was developed in C++.

1) Should I look for I library written in C/C++ that handles this client/server communication directly?

OR

2) Should I implement it through a script (say python) and somehow interface it through my C++ code. By interfacing I imagine I'd call .py passing in a string as argument, and somehow receiving a string as return. (table entries, error messages, etc). Also I don't want anyone messing up with the database. I don't know, the source code would be there with connection authentication and I assume anyone knowing python could adjust it to inject any value in the database. Well, If that is a good approach what libraries could I use to interface C and Python (or any other say Java).

sentences:
What am I missing for this flycam to work correctly? Through reverse engineering, I've found an instruction to inject on which allows me to obtain the XYZ coordinates of the camera, as well as pitch and yaw. Thus, I have the following:

  camX (Plane) -- Value is a float ranging from negative to positive
  camY (Plane) -- Value is a float ranging from negative to positive
  camZ (Up/Down) -- Value is a float ranging from negative to positive
  camH (Horizontal/Yaw) -- Value is a float in degrees from +180 to -180
  camV (Vertical/Pitch) -- Value is a float in degrees clamped to +89 to -89

I've written a script in Lua which allows me to bind directions (forward, backward, left, right, up, and down) to keys (W, A, S, D, Q, and E); however, those simply add/subtract to/from XYZ values along with a speed modifier, meaning if I'm facing forward and moving forward, everything is fine. Turning 180 degress with the mouse, though, effectively means back is forward, left is right, etc.

What I'm looking to achieve is having those directional keys apply to wherever I'm aiming the mouse pointer. So, forward is always where I'm facing, etc.

I've been piecing together the necessity of sin/cos for calculations related to this; however, I'm apparently in over my head with understanding everything I'm reading/watching. I've found a number of calculations for this based on degrees, radians, converting degrees to radians, etc., but I'm just completely lost as nothing I've tried has panned out (even though I think I understand what I'm reading).

I've ascertained that, where applicable, respective games have sin/cos values stored somewhere in memory which I could use in lieu of calculating those values myself, but I'm honestly not sure what those values look like to seek out in the first place...or exactly what I need to do to make the calculations myself. They're probably staring me right in the face in nearby memory or on the stack as I trace through code, but I simply don't know.

Are there multiple ways to calculate the appropriate angles via sin/cos? Can I use some combination of the 5 values I listed above, along with a speed modifier and Lua's math.* methods (math.rad, math.sin, math.cos), to get this flycam to work properly?

Thank you for any guidance you can provide!

sentences:
How to achieve after-image pixel shader effect How would one go about writing a pixel shader like this one in XNA 4.0?

http://www.youtube.com/watch?v=f1uZvurrhig&feature=related

sentences: How to make one solid object in Maya? How can I "glue" more objects to each other so I get one object? (It is for resizing models), couldn't find anything about it on the internet, but I'm dutch, so maybe that's why. Thank you very much!

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:
Game Development at iOS+Android Platform : Template Engine for UI We have broken down our game development process to

UI Programming
Core Game Programming
Particle Effect Programming

UI will be created by a group of programmers and those UI will be used at Core Game Programming.

For example, at web applications, there are several template engine available, for example Smarty.

Is there any Template engine for UI for Game Development

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:
Why should I use getcomponent? I have already referred the animator by using the statement,

       Animator anim;

But,What is the use of getcomponent in awake() function.What happens without it.

sentences: 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:
Painting terrain with a selection circle I don't mean putting a circle under a unit like done in an RTS, that's fairly simply done with a scenegraph(-like structure). What I'm referring to is selection circles for things like Area of Effects that are painted on the terrain.

It seems relatively simple until I think about it.

Here are some images for reference:

http://i.stack.imgur.com/iXWXB.jpg
http://im.tech2.in.com/images/2009/jan/img_116282_initialthreat_640x360.jpg

The first image gets the idea across, but not the full scope. Basically, the floor is painted with a decal detailing the region that will be affected by the spell.

The second image gets it across much better, it's not just a flat painted circle, it wraps along the mesh.

At first I figured to use some sort of object selection, and then in the vertex shader draw the texture on the correct vertices based on... some criteria that I'm still working out. Most likely based on distance and angle from the intersection point. The difficulty seems to come in that the methods wrap onto objects that seem to be completely different meshes.

I can't find an image that shows it (and don't play WoW anymore so I can't take a screenshot), but say you have a terrain mesh and a house on top of it and I select a point very close to the house's wall. Instead of continuing on the terrain mesh, the selection circle will go as far along the terrain mesh as it can, and then wrap up onto the wall of the house. It also ignores certain objects (players, etc), but that's pretty easy to ignore with correct collision tags/callbacks.

It's not so much that I can't think of a way to do this, but all the ways I can think of would probably lag your game out or turn your processor into slag. Somehow I have to:

Draw a texture
With no breaks
Wrapping on multiple objects according to the terrain
Centered at a given point
Completely dynamically (so no pre-baking it into a bunch of dummy textures)
Quickly enough to be computed every frame

Is there a standard method for this? Am I just overthinking it?

My best guess is rather than do one ray cast and selecting that point as the "center" I do a bunch of casts and in each case select the nearest vertex and bind the appropriate UV coord to that vertex, but it seems messy and potentially performance heavy to select that many vertices that way at the CPU frame-by-frame level. Especially since ray casts in general are expensive, even with a good physics engine.

It also doesn't seem particularly portable to anything other than a selection circle. A similar case would be like drawing the movement arrow over the terrain in Total War games, a thick arrow is drawn between the unit and its destination (see here: http://webguyunlimited.com/pixelperfectgaming/wp-content/gallery/total_war_shogun_2_rise_of_the_samurai/total_war_rots_screenshot_014.jpg ), this would seem to be a very similar technique to the AOE selection circle, but the ray cast method I mentioned wouldn't really work for it. There are, of course, numerous other examples too (such as trajectory markers).

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:
How to rotate camera counterclockwise around player? Holder contains camera and rotates around player

Camera looks like in diablo, titan quest, grim dawn, etc

I cant rotate camera to negative angle values

My code:

public void ChangeRotation(float val){
    if(isTurning)
        return;
    isTurning = true;
    needAngleY += val;
}

void Turning(){
    Quaternion quatertion = transform.rotation;
    Vector3 eulerAngle = new Vector3(0, quatertion.eulerAngles.y, 0);

    if(needAngleY - eulerAngle.y < 0.2f){
        if(needAngleY == 360 || needAngleY == -360){
            needAngleY = 0;
        }
        eulerAngle.y = needAngleY;
        isTurning = false;
    } else {
        eulerAngle.y = Mathf.Lerp(eulerAngle.y, needAngleY, timeRotation * Time.deltaTime);
    }
    m_Compas.rotation = eulerAngle.y;
    quatertion.eulerAngles = eulerAngle;
    parentTran.rotation = quatertion;
}

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:
Particles emit even though emission is disabled I have created a basic particle system which is a single burst around a sphere.

I have a script that disables this emission upon Start.

If I don't disable the emission, then the particles continuously emit in bursts.

However when I disable the emission, it does not completely prevent particles from being emitted. There is still a single burst at the beginning.

Here is how it looks with emission disabled:

Here is the script which is setting emission.enabled = false. This is attached to the sphere and the particle system is a child of the sphere.

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

public class BalloonPop : MonoBehaviour
{
    public new Renderer renderer;
    public ParticleSystem emitter;
    public float explosionTime = 0.5f;

    private ParticleSystem.EmissionModule emission;

    void Start() {
        if (!renderer) { renderer = GetComponentInChildren<Renderer>(); };
        if (!emitter) { emitter = GetComponentInChildren<ParticleSystem>(); }
        emission = emitter.emission;
        renderer.enabled = true;
        emission.enabled = false; // <===================================== this
    }
}

All I want to do right now is to make it not emit any particles at all.Then I'll add an event to re-enable the emission, but that's not the issue I'm asking about here. I also tried emitter.enableEmission = false, which is deprecated, and it didn't work.

Here is the particle system in the inspector:

sentences:
Apple App Store: Publish your game under your organization name I am in the process of building a mobile game targeting Apple App Store. This is a co-op work done by me and my teammate. We do not want to publish the game under my personal Apple developer account, but rather use our fantasy org name (let's call it a game dev studio).

Is there a way of doing this without going through the hassle of founding a company? Do I need to get another Apple account type (other than individual person)?

sentences:
What are the pro/cons of Unity3D as a choice to make games? We are doing our school project with Unity3d, since they were using Shiva the previous year (which seems horrible to me), and I wanted to know your point of view for this tool.

Pros:

multi platform, I even heard Google is going to implement it in Chrome
everything you need is here
scripting languages makes it a good choice for people who are not programming gurus

Cons:

multiplayer ?
proprietary, you are totally dependent of unity and its limit and can't extend it
it's less "making a game from scratch"
C++ would have been a cool thing

I really think this kind of tool is interesting, but is it worth it to use at school for a project that involves more than 3 programming persons ? What do we really learn in term of programming from using this kind of tool (I'm ok with python and js, but I hate C#) ? We could have use Ogre instead, even if we were learning direct x starting january...

sentences:
Patterns on preserving players progress across all player's devices I'm writing cross platform game that is requested to store player progress across all their devices. I'm not talking about implementation details, but overall picture;

What are the patterns for preserving player progress in the least intrusive/distruptive way?

Logging in requires players to make account or share their facebook/gmail address; It is strong entry-obstacle when someone wants "just to try the thing up"
I can make account for player after they played a bit... This way, the user already tried the game and if he like to have his progress saved, they can make an account now. If not - the progress will be saved only locally
I can experiment with some information taken directly from device (when playing from mobile, for example); I believe I can easily access their gmail on Android, and use it for account merging later on
I can give them codes that unlock their progress. They can type them on different machines
They can manually move save file; I don't need to keep it online
They can move save file via cloud provider (like Dropbox/Skybox/GoogleDrive)
Anything else...?

sentences: How on earth do you get decent color out of 2BPP? I've been looking into PowerVR textures, and have run into several textures that are apparently 2 bits per-pixel. This, frankly, boggles my mind. How does one get even half way decent color preservation when you only have 4 possible states per pi per pixel? I would love any resources out there that talk about the compression behind such a feat. Thanks!

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

sentences: What is the interval of fragment-shader code execution? Without any intended delay, is the code of a fragment-shader run once per frame? If not, how often will the code be executed? (I'm new to shaders: I'm talking about glsl if it makes any difference)

sentences: How do you rotate the camera using right mouse clicks with Cinemachine? How can I rotate the camera around the player using right-click?

sentences:
XNA spritebatch.Draw: Which part gets colored by the color parameter? Which part gets colored and how can I control it?
I have a rounded block and my goal is to have the center filled with a certain color chosen by that parameter. Here's the picture:

When I draw it with Color.Red for example, just nothing happens.
Simply creating the texture in these colors I need won't help, I want to create the colors very dynamic. That's a very simply texture but I also want to apply it on harder ones.

The center is transparent already.

sentences:
Odds For Fighting Game I'm creating a fighting game where two opponents face off against each other in the ring. While I've been able to figure out the odds of a player winning based on previous wins/losses, I have yet to find a formula which modifies those odds based on opponent. For example:

Player 1: W:5 L:5 - 1/1 odds
Player 2: W:5 L:0 - 1/5 odds

I want to calculate the odds that Player 1 will wins against player 2. Compounding this the players could be of different levels: if the players are within a few levels of each other, the odds should map closely to wins/losses. However, as the levels diverge, the odds of the lower level player winning reduce. As a swag:

Player 1 - W:5 L:5  - 1:1 odds

Against a level  8 - 1:2
Against a level  9 - 2:3
Against a level 10 - 1:1
Against a level 11 - 3:2
Against a level 12 - 2:1

These are just estimates, my sense is that there is a math formula out there which will calculate that - can anyone out there point me to what this could be?

Thanks...Chris

sentences:
gamemaker getting a ball to bounce 90 degrees off of a 45 angle I am trying to get a circle to bounce off a 45 degree diamond shap using Gamemaker Studio.
I would like the ball to bounce in straight lines so my directions would be 0, 90, 180, or 270 degrees, depending on which side of the diamond the collision takes place.  Precise bouncing is giving me all sorts of results so I think I would have to do it in code.

I tried saying:

  if (direction >=0 && direction <=90) {   direction = 90 }

And doing this for all the angles, but this did not work.

Has anyone encountered this before?

sentences:
An Ogre3D iPhone 'Hello World' project? I have been investigating various 3d engines for iPhone/iPad development and have mostly decided to use Ogre3d.  I have got the SDK, the iPhone dependancies, built and run the SampleBrowser project on the simulator and (with some difficulty) my 3GS. My problem is with the complexity of the SampleBrowser project.

It is a cross platform project, which (at this point) I am not interested in supporting and pre-loads all the Ogre tech samples (some of which don't work on the iPhone). What I really need is a very simple bare bones Hello World XCode project to start work with. If someone knows where I can find one, I would appreciate it. If not, building one is the next thing on my todo list.

I have posted the same question on the Ogre forums, so if I get some feedback there, I will update here.

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:
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:
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:
Game freezes, cannot see why My game freezes randomly, mostly when changing from one level to the next. I cannot tell why this is the case. There are no errors or warnings. This happens when i build the game and when I am testing the game in the Unity editor. It will say unfreeze itself after a few seconds.  I have attached one of the level codes and the timer code. I have also attached a picture of how it looks when it freezes.
This is one of the level codes :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;
public class Arduino5 : MonoBehaviour
{
    SerialPort sp = new SerialPort("\\\\.\\COM5", 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 > 50f) )
                {
                    m_Material.color = Color.grey;
                    Renderer _rend = Sphere.GetComponent<Renderer>();
                    Sphere.GetComponent<Renderer>().material = _rend.material;
                    _rend.material.mainTexture = Resources.Load("face4") as Texture;

                }
                else
                {
                    m_Material.color = Color.white;
                }
            }
            catch (System.Exception)
            {

            }
        }
    }
}

and this is the Timer code:

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

public class Timer : MonoBehaviour
{
    public int timeLeft = 5;
    public Text countdownText;

    // Use this for initialization
    void Start()
    {
        StartCoroutine("LoseTime");
    }

    // Update is called once per frame
    void Update()
    {
        countdownText.text = ("Time Left = " + timeLeft);

        if (timeLeft <= 0)
        {
            StopCoroutine("LoseTime");
            countdownText.text = "Times Up!";
            Invoke("ChangeLevel", 1.0f);
        }
    }

    IEnumerator LoseTime()
    {
        while (true)
        {
            yield return new WaitForSeconds(1);
            timeLeft--;
        }
    }
    void ChangeLevel()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
}

In terms of trying to close the serial port, would something like this work:

void Start()

{
    if (!sp.IsOpen)
    { // If the erial port is not open
        sp.Open(); // Open
        sp.ReadTimeout = 250;
    }

// Timeout for reading
else if (sp != null)
{

    {
        sp.Close();
    }
}

}

sentences:
C# XNA: Effecient mesh building algorithm for voxel based terrain ("top" outside layer only, non-destructible) To put this bluntly, for non-destructible/non-constructible voxel style terrain, are generated meshes handled much better than instancing? Is there another method to achieve millions of visible quad faces per scene with ease? If generated meshes per chunk is the way to go, what kind of algorithm might I want to use based on only EVER needing the outer layer rendered?

I'm using 3D Perlin Noise for terrain generation (for overhangs/caves/etc). The layout is fantastic, but even for around 20k visible faces, it's quite slow using instancing (whether it's one big draw call or multiple smaller chunks). I've simplified it to the point of removing non-visible cubes and only having the top faces of my cube-like terrain be rendered, but with 20k quad instances, it's still pretty sluggish (30fps on my machine).

My goal is for the world to be made using quite small cubes. Where multiple games (IE: Minecraft) have the player 1x1 cube in width/length and 2 high, I'm shooting for 6x6 width/length and 9 high. With a lot of advantages as far as gameplay goes, it also means I could quite easily have a single scene with millions of truly visible quads.

So, I have been trying to look into changing my method from instancing to mesh generation on a chunk by chunk basis. Do video cards handle this type of processing better than separate quads/cubes through instancing? What kind of existing algorithms should I be looking into?

I've seen references to marching cubes a few times now, but I haven't spent much time investigating it since I don't know if it's the better route for my situation or not.

I'm also starting to doubt my need of using 3D Perlin noise for terrain generation since I won't want the kind of depth it would seem best at. I just like the idea of overhangs and occasional cave-like structures, but could find no better 'surface only' algorithms to cover that. If anyone has any better suggestions there, feel free to throw them at me too.

Thanks,
Mythics

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: how do I add development build number each time I compile and play? I wanted each time I play my game, it will show in the console how many times you compiled or run the game. How do I do that?

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:
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:
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:
Quadtree vs multiple resolution grids for terrain rendering I have been thinking about quad trees with regards to terrain rendering.

From my understanding the basic functionality of quadtree terrain rendering is to frustum cull the terrain in such a manner:

function render() {
    lod_threshold++;
    if(lod_threshold_reached || !has_children()) {
        draw_terrain_mesh();
        return;
    }
    for(child in children) {
        if(child.bounds.intersect(viewing_frustum)) {
            child.render();
        }
    }
}

where node.bounds is a 3d bounds calculated as containing the maximum heightmap value of the contained terrain

My questions are the following

If we are in fact testing a 2d portion of terrain with it's bounds calculated to include the maximum heightmap value against the 3d frustum, what is the preferred bounds calculation for generating the node.bounds in the quadtree?
That a tree is necessary because that one has to iterate every portion of a 3d scene to calculate frustum occlusion in a general way. Eg, there is no shortcut algorithm to calculate the set of 3d cells generated from a 2d grid that intersect the viewing frustum. As a more general question and to question the obvious, is there a way to calculate cells in a viewing frustum without having to iterate every cell in a scene? Presumably not otherwise you wouldn't need trees for culling

With regards to an alternative grid implementation:

Has this implementation been contemplated for general purpose terrain culling? I am presuming that some form of grid base terrain culling is certainly preferred in certain games, namely top down games where the possibility of terrain in the distance of being on camera is non-existent.

function calc_cells_in_quadrilateral(frustum_projection_onto_2d_terrain_grid) {
    //calculate cells in the resulting quadrilateral projection of the frustum onto the grid without having to bounds test every cell
    //at some point based on distance from camera, assign lod
}
retrieve lod for each cell in the calculated set from lod grids
have multiple (array2 or intmap) containing the terrain data at every lod for O(1) retrieval

Is there is a way to calculate cells in a quadrilateral without having iterate every cell in a grid? eg, from shaving off cells from slopes or something?
If there is, in what fashion should one assign the lod cell based on distance? I haven't contemplated this in detail because #1 may be impossible
The terrain would not be optimally culled in this 2d culling algorithm against the quadrilateral frustum projection onto the heightmap, because the height value at the edges may be outside the screen, correct?
http://www.olhovsky.com/2011/03/terrain-started/ In this post, he describes assigning lod from a grid and from a quad tree. The illustrations are confusing with regards to whether question #1 is correct and terrain rendering with quad trees serves to draw the terrain mesh against the frustum as opposed to just as a function of distance 360 around the camera as at appears to do with his grid implementation. Please specify whether it appears that he is infact not frustum culling in the grid implementation but is frustum culling the quadtree.

sentences:
Algorithm for 2d AI aiming to compensate for gravity In a 2d side-view scenario I have two riflemen aiming at each other. By normalizing the x and y difference they know the direct path to the enemy.

However, gravity will pull the projectiles downwards, so aiming straight for the enemy is obviously useless.

Any interesting ideas for AI-logic when it comes to adding a correction based on world.gravity (which is a "force" in y-pixels per physics tick) and enemy.path (libgdx Vector2 with the X and Y difference to the enemy. Weapon.muzzleVelocity could also be factored in (double, speed in pixels after the shot is fired.

I've been thinking of two things:

Option 1 - Magic numbers

The X distance is multiplied by a magic number (such as gravity) to produce a reasonable close result to an aiming offset. Possibly also factoring in Y-distance, but in most cases, the Y distance should be close to 0.

Pros: Simple, easy to implement, quick, low calculation overhead

Cons: Boring, A bit too arcade for my taste with a very static result, Been done before countless times including by me in previous projects

Option 2 - Firing table

AI trial and error, basically. Each time the unit fires, the X (and Y?) distance of that shot is recorded with the offset used, and the result (hit vs too low vs too high) is registered. Each time the unit fires it'll look up for the closest match to the x-distance to get a rough estimate on aiming offset.

Pros: Units become more valuable as they learn, it's a lot more modern, and it makes sense to me.

Cons: Unit types with low rate of fire will not have much use of their firing table. It's also somewhat complex to implement and will cause a much larger memory footprint as the firing table grows.

For the record, I'm writing this in java/libgdx, mainly targetting the android and HTML5 platforms, but if it turns out to be decent, ports are expected. I'd love to hear other ideas for how a unit can come up with an aiming offset, as well as pros/cons. I have to pick something, and I'm not entirely convinced either of my own algorithms are right for the task.

sentences:
Python library for scripting (C++ integration) Please advise me good wrapper/library for python. I need to implement simple scripting in c++ app; Under "good" I mean pretty understandable, well documented, no memory leaking, fast. For creating base interface of GameObject on Python and C++; Your own experience and useful links will be nice!!! I found link about it, but I need more specific within gamedev context. What combinations of libraries you used for python integration into c++? For example about ogre-python it said

  built using Py++ and Boost.Python library

And one more question, maybe someone of you know how Python was integrated into BigWorld engine (it's own port or some library)?

Thank you!!!

sentences:
Read custom content in MONO-GAME in a cross-platform way using Mono-Game,

i have some custom content files in some binary format (not .xnb)
in run-time i need to read the content of those files.
i prefer to get a stream, but if something will give me a filled byte[] or something,
that's also fine..
this must be cross-platform as much as possible and work on PC \ Mobile \ consoles \ web \ what-ever-mono-game-offers

;

my efforts so far :

ContentManager.Load() does not read custom formats
subclassing ContentManager, and overriding OpenStream(string assetName) did not help - it expects the file i give it to end with .xnb
renaming all files to ".xnb" just for this is not possible for me, because some other proccess reads thease files and expects them the way they are
TitleContainer.OpenStream() seems to read files from the file system,
but im not sure how they will be packed when building for mobile devices for example.

(i know that in unity: for android, content is simply copied to a folder on the device,
but on iphone all content is packed to a binary package.. so reading from the file-system will not work)

(i dont have an iphone\ipad to test this on)
the simple "File.ReadAllBytes()" is no good for the same reason

;

My questions are :

am i right about TitleContainer's cross-platform limitation ?
what can i do ?

thanks.

sentences:
How to get NPC to Find and Follow Path to other NPC? Problem:

I am using Skyrim Creation Kit to create a very simple mod. I want the mod to make one NPC follow another NPC. My first problem is that I am not really 100% sure where to start. The second problem is which functions I should use. I have been reading the documentation at www.creationkit.com. In other words:

LOOP: {
  // move Bob to Mike's current position with speed of 0.5
  (npc_Bob.moveToPosition( npc_Mike.getPos(), 0.5 )
} // end loop

My Attempt:

I tried making a quest but to no avail. So then I made 2 custom actors (member and leader) and I put this script in member:

Scriptname NpcFollowNpc extends ObjectReference
//***put a loop once you get this part working
// moves member to leader with speed of 0.5
member.PathToReference(leader, 0.5)

but it didn't compile. I don't really know if this is the right way to implement what I want. I know how to code and make algorithms and a bunch of that computer science stuff, but I don't know how to move the actor member to the location of actor leader in Skyrim and loop it while the actor leader is alive.

Any ideas how I could go about doing this? thanks for any help/feedback!

sentences:
How do I create a color picker with variable hue and saturation? I am trying to create a Color Picker similar to that of MS Paint.

Unfortunately, I can't figure out the algorithm for saturation.

This is what my current algorithm creates.
Anytime I try to perform a saturated effect going down on the Y axis, it just makes everything after the first line completely red or black.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML;
using SFML.Graphics;
using SFML.Window;

namespace Source
{
class ColorWheel : IGameObject
{
    Image image = new Image(255*6,355);
    Color color = new Color(255,0,0);
    int brightness = 255;
    public Sprite sprite = new Sprite();

    public ColorWheel()
    {
        for (int y = 0; y < 255; y++)
        {
            for (int x = 0; x < 255 * 6; x++)
            {
                //Red 255 - Green 0-254
                if (color.R == brightness && color.G < brightness && color.B == 0)
                {
                    color.G += 1;

                    //color.R -= (byte)y;
                    //color.G += (byte)y;
                    //color.B += (byte)y;
                }
                //Green 255 - Red 255-0
                else if (color.R > 0 && color.G == brightness && color.B == 0)
                {
                    color.R -= 1;

                    //color.R -= (byte)y;
                    //color.G -= (byte)y;
                    //color.B += (byte)y;
                }
                //Green 255 - Blue 0-255
                else if (color.R == 0 && color.G == brightness && color.B < brightness)
                {
                    color.B += 1;

                    //color.R += (byte)y;
                    //color.G -= (byte)y;
                    //color.B += (byte)y;
                }
                //Blue 255 - Green 255-0
                else if (color.R == 0 && color.G > 0 && color.B == brightness)
                {
                    color.G -= 1;

                    //color.R += (byte)y;
                    //color.G -= (byte)y;
                    //color.B -= (byte)y;
                }
                //Blue 255 - Red 0-255
                else if (color.R < brightness && color.G == 0 && color.B == brightness)
                {
                    color.R += 1;

                    //color.R += (byte)y;
                    //color.G += (byte)y;
                    //color.B -= (byte)y;
                }
                //Red 255 - Blue 255-0
                else if (color.R == brightness && color.G == 0 && color.B > 0)
                {
                    color.B -= 1;

                    //color.R -= (byte)y;
                    //color.G += (byte)y;
                    //color.B -= (byte)y;
                }

                image.SetPixel((uint)x, (uint)y, color);
            }

                //brightness--;
        }

        Texture texture = new Texture(image);
        sprite.Texture = texture;
    }

    public void Update(double dt)
    {
    }

    public void Render(RenderWindow rWindow)
    {
        rWindow.Draw(sprite);
    }

}

}

sentences:
Intersection of two limited planes (stripes) Have two limited planes. That means just squares or stripe in 3D space (or two connected triangles on the same plane).
What I want to know is exactly how (and whether) they collide.
My first approach would be to assume endless planes and calculate the collision line (which is always endless and exists unless the planes are parallel). However the resulting line just changes my problem to: "find the intersection of a line and a limited plane" and again I cannot think of a direct solution...
Anyone having a hint or an approach to a solution?
If it simplifies things, it would be safe to assume the planes to be limited in only one direction as in consisting of the area between two endless, parallel rays.
Huge thanks in advance!

sentences:
Blender 2.6: How to Undo 3D Cursor Movement I sometimes place the 3D cursor at the wrong location by a undesigned click on the left mouse button.

But when I'm trying to click Control + Z in order to undo the accidental 3D cursor movement, it doesn't revert.

So my question is: Is there an easy way to get Blender's (2.6) 3D cursor back to it's previous location? Thanks.

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:
Decentralized Matchmaking in Unity? I'm making a card-playing game, similar to Magic Workstation. I've been looking into several options for networking. I have a working LAN version with the build in Unity networking, as well as Photon Cloud. Though I was now looking for a more decentralized way of doing multiplayer on the internet. It would be very very cool if there were no servers involved in finding other people. I would still let players host their own game-rooms others can join.

I Googled around for this, and everything I found was at least several years old. So I was wondering if anything new has popped up since then. I've seen several decentralized chat programs and even voice/video chat without any servers. But nothing for video games yet.

I did find some problems with this kind of networking. Mainly the lack of anti-cheat, but in my case the players check the moves themselves so this shouldn't be a problem. Other than that it's probably a bit slower, but card games are generally not very high-paced :P

Lastly, I'm making it in Unity using c#. I'll probably be running it in the webplayer (and later WebGL). So I'm mostly looking for c# library, or javascript. But any promising projects that do this are welcome.

Thanks a lot!

sentences:
Animation is delayed after few play attemps even though all transition times' are zero I am trying to play animation forward and backward when player press the same button again and again. I have a straight line and I want to convert it to 8 while moving it. I want to play animation backward or forward from the exact frame where I pressed the button again.

When I pressed the button, animation starts playing and moving and If I pressed the button again in the middle of animation it is played backward from the exact frame. However, after a few try my animation starts playing with a delay or it stops playing completely.

I am sending speedMultiplier parameter to make the speed -1 to play backward my animation.

This is the video of the problem

private Animator eightAnimator;
private bool isLine;
private bool isMoving;
private bool becomingEight;
private bool becomingLine;

private Vector3 nextPosition;
private Vector3 startPosition;

// Start is called before the first frame update
void Start()
{
    isMoving = false;
    isLine = false;
    becomingEight = false;
    becomingLine = false;
    eightAnimator = GetComponent<Animator>();

    startPosition = this.transform.position;
}

// Update is called once per frame
void Update()
{
    if(Input.GetKeyDown(KeyCode.M))
    {
        eightAnimator.SetBool("isMoving", true);

        if (isLine)
        {
            isMoving = true;
            isLine = false;
            becomingEight = true;
            becomingLine = false;
            nextPosition = new Vector3(this.transform.position.x + 6, this.transform.position.y, this.transform.position.z);
            eightAnimator.SetFloat("speedMultiplier", 1f);

        } else
        {
            isMoving = true;
            isLine = true;
            becomingLine = true;
            becomingEight = false;
            eightAnimator.SetFloat("speedMultiplier", -1f);
        }

    }

    if(becomingEight)
    {
        this.transform.position = Vector3.MoveTowards(this.transform.position, nextPosition, Time.deltaTime * 10);

        if (Vector3.Distance(nextPosition, this.transform.position) < 0.01f)
        {
            isMoving = false;
            becomingEight = false;
            eightAnimator.SetBool("isMoving", false);
        }
    }

    if(becomingLine)
    {
        this.transform.position = Vector3.MoveTowards(this.transform.position, startPosition, Time.deltaTime * 10);

        if (Vector3.Distance(this.transform.position, startPosition) < 0.01f)
        {
            isMoving = false;
            isLine = true;
            becomingLine = false;
            eightAnimator.SetBool("isMoving", false);
        }
    }

}

I am adding here unity package, video, screen shot and my simple code.

So how can I play my animation when I pressed the button with the exact frame and exact time without delay

This is the project unitypackage file

sentences:
Can I pass RaycastHit2D with a UnityEvent? How do I target only the gameObject hit by my Raycast? Do I need to pass in the RaycastHit2D to a custom Unity Event?

I'm shooting a raycast, if it hits a valid target it fires off a UnityEvent to deduct health. My code is currently removing health from all "Enemy" prefabs within the scene even if they aren't being hit by the raycast.

public GameEvent OnDamaged;

public void ConfirmHit()
    {
        var target = Physics2D.Raycast(transform.position, Vector3.right * damageRange, damageRange, layermask);

if (!target) return;

        OnDamaged.Raise();
    }

if a target is hit by the raycast it will trigger the OnDamaged Event. The Event Triggers a simple function to decrease health.

public void DecreaseHealth(float amount)
{
    currentHealth -= amount;
}

sentences: Blurry UI when using Screen Space Camera I am using Screen-Space Camera as a render mode on canvas but the Textmeshpro text and other UI elements are looking blurry around edges. I think it might be due to canvas scaler setting. After changing plane distance or making canvas child of camera problem still exist.Following is the result I am getting in unity and Canvas settings.

sentences:
Show/hide soft-keyboard on demand I'm writing simple chat-app using Unity. The problem with Unity's default implementation of soft-keyboard visibility is that it hides itself when i'm clicking outside of keyboard panel. What i want is that keyboard stays always shown until i explicitly tells otherwise.

For a couple of days i tried to find similar questions but none of them helped me. I have very little experience in "native" android development (i.e. Java). So far i managed to create simple native plugin for Unity. I tried to manually open keyboard with this code:

imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);

The result was fine, except the keyboard had InputType set to TYPE_CLASS_NUMBER. For my app i needed TYPE_CLASS_TEXT. So i tried to research how to set InputType and stumbled on fact that this property can only be changed inside EditText object. As i'm writing my app in Unity, i had no way of finding my InputField's inside native code. So i tried to create EditText inside my native plugin. I followed the logic that if i create custom EditText, place it inside main layout and set visibility to NONE or make background transparent, then i can set focus to that element and be fine:

FrameLayout myLayout = activity.findViewById(android.R.id.content);
focusedText = new EditText(context);
focusedText.setFocusable(true);
focusedText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL);
myLayout.addView(focusedText);
focusedText.setFocusableInTouchMode(true);
focusedText.requestFocus();
focusedText.setBackgroundColor(activity.getResources().getColor(android.R.color.transparent));
imm.showSoftInput(focusedText, InputMethodManager.SHOW_FORCED);

The end result was a mess. Soft keyboard behaviour became undesirable. In order for keyboard to show, i first needed to select InputField, then i would see transparent EditText be created in the middle of my layout with all input characters visible. Even if all worked fine, it still looks like a wacky hack.

Does anyone stumbled across similar issues?

sentences:
Passive skills and items I'm making a small text browser RPG game using PHP, MySQL and Java Script (and jQuery). All the items are saved in the MySQL database.

Every now and then a character have to make a skill roll (Talk, Climb, Sneak, etc. ), but I have the following problem - some of the items give passive bonuses to some skills. Let's say we have Official Suit item, it gives +1 to Talk rolls and One time use only - automatic success on a Talk roll.

My problem is the following - how can I implement a function for every item, that gives the bonuses or other options when the appropriate roll is made. I want when the player click the Talk option, a function to be run that makes the Talk roll and searches character's inventory for items that give him bonuses to that roll. If it sees that the player have such an item, let's say it's the Official Suit, it runs the item's function which gives the +1 Talk bonus and if the roll fails, the function gives an option to use the special ability of the item for automatic success.

So what is the best way to do this? Keywords to each item or some other way? I can't think of a scalable solution.

sentences:
How to see the surface arc in Unity? How to see the surface arc in Unity?
There is the tutorial and in this tutorial we can see the arc in editor:

While I can not see it. I checked that all my gizmos are enabled.

How can I enable the arc?

sentences:
Bounce off of objects How do I make my ball bounce off objects on the screen? I'm having trouble detecting the collision, as well as calculating the response.

The picture below is a good example of how the program should be working once the ball runs into an obstacle

I made the ball bounce off the walls, but what's left is making it also bounce off of objects. Thanks for the help!

Here's the source code:

public class 2DGAME extends Application {

    public static Circle circle;
    public static Pane canvas;
    private long counter = 0;
    double X = 0;
    double Y = 0;

    @Override
    public void start(Stage primaryStage) {

        canvas = new Pane();
        Scene scene = new Scene(canvas, 800, 600);

        primaryStage.setTitle("2D Ball Game");
        primaryStage.setScene(scene);
        primaryStage.show();

        circle = new Circle(20, Color.BLUE);
        circle.relocate(100, 100);

        final Rectangle r = new Rectangle(20, 20, Color.DARKMAGENTA);
        r.setLayoutX(400);
        r.setLayoutY(300);

        canvas.getChildren().addAll(circle);
        canvas.getChildren().addAll(r);

        Timeline loop = new Timeline(new KeyFrame(Duration.millis(5), new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent t) {
                if (counter++ % 5 == 0) {
                    // Moves the ball depending on the values of X and Y
                    circle.setLayoutX(circle.getLayoutX() + X);
                    circle.setLayoutY(circle.getLayoutY() + Y);

//Code to bounce off walls
                    final Bounds bounds = canvas.getBoundsInLocal();
                    boolean leftWall = circle.getLayoutX() <= (bounds.getMinX() + circle.getRadius());
                    boolean topWall = circle.getLayoutY() <= (bounds.getMinY() + circle.getRadius());
                    boolean rightWall = circle.getLayoutX() >= (bounds.getMaxX() - circle.getRadius());
                    boolean bottomWall = circle.getLayoutY() >= (bounds.getMaxY() - circle.getRadius());

   //Bugged and not sure how to make it work
                    final Bounds rectangleBounds = r.getLayoutBounds();
                    boolean rectangle_left = circle.getLayoutX() <= (rectangleBounds.getMinX() + circle.getRadius());
                    boolean rectangle_right = circle.getLayoutX() >= (rectangleBounds.getMaxX() - circle.getRadius());

   //If the bottom or top wall has been touched, the ball reverses direction.
                    if (bottomWall || topWall) {

                        Y = Y * -1;
                    }
    // If the left or right wall has been touched, the ball reverses direction.
                    if (leftWall || rightWall) {
                        X = X * -1;
                    }

    //Bugged code for boucning off obstacle object
                    if (rectangle_left || rectangle_right) {
                       // X = X * - 1;
                    }

                }
            }

        }));

        loop.setCycleCount(Timeline.INDEFINITE);
        loop.play();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

sentences:
Why doesn't RGB565 lead to a smaller memory footprint on Android? I'm using LibGDX for my game. I'm loading 9 bitmaps into memory at once using the AssetManager, about 512x512 pixels each on average.

TextureParameter texParam = new TextureParameter();
texParam.format = Format.RGBA8888;

assetManager.load("islands/island_0.png", Texture.class, texParam);
assetManager.load("islands/island_1.png", Texture.class, texParam);
assetManager.load("islands/island_2.png", Texture.class, texParam);
assetManager.load("islands/island_3.png", Texture.class, texParam);
assetManager.load("islands/island_4.png", Texture.class, texParam);
assetManager.load("islands/island_5.png", Texture.class, texParam);
assetManager.load("islands/island_6.png", Texture.class, texParam);
assetManager.load("islands/island_7.png", Texture.class, texParam);
assetManager.load("islands/island_8.png", Texture.class, texParam);

However, if I switch the format to Format.RGB565, then run the Heap allocation tracker in the DDMS view of Eclipse, I see absolutely no change in the memory allocated. The bitmaps being drawn on the screen though are being rendered differently (without an alpha channel when I use RGB565).

Am I missing something? Why aren't the bitmaps using less memory?

sentences:
How to get Components in ECS I´m currently trying to develop a Game, which uses Component based Entities.
The problem I`m facing right now is how to mask my Components and retrieve them from the Entities.
At the Moment i use a enumeration which has ab entry for each Component. Entities define then masks based on which Components they have associated. When I query for a Component i pass the correspoding enumeration value.

Here is a basic example to show how my Code works:

class Component
{
    public:
        enum Type
        {
            A       = (1u << 0),
            B       = (1u << 1)
        };
        virtual TypeBit() = 0;
};

class Entity
{
    public:
        shared_ptr<Component> GetComponent(Component::Type type);
        unsigned int TypeMask();
    private:
        std::list<shared_ptr<Component>> _components;
}

What I like i my approach is the simplicity of the Bitmasks with logic operations, i.e. to see if a System is interested in an Entity.
The problem I have is, that, everytime when I add a new Component I have to add a new enumeration value. This adds potential for errors which is why I would prefer a more generic solution.

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:
How do you deal with transparent fonts that you want to be white? I'm a bit of a total amateur, but I thought I would learn how to make a simple game during quarantine.
However, I stumbled into a problem with fonts. I'm thinking about using the free font "Pixelmania" to show a score at the top of the screen. But the font is transparent! How do I make the inner part of the font white? Do I have to manually edit the font file myself? Or is there an easier way?

sentences:
Graphics not being displayed on OUYA I hope its not too early to be asking OUYA dev questions, but I just got my dev kit and I want to get my game running ASAP! I am using LibGDX as my framework for my game and launching the Android backend on the OUYA. Everything seems fine except that none of my graphics are being displayed! I can only tell what's going on because of Box2D's DebugDraw showing my physics. I am using LibGdx's Spritebatch and OpenGL ES 2.0. Everything is working pefectly on my desktop and Android (phone) backends.

Am I doing something wrong with handling my resources for OUYA? What could be the problem? Could this be because I store my graphics in the assets folder instead of /res?

Edit: Here's a logcat output: http://pastebin.com/BbPyPCcR

sentences:
How can I make Unity run fast when it's not focused? I'm using Unity3D.  I have an automated test suite that takes 1-2 minutes to run.  When Unity has focus, these tests seem to run at least 2x as fast as when Unity is in the background.  But, it's very boring to stare at a progress bar for 1-2 minutes while I wait for the tests to complete.  The whole reason I want to put it in the background is so I can do something else while these tests are running, but because it slows down the tests to 2-4 minutes, doing so makes me even less efficient.

Is there a way to have Unity run as fast as it does when it's focused, even when it's not focused?

This could be a Windows 10 question more than a Unity question.  Maybe there's a way to set the Unity process as "high priority" or something.

sentences:
How minecraft manages interactable blocks (Chest)? I am wondering, how does minecraft handle blocks like chest?

I guess normal blocks are ids in simple array, but how does it store and references blocks with special behaviour?

sentences:
Rotate object against Gyroscope in Unity I would like to rotate a simple object against the z-rotation of the gyroscope of a smartphone, so that the object will always "look" to the physical floor where the user is standing. After that, I would like to translate that object forward. It should give you the feeling, that the object is attracted by the "real world" gravity.

Here's a small bad sketch I just made for better understanding:

I have already tried different examples I found on the web, but they were all kinda too complex for my purpose (they were all about rotating the camera in all 3 axes).

Has anyone ever made some simple script for something like that? Thanks for your help.

EDIT:

I have already tried some things out, I found a script on the web but it turned out to be "unprecise". I created a cube and attached the script to it, but when you rotate your phone by 180 degrees a few times, you will notice an "offset".

Here's the script:

public var gyroSensitivity : float = 50.0;
private var z : float;

function Update() {

    GyroRotation();

    //Move the object
    transform.Translate(0,-.03f,0);
}

function GyroRotation(){
    //get values from the gyroscope
    z = Input.gyro.rotationRateUnbiased.z;
    RotateZee(z);
}

function RotateZee(axis : float){
    transform.RotateAround(transform.position, new Vector3(0,0,1), -axis * Time.deltaTime * gyroSensitivity);
}

I'm pretty sure it has something to do with the gyroSensitivity, but I need to multiply the value with something or it will rotate only a few degrees.

sentences:
What to replicate in a PvP online action game? We're developing a 2D PvP online action game. You can think of it like Super Smash Bros. We have a function call tree for characters like below:

CharacterInput.Update()
|-- CharacterController.StartJump()
    |-- CharacterMovement.TranslateState( "Jump" )
        |-- CharacterJumpState.OnEnter()
            |-- CustomRigidbody2D.Move( delta )

I think the pseudo-code above is kinda straight forward. It's a typical Controller-Movement structure where the Movement part is made using several character states. Also, the Movement part is responsible for animations, physics, visual effects and sound effects.

So, to make this networked, we need to replicate some values over the network.

To make it clear, we're using Photon Bolt for Unity, which provide a ExecuteCommand way to deal with server authority and client prediction. You can check it out here.

So in terms of replication, we realized that according to the structure, we should decide which part to replicate. According to the call tree above, we can split our character logic into these layers:

Input Layer: LeftStick, RightStick, A, B, X, Y, ...
Controller Layer: MovementDirection, ShootDirection, IsJump, IsShoot, IsMelee, ...
Movement Layer: CurrentState and all of its member variables
Rigidbody, Animation Layer: Velocity, GravityScale, CurrentAnimationState

Theoretically, replicate any of these layers can make it work because the process of higher layer to lower layer is deterministic. Once the higher layer is replicated, lower layers should be the same across the network.

Sadly, this is just theory. In reality, you must deal with lag, and unreliable packet delivery.

For example, if you only replicate the inputs, an unstable network may make it out of sync because state A may transit itself to state B if animation ends, but actually it should be transitted to state C if player presses some button.

However, if you only replicate rigidbody and animation, all the visual effect or audio effect triggered by CharacterState can't work, because CharacterMovement
doesn't even know which state it is in...

So, my question is, how do other games replicate their character? Especially in a PvP game?

sentences:
Path following with turning radius and obstacle avoidance I would like to move an object through a path found by A* star but taking into account the object's turn radius and movement speed, while also avoiding possible obstacles during a curve. After some research, I found this article in gamasutra about realistic turns and this question. If I understood correctly, to add smooth turns I just need to create a circle in either the left side of the object or the right (depending on which direction it will rotate) and then move the object along that circle until it reach the point in which it can move straight to the goal. I implemented the code from the article, however I couldn't get it working

The tank is the object I want to move and the boxes are obstacles;
The red Xs are the "waypoints" and the blue line is the line segment
between those points;
The white circle is the tank's turning radius;
The green line is the actual movement the tank would perform taking
its turning radius and movement speed into account;
And the pink
dotted circle represents the "point to leave the circle and start on
the straight line" that I've got with the algorithm;

The first problem is that I'm not sure how to calculate the right place for the pink circle. If I understood correctly, it should be positioned between the end of the green line's curve and the start of the straight one.
The second problem is that, once solved the first, I don't know how to actually move the tank through the "circular" path, while in straight path I could simply take the direction between the current point and the next, and move along that.
Here's my implementation in gdscript
extends Node2D

var speed = 80
var rotation_speed = 1

var goal = null
var velocity = Vector2()

func _ready():
    goal = get_parent().get_node("Goal").global_position

func _physics_process(delta):
    if goal == null:
        return

    var pos = global_position
    var circle_radius = speed / rotation_speed

    var angle_to_circle_center = rotation + PI/2 #rotation - PI/2
    var circle_pos = pos
    circle_pos.x += circle_radius * cos(angle_to_circle_center)
    circle_pos.y += circle_radius * sin(angle_to_circle_center)

    var dx = goal.x - circle_pos.x
    var dy = goal.y - circle_pos.y
    var h = sqrt(dx*dx + dy*dy)
    var r = circle_radius

    if h < r:
        return

    var d = sqrt(h*h - r*r)
    var theta = acos(r / h)

    var phi = atan(dy / dx)
    var Q = Vector2()
    Q.x = circle_pos.x + r * cos(phi + theta)
    Q.y = circle_pos.y + r * sin(phi + theta)

    get_parent().get_node("icon").global_position = Q

Any insight would be appreciated - thanks in advance!

sentences:
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: 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 to find the nearest object from another, in a non tile based game where obstacles are present? The nearest object means the path from the initial position to this object is shorter than the path from initial position to any other object. The path is the smallest number of pixels this object must move to reach the target object while making sure that it does not collide with any obstacle.

Like in this example below, consider that object A has to determine which object is closer, object B or object C. The pink rectangle is an obstacle. Now if we consider the euclidean distance, object B will be closer but due to the presence of an obstacle euclidean distance will give false answers.

Another solution would be to find the distance using some pathfinding algorithm (like A*), which will give the correct solution, but will be slower than simply calculating euclidean distance.

The ideal solution should give the answer as an object the path to which is no more than 10% larger than to the nearest object. And it should take no more than 10 millisecond on a modestly powered computer to find the nearest object for 1000 different objects on a map that has upto 1000 obstacles of different sizes and the map is no larger than 1000*1000 pixels (like in the image above the nearest object for A is C, for B it is A and for C it is A). Also it should not take more than 50 MB of RAM (excluding the size of RAM used to store the coordinates of objects and obstacles and their sizes).

And the map is dynamic. The solution need not return the path between the objects, it need to only find the nearest object.

What will be the ideal solution of this problem?

sentences:
Path finding between multiple maps I'm interested in path finding between multiple maps - could be indoor/outdoor maps, different levels in a building etc but the main restraint is that there are one (or more) ingress/egress points between the different maps.  I've looked and couldn't find any good solutions, yet I'm aware of several games which use similar systems.

I've found this paper - Hierarchical Shortest Path Finding Applied to Route-Planning for Wheelchair Users which seems to address a similar issue, but it is purely theoretical.

Anyone done similar with some experience they could share, or some tips?

sentences:
Input management techniques in large games Is there a standard technique for managing input in large games. Currently, in my project, all input handling is done in the game loop, like so:

while(SDL_PollEvent(&event)){
            switch(event.type){
                case SDL_QUIT:
                    exit = 1;
                    break;
                case SDL_KEYDOWN:
                    switch(event.key.keysym.sym){
                        case SDLK_c:
                            //do stuff
                            break;
                    }
                    break;
                case SDL_MOUSEBUTTONDOWN:
                    switch(event.button.button){
                        case SDL_BUTTON_MIDDLE:
                                //do stuff
                                break;
                            }
                    }
                    break;
            }

(I am using SDL, but I expect the main practice applies libraries and frameworks as well). For a large project this doesn't seem the best solution. I may have several objects all  wanting to know what the user has pressed, so it would make more sense for those objects to handle input. However, they can't all be handling input, as after one gets an event, it will be pushed off the event buffer, so another object won't receive that input. What method is most commonly used to counteract this?

sentences:
Unity3d - move 3d object in an AR scene I have an AR scene that has one AR camera, an image target and a 3D object as below.

I want to move the AR object to the position of the mouse click. I have tried taking the Input.mouseposition (screen position), converting it using ScreenToWorldPosition and moving the 3D object to this position. The object is moved, but not to the mouse click position.

How can I move the object to the position of the mouse click? My code is as follows:

Camera cam;
Vector3 target = new Vector3(0.0f, 10f,0.5f);
// Use this for initialization
void Start () {
if (cam == null)
    cam = Camera.main;
}
void Update()
{
    if (Input.GetMouseButtonDown(0)) {
        Debug.Log("MouseDown");

        Vector3 mousePos = Input.mousePosition;
        mousePos = cam.ScreenToWorldPoint(mousePos);
        GameObject.Find("Car1").gameObject.transform.position = mousePos;
    }
}

EDIT 1

To move 3d object with mouse, I tried this code. But it don't move the position of mouse click.
enter link description here

EDIT 2

If I add a plane to scene, I can move to the position of mouse click only on the plane. The code is taken from here. But the plane prevents to show AR camera view. The screenshot is below:

EDIT 3

I add box collider and rigidbody to 3d object. Screenshot is below :

I used below code :

if (Input.GetMouseButtonDown(0)) {
            Debug.Log("mouseDown = " + Input.mousePosition.x + " " + Input.mousePosition.y + " " + Input.mousePosition.z);

        RaycastHit hit;
        var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit))
        {
            if (hit.rigidbody != null)
                GameObject.Find("Car1").gameObject.transform.position = hit.point;
            else
                Debug.Log("Rigidbody is null");
        }

When mouse clicked, 3d object isn't moved the position of mouse click.

sentences: Is there any JavaScript game library good for mobile gaming? I do not know how should I ask this question. I am a very new in this field. I want to learn game development. I want to learn it for Android and iPhone game development. That's why i was looking for JavaScript game engine or libraries. But, I got many. I do not know which one will good for me for 2D or 3D JavaScript game development.

sentences:
Pile of objects & collisions I’m designing something which has a rather large number of 3d roundish objects and needs collision detection, in the best way I can muster. The user can move her fingers through the pile of objects and they need to move away. The objects are all a little different, though.
I would love to know the various ways on how I can reduce this problem from typical O(n^n) nightmare.
Obviously I can reduce the non-visible geometry, and I’m suspecting a lot of simplification will be possible with applied graph theory.. I also play with the idea of having one or multiple meshes that represent the surfaces on which these round objects cling, and then only deforming these. But some effects may be hard to simulate that way.
But I am a little lost in getting a good footing to start. Can anyone point me to good resources or known algorithms/hacks? I’m not averse to using known engines (bullet/unity etc) but I want to have a specialised solution, not a generic one.

sentences:
how to calculate resulting velocity and angular velocity rocket has on center of mass The issue i am having is that i can't seem to figure out how to apply force from a rocket to a bodies center of mass.

*Edit
This is in 2D

e.g.
Let's call the body 'ship'

the 'ship' is 1000 (relative unit) and the center of mass is normalized at [0,0] (origin)

the 'ship' has two rockets (lets say for thrust vectoring), one at [-2,-4] (left) and one at [2,-4] (right) relative to the center of mass, and that both had nozzles pointed down (90 degree angle counterclockwise from x)

if the left rocket were to fire at say 500 (relative unit), what formula could i use to find the resulting force and angular force on the center of mass?

if it helps, the language is a superset of javascript (custom preparser similar to typescript), and i'm using a custom physics engine that only accepts force on center of mass as an array e.g. [force x, force y, force angular]. I tried to recycle my collision detection algorithm but it was like jamming a square into a circle shaped hole.

I've searched since last night and can't seem to find a formula to do this (atleast not one I can understand, I can't understand complex math notations).

Any and all help is greatly appreciated.

TL;DR
I need a formula that gives the resulting force and angular force from a offset rocket on center of mass where the result looks like:

[force x , force y , force angular]

the center of mass is normalized to origin,

and takes the variables:
rocket offset ([x,y]),
rocket angle (in degrees to center of mass),
force of rocket (in relative units)

sentences:
How to get one KinematicBody2D to push another? I am working in Godot 3, where my player is a KinematicBody2D. When I collide with a block which is also a KinematicBody2D I'd like my player to push it without losing velocity.

My block is in a group called moveables, has no script, and has no other forces acting on it.

After I calculate the velocity of my player in _physics_process(), I have the following code.

# update position and handle collision

var collision = move_and_collide(vel * delta)
if collision:
    var collider = collision.collider
    var normal = collision.normal
    var remainder = collision.remainder
    var collision_angle = rad2deg(acos(normal.dot(Vector2(0,-1))))

    # floors
    if collision_angle == 0:

        # reset y vel so it doesn't keep accumulating
        vel.y = 0

        var horizontal_movement = Vector2(remainder.x, 0)
        move_and_collide(horizontal_movement)

    # moveables
    elif collision_angle == 90:
        if collider in get_tree().get_nodes_in_group("moveables"):
                collider.move_and_collide(remainder) # move block by remainder
                move_and_collide(remainder) # move player by remainder

This code does allow the player to push the block, but only slowly. I can't figure out why. Ideally, the player would push the block without losing any velocity.

Even if I directly update only the horizontal position of my block, it still moves slower than expected, and my player sprite is blurred, presumably because of collision corrections.

        if collider in get_tree().get_nodes_in_group("moveables"):
            collider.global_position.x += remainder.x
            move_and_collide(remainder)

The problem seems to be that when I move the player by the remainder, the player is still colliding with the block, even though I move the block itself in the previous line. This is confirmed by analyzing the collision object move_and_collide(remainder).

What's wrong and how can I achieve the desired movement?

I asked a variant of this question on a Godot forum, but am also asking it here for increased visibility.

sentences:
Should the HUD be Entites in a ECS ? And how to handle Events if so? I'm building a GameEngine using Ashley and some how I can't figure out how.

I through I could use something like this. Or use the Signal/Listener from Ashley.
But how to Implement a interactive HUD? This is my current idea:

I have a System that only polls for inputs. If it detects an Input it would be a MouseClick so the PollySystem is sending out a MouseClickEvent witch the Coords. And a HUDClickedSystem will catch this event and checks if the click was inside a HUD Boundary and will Tag it with a clickedCompoment or not.
A Third system will look out for all entities with a clickedComponent and will react something like Respawn button clicked -> Respawn, Pause button clicked -> Pause etc.

This is a mix from the ideas here and here

I would love to have something like the Command pattern / Intent System  because I think it easy and straight forward but I can't figure out how to handle more than a flag ( Key pressed / Mouse pressed ).
But for this I need to know where the Mouse is pressed.

sentences:
How can I achieve a flickering torch/candle effect in 2D? I'm currently working on a 2D lighting system that has point lights effectively rendered as a quad in a top-down 2D view, something like this for each light:

I'd like to achieve a somewhat realistic "flickering" effect by changing the position and attenuation of the light over time, simulating the light emitted from a torch or candle. What would be a good way to adjust these attributes of the light, and how quickly / over how much time?

sentences:
How do I scale and rotate around different points in Libgdx? I'm using a SpriteBatcher to rotate and scale a TextureRegion in libGDX. I'd like to rotate the texture around an origin outside of the region, but have the texture scaled around the region's center.

As far as I'm aware, this has to be performed in one action in the SpriteBatcher.draw() method. The region is scaled to the correct size, but scaled away from the origin.

I could compensate by adjusting the origin location, but is there a better method?

sentences:
Getting Started with 2d Game Dev (C++): DirectX or OpenGL? So, i'm a student looking to get my foot in the door of game development and im looking to do something 2D, maybe a tetris/space invaders/something-with-a-little-mouse-interaction clone.

I pointed my searches in the direction of C++ and 2d and was eventually lead to DirectX/OpenGL

Now as i understand it, all these packages will do for me is draw stuff on a screen. And thats all i really care about at this point. Sound isn't necessary. Input can be handled with stdlib probably.

So, for a beginner trying to create a basic game in C++, would you recommend DirectX or OpenGL? Why? What are some key feature differences between the two? Which is more usable?

sentences:
In OpenGL Shader, Why adding color change vertex position? I have the following vertex shader:

#version 120

attribute vec4 position;
attribute vec4 acolor;

varying vec4 theColor;

void main(){
    gl_Position = position;
    //theColor = acolor;  //[1]
    theColor = vec4(1.0,0.0,0.0,1.0); //[2]
}

When I use line [1], the color is transmitted rigth to the fragment shader, but when I change the color to the attribute acolor (using the line [2]) the positions of the triangles appear wrong. From the data of the main program, it seems to me like the positions get the color values.

I put two images, 1 with the rigth vertex positions and  2 with the wrong vertex positions.

UPDATE: render code on Github

sentences:
Render an infinite plane I wish to be able to render any Plane (Defined by a Normal and a distance from the origin).

The closest answer state to use 'Direction' (4D vectors with w = 0) with the Lengyel infinite matrix, but unfortunately it does not render anything with my implementation:

const float FOV = glm::radians(55.0f);
const float e   = 1.0f / std::tan(FOV / 2.0f);
const float a   = height / width;
const float n   = 0.1f;

this->projection = glm::mat4{
  e, 0, 0, 0,
  0, e / a, 0, 0,
  0, 0, -1.0f, -2.0f * n,
  0, 0, -1, 0
};

std::vector<Vertex> vertices =
  {
   Vertex{glm::vec4( 0.0f,  0.0f,  0.0f, 1.0f), Vector::Up()},
   Vertex{glm::vec4( 1.0f,  0.0f,  0.0f, 0.0f), Vector::Up()},
   Vertex{glm::vec4( 0.0f,  1.0f,  0.0f, 0.0f), Vector::Up()},
   Vertex{glm::vec4(-1.0f,  0.0f,  0.0f, 0.0f), Vector::Up()},
   Vertex{glm::vec4( 0.0f, -1.0f,  0.0f, 0.0f), Vector::Up()}
  };

std::vector<GLuint> indices = {0, 1, 2,   0, 2, 3,   0, 3, 4,   0, 4, 1};
// Render by indices
...

sentences:
Where can I find 3d models of equipment for supermarket? Where can I find 3d models of equipment  for supermarket? I will use them in XNA.

UPD. I need equipment like this http://www.the3dstudio.com/product_details.aspx?id_product=419747 without products.

sentences:
How to make a gui button follow a path after a touch? I would like a button in my gui menu to follow a specific path if we selected it, I am wondering how I could do it: if we touch the button, then it can only move on the specific path, it is an arc such as this path :

Would you know how to achieve this?
I am using Unity, but I think the theory should be the same for other software/language ?

Thanks for your help

__

EDIT:

here is the code for the bezier curve in unity : Where should I put the script?

using UnityEngine;
using System.Collections;

public class DrawBezierHandle extends Editor {

    public Transform startT;
    public Transform endT;

    function Start(){
        startT = GameObject.Find("start").GetComponent("Transform") as Transform;
        endT = GameObject.Find("end").GetComponent("Transform") as Transform;
    }

    function OnSceneGUI() {

        var width : float = HandleUtility.GetHandleSize(Vector3.zero) * 0.1;
        Handles.DrawBezier(startT.position,
                        endT.position,
                        startT.position * 5 * Vector.up,
                        endT.position * 5 * Vector.up,
                        Color.red,
                        null,
                        width);
    }
}

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:
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:
Alpha blending sometimes gives the wrong color? I've got a method for alpha blending:

public static int alphaBlend(int c1, int c2) {
        int a1 = (c1 & 0xff000000) >>> 24;

        int r1 = (c1 & 0x00ff0000) >> 16;
        int r2 = (c2 & 0x00ff0000) >> 16;

        int g1 = (c1 & 0x0000ff00) >> 8;
        int g2 = (c2 & 0x0000ff00) >> 8;

        int b1 = (c1 & 0x000000ff);
        int b2 = (c2 & 0x000000ff);

        float src_alpha = ((float)a1) / 255.0f;

        int red   = (int) ((r1 * src_alpha) + (r2 * (1.0f - src_alpha)));
        int green = (int) ((g1 * src_alpha) + (g2 * (1.0f - src_alpha)));
        int blue  = (int) ((b1 * src_alpha) + (b2 * (1.0f - src_alpha)));

        return (a1 << 24) | (red << 16) | (green << 8) | blue;
    }

But sometimes this gives the wrong color (I guess because I don't use the second color's alpha). Could anyone explain how to fix this?

sentences:
How do 3D games create the illusion of depth? How do libraries like OpenGL convert three dimensional coordinates into the two dimensional pixels we see on our screens? I'm not talking about the 3DS or games that require 3D glasses, but rather the illusion of three dimensions.

I don't need any code to create this effect - I'm just curious about the concept.

sentences:
Pathfinding in Procedural cave generation I'm learning THIS tutorial about procedural cave generation using cellular automata with Unity.

I want to implement pathfinding on some enemies, so I need to make a quantization of the procedurally generated "non-wall" part of the map. Is there a best way to place nodes in this space?

I hope I was clear enough and I'm sorry if not.

sentences:
XNA advanced rotation 3D I'm able to rotate any model with any angle I want, where I can not rotate my model around a given point.

e.g: My model rotates from the origin assigned in its .fpx file. I want it to rotate related to a point of its bottom plane, so that it is animated as falling

sentences:
How OpenGL works with Windows GDI in order to produce output image on computer screen? I am curious how GDI integrates with OpengGL in order to create image for computer screen.

I know that GDI provide Device Context which describes window properties and as far as I know it also offer 2D software based rendering.

Then based on Device Context, Rendering Context is created for OpenGL.

During rendering OpenGL maintain framebuffer objects which are stored in GPU memory and those buffers are then pushed to the screen somehow? However what is the role in GDI in this process? I know that GDI is responsible for transferring image to the graphics devices... So does it mean that framebuffer contents are transferred to CPU RAM and then again to GPU in order to transfer it to display?! It doesn't sound logic...

Why such a software based drawing component (GDI) is used with OpenGL which should be able to send image straight from framebuffer (GPU memory) to display? I can't understand that...

How Windows UI is rendered? Desktop, folders, Start Menu etc. it is software based or gpu based rendering?

sentences:
Blood splatters on a terrain I am trying to create blood effects, where the characters being killed are on an uneven terrain. The simple way is to instantiate a prefab with texture, which uses a plane mesh, on the raycast hit point. But, in this case, this looks quite odd as the terrain has height variance within the bounds of the plane of the blood splatter prefab.

I tried using the projector in Unity, but the issue with using that is that the projector shaders are very simple. In particular, I don't want them to blend into the terrain texture, and wanted to add specularity (to make it look like a liquid).

What is my best option?

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:
Longest path algorithm for roguelike maze generation I have a simple grid-based map composed of rooms, like this (A=entrance, B=exit):

   0 1 2 3
  #########
0 #B# #####
  #########
1 #   ### #
  #########
2 # #     #
  # #     #
3 # #     #
  #########
4 # ###   #
  #########
5 ###A    #
  ###     #
6 ###     #
  #########

And I'm stuck trying to make a suitable algorithm to create a path of doors between the rooms, in such a way that the player has to explore most of the map before finding the exit.

In other words, I'm trying to find the longest possible path from A to B.

(I'm aware that this problem can be solved for acyclic graphs; however, in this case there can be cycles.)

EDIT: Another example where rooms are connected using floodfill, and the exit is chosen as the farthest room from the entrance:

   0 1 2 3
  #########
0 #B#     #
  # #-#####
1 # | #   #
  ### #   #
2 ### #   #
  ###-#-###
3 #   | ###
  #-#######
4 #A|     #
  # #     #
5 # #     #
  # #     #
6 # #     #
  #########

Note that the path to the exit is not the longest possible path at all.

sentences: 2D Polygon Line Clipping So I need to clip polygons against polygons where one of it is behind the other. But just drawing it is for my desired hardware just too slow. My polygons only have four lines so what can I do?

sentences:
Turning On/Off Vsync no longer working when rendering to an offscreen buffer I have this reaallly strange issue that as soon as I render to an offscreen framebuffer I am no longer able to toggle VSync while my application is running. I am using OpenTK as the opengl wrapper, but I have a strong feeling it's not related at all to OpenTK.

The odd thing is I can still turn VSync on/off during startup of the application, but not anymore while the game is running. If I temporarily redirect rendering to the default framebuffer i can also again toggle Vsync.

I can use an ugly hack to just redirect rendering to the default framebuffer, a frame later set toggle vsync mode, then redirect rendering to the offscreen framebuffer again, however I would much prefer a proper fix.

Here's some pesudo code what my code does:

Initialize 2 Framebuffers. Bind first offscreen framebuffer.
while(!exit) {
    Render opaque stuff
    Switch to second framebuffer for transparent objects
    Render transparent stuff
    Switch to first buffer
    Render transparent texture to primary buffer
    Switch to default framebuffer (default FB in write mode, first FB in readmode)
    Blit from first to default framebuffer
    Bind first offscreen FB
}

I had to use offscreen frame buffers in order to re-use the depth buffer in the transparent render pass for implementing WOIT (Weighted Blended Order Independent Transparency)

sentences: Unity - are particles rendered and calculated when off-screen? I have a scene where I have a lot of instances of the same particle system. As the game will go for mobile, I fear the particles are calculated even when they are not shown. So to cut it short, I would like to know if the particle system is being calculated and rendered even if off-screen.

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:
My timer won't work in Unity In my game, you can spawn a cube by clicking. After 10 seconds I want the cube to disappear. That's what I'm trying to do in my code but it won't work:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class circleThing : MonoBehaviour
{
    public GameObject circle;
    public GameObject block;
    public float time;
    void Start() {
         Vector3 temp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         temp.z = 5f;
         transform.position = temp;
         if (Input.GetMouseButtonDown(0)) {
             StartCoroutine(timer());
             Instantiate(block, temp, Quaternion.identity);
         }
         if (time >= 10) {
             Destroy(block);
         }
    }
    void Update()
    {

    }
     IEnumerator timer(){

        while (true)
        {
            Debug.Log(time);
            yield return new WaitForSeconds(1);
            time++;
        }
    }
}

What am I doing wrong? I get the error: Destroying assets is not permitted to avoid data loss.

sentences:
How do I load graphical resources asynchronously? Let's think platform-agnostic: I want to load some graphical resources while the rest of the game is running.

In principle, I can load the actual files on a separate thread, or using async I/O. But with graphical objects, I will have to upload them to the GPU, and that can (usually) only be done on the main thread.

I can change my game loop to look something like this:

while true do
    update()
    for each pending resource do
        load resource to gpu
    end
    draw()
end

while having a separate thread load resources from disk to RAM.

However, if there are many big resources to load, this could cause me to miss a frame deadline and eventually get dropped frames. So I can change the loop to this:

while true do
    update()
    if there are pending resources then
        load one resource to gpu
        remove that resource from the pending list
    end
    draw()
end

Effectively loading only one resource per frame. However, if there are many small resources to load, loading all of them will take many frames, and there will be a lot of wasted time.

Optimally, I would like to time my loading in the following manner:

while true do
    time_start = get_time()
    update()
    while there are pending resources then
        current_time = get_time()
        if (current_time - time_start) + time_to_load(resource) >= 1/60 then
            break
        load one resource to gpu
        remove that resource from the pending list
    end
    draw()
end

This way, I would only load a resource if I can do it within the time I have for that frame. Unfortunately, this requires a way to estimate the amount of time it takes to load a given resource, and as far as I know, there are usually no ways to do this.

What am I missing here? How do many games get to load all their stuff completely asynchronous and without dropped frames or extremely long loading times?

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:
The distance to a line from a point, find the constant values? I have 3 points, (x1, y1), (x2, y2), (x3, y3)

I should find the AH height. For this i must use:

How can i find each "a", "b" and "c" values?

sentences:
How big a transition from programmer to modeler/level designer/creator So I think I may take a break from the programming side, I have put in 6 hard months learning C++ and graphics theory, I have learned a huge amount but over the last few days have been studying level design and modeling and think that is maybe more suitable to me.

So how would programming compare in a learning curve sense, C++ takes a while to grasp the core language never mind writing 100,000s lines of game engine code which you would eventually have to do.

Without being arrogant the modeling/level creation side seems a much faster progression, is that a fair thing to say?

sentences:
How to use assimp textures with openGL/getting a better understanding I recently learned how to load a model to openGL using assimp, but I am having trouble figuring out how to do lighting calculations on this model. Previously with my own created objects I would set the normals manually and pass them to the shader as attributes. Then I would use one diffuse and one specular texture passed as uniforms for lighting.

I'm trying to do the same with a model, but I can't seem to get it to behave correctly. When I use my own objects everything works normally, but when I try to draw the model some weird lighting occurs.

Here's how the model should look:

But mine looks like this:

What confuses me in particular is that assimp loads both normal vertices and normal textures. I'm not sure what the difference between them is or if there is more about model loading that I've yet to learn, which is entirely possible since I don't know much about heightmaps and other things yet.

Anyway, here's what I'm doing for calculations:

void main()
{
    vec3 normal = normalize(Normal);
    vec3 viewDir = normalize(viewPos - fragPos);

    vec3 result;

    for (int j = 0; j < sizeModels; j++)
        result += CalcDirLight(DirLights, normal, viewDir, models[j]);

    FragColor = vec4(result, 1.0);
}

vec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir, Material textures)
{
    vec3 lightDir = normalize(-light.direction);
    // diffuse shading
    float diff = max(dot(normal, lightDir), 0.0);
    // specular shading
    vec3 reflectDir = reflect(-lightDir, normal);
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), textures.shininess);
    // combine results
    vec3 ambient = light.ambient * vec3(texture(textures.diffuse, Tex));
    vec3 diffuse = light.diffuse * diff * vec3(texture(textures.diffuse, Tex));
    vec3 specular = light.specular * spec * vec3(texture(textures.specular, Tex));
    return (ambient + diffuse + specular);
}

Notice that I'm providing my own diffuse values to the DirLight struct. The Material struct is what contains the diffuse and specular textures, as well as a shininess float.

For reference I am following guides from this site:
https://learnopengl.com/

Any help would be appreciated!

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:
Storing 2d map data as PNG Just a question regarding the storage of 2D map data. There are several topics discussed within gamedev, i.e. Array Storage: How to store 2D tile-map, custom map formats: A way to store potentially infinite 2D map data? etc

Considering that I intend to pre-generate my entire map at the start of the game (Much like Terraria does) and store that and then load 'chunks' of the data into an array or custom format as the player moves through it and interacts with the environment.

Been a total noob my question my be a little naive, but is there something wrong with pre-generating the map data (tile based, side view with each tile type represented as a discreet integer) as a PNG (No alpha) and saving that. Then read in the section of the PNG for the chunk to be loaded and converting the specific pixels to their integer value to determine what tile it represents ?

I could possibly even have one PNG for the terrain, one to represent containers and loot, which would be read separately and overlaid, then one for structures etc.

Then also obviously update the PNGs as terrain is created/destroyed by the player.

I can only assume this is not discussed anywhere as its probably slow versus maybe just reading/writing from/to a binary data format/array?

Regards
John

sentences:
Sudoku generation doesn't finish Heyho,

i got problems with my sudoku generator. First of all I generate some numbers between 1 and 9 and put them (according to the sudoku rules) into my game. After that I solve it using my second algorithm, but there's a problem with. It stops solving in the middle of the sudoku and says that there isn't a single solution for it, even if this sudoku has around 200 solutions.

private void generateSudoku()
{
//iSeed für den Random-Generator
iSeed = seeder.Next();
rnd = new Random(iSeed);

for(int i = 0; i < FIELDSIZE; i++)
{
    iContent[i] = 0;
    bEditable[i] = true;
}

switch(iDifficulty)
{
    case 0:  iNumbers = rnd.Next(30, 35);
        break;
    case 1:  iNumbers = rnd.Next(24, 29);
        break;
    case 2:  iNumbers = rnd.Next(18, 23);
        break;
    default: iNumbers = rnd.Next(24, 29);
        break;
}

for(int i = 0; i <= iNumbers; i++)
{
    int iValue = rnd.Next(1, 10);
    int iRow = rnd.Next(0, ROWSIZE);
    int iCol = rnd.Next(0, ROWSIZE);

    if(check(iRow, iCol, iValue) == 0)
    {
        iIndex = (ROWSIZE*iRow+iCol);
        iContent[iIndex] = iValue;
        bEditable[iIndex] = false;
    }else
    {
        i--;
    }
}

iSolutionCounter = 0;
solveSudoku(0);

Console.WriteLine("Solutions: " + iSolutionCounter);

if(iSolutionCounter != 1)
{
    //generateSudoku();
    //return;
}

for(int i = 0; i < FIELDSIZE; i++)
{
    if(bEditable[i] == true)
    {
        iSolution[i] = iContent[i];
        //iContent[i] = 0;
    }else
    {
        iSolution[i] = iContent[i];
    }
}

}

FIELDSIZE = 81;    The number of fields in complete sudoku (9x9)
ROWSIZE = 9;       The number of fields in a single row or column (9)
iNumbers           The amount of random generated startnumbers

And the solveSudoku(), which should solve the sudoku and sum up all solutions (but fails)

private bool solveSudoku(int iPos)
{
    int iCol = (iPos % ROWSIZE);
    int iRow = (int)(iPos / ROWSIZE);

    if(iPos >= FIELDSIZE)
    {
        iSolutionCounter++;
        return false;
    }

    if(iContent[iPos] >= 1)
    {
        return solveSudoku(iPos + 1);
    }
    for(int i = 1; i <= ROWSIZE; i++)
    {
        if(check(iRow, iCol, i) == 0)
        {
            iContent[iPos] = i;
            if(solveSudoku(iPos + 1))
            {
                return true;
            }
        }
    }

    return false;
}

That's what I mean (grey numbers are the ones, which are available at start, so you (or my algorithm) can't edit them:

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:
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: What kind of issues should I watch out for or avoid when using JOGL(OpenGL Java bindings)? I am completely new to OpenGL, but have a very good basic foundation in Java. I've set up Eclipse with the most recent version of JOGL recently, having found it to be, of what I as a beginner programmer, feel as very easily adaptable from the original OpenGL code. By simply using a replace all command to change the C++ native library commands from gl to gl.gl, and GL_ETC to glu.GL2_ETC, and so on and using a website with OpenGL tutorials on nehe.gamedev.net that I recently found, I was wondering if there are any huge problems or things I should avoid for instance using awt or swing as a frame or window for a viewport program. Maybe I'm trying to ask a more specific question before I even try it on my own, and that is, "Do I use windows from both languages consecutively or would it just create two windows, whilst trying to only open one window?", as they both have similar methods and objects aside from OpenGL being much more centered on 3D graphics. The reason I ask is that the 3D graphics of OpenGL usually must be built on a frame as far as I know, or linked to the main method of course like anything.

sentences:
How do I get diagonal 3d movement when two buttons are pressed? I have a model moving using root motion. Currently, it's moving in 4 directions; Forward, Backward, Right, and Left.

Now, I want to make the character move in 45 degrees. I made a chart to understand the axes. (link because I can't have anymore attatchments)

http:// orig15(.) deviantart(.)net /fa04/f/2016/354/8/3/unity_movement_chart_by_blueneonkid-das9e8a.png

(Remove the spaces and parenthesis (yeah, it's a bit Youtube 2009, but what can I do? I'm new here.)

The character has a running animation for every direction, including the diagonal directions. Here is my animator controller set up:

I started out with trying to move diagonally left, and tried out a few scripts.

Script #1 (The simplest):

public class Zcontroller : MonoBehaviour {

 private Animator myAnimator;

 // Use this for initialization
 void Start () {
     myAnimator = GetComponent<Animator>();
 }

 // Update is called once per frame
 void Update () {
     myAnimator.SetFloat ("VSpeed", Input.GetAxis ("Vertical"));
     myAnimator.SetFloat ("HSpeed", Input.GetAxis ("Horizontal"));
     myAnimator.SetFloat ("DiagSpeed", Input.GetAxis ("Vertical") + Input.GetAxis ("Horizontal"));
  }
}

Note: Here, I tried combining the axes inputs.

Script #2:

 using UnityEngine;
 using System.Collections;

 public class Zcontroller : MonoBehaviour {

     private Animator myAnimator;

     // Use this for initialization
     void Start () {
         myAnimator = GetComponent<Animator>();
     }

     // Update is called once per frame
     void Update () {
         myAnimator.SetFloat ("VSpeed", Input.GetAxis ("Vertical"));
         myAnimator.SetFloat ("HSpeed", Input.GetAxis ("Horizontal"));

         if (Input.GetAxis ("Vertical") || Input.GetAxis ("Horizontal")) {

             if ((Input.GetAxis ("Vertical") < 0f) && (Input.GetAxis ("Horizontal") > 0)) {
                 myAnimator.SetBool ("isDiagonalLeft", true);
             }

         } else {
             myAnimator.SetBool ("isDiagonalLeft", false);
         }
      }
  }

Here, I tried using a Boolean to trigger the animation

Script #3:

Results:

Script 1 did not work, and caused the character to move diagonally only when the Down Arrow key was pressed.

Script 2 also did not work, giving me the error: "Operator '||' cannot be applied to operands of type 'float' and 'float'."

Script 3 gave me some bracket errors.

What can I do to get the character to move diagonally properly?

Is there any way to combine two float values in code? If so, how?

EDIT:
I tried a solution one guy on Unity Answers suggested, which was using a 2D Freeform Directional chart.
Here's my setup for that (Link becaus I can't have any more attatchments):

http://  img04(.)deviantart(.)net/39b5/i/2016/354/9/b/zanimator_setup_2_by_blueneonkid-dasaome.png

(again, remove the spaces and parenthesis)

It still doesn't play the diagonal run animation whenever I hold two directional keys down.

I set the Diagonal Left animation to -1, 1 and the Diagonal Right animation to 1,1

(If anyone's wondering why I'm trying to achieve such an archaic way of movement, I'm trying to emulate the locomotion style of Megaman Legends 2, an Action RPG released in 2000 for the PS1.

Unlike modern Action RPGs where you can move 360 degrees, MML2 had 8 directions of movement. Kind of like Ocarina of Time.)

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:
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:
Implementing a FSM with ActionScript 2 without using classes? I have seen several references of A.I. and FSM,
but sadly I still can't understand the point of an FSM in AS2.0.
Is it a must to create a class for each state?

I have a game-project which also it has an A.I.,
the A.I. has 3 states: distanceCheck, ChaseTarget, and Hit the target.

It's an FPS game and played via mouse.

I have created the A.I. successfully, but I want to convert it to FSM method...

My first state is CheckDistanceState() and in that function I look for the nearest target and trigger the function ChaseState(), there I insert the Hit() function to destroy the enemy,

The 3 functions that I created are being called in AI_cursor.onEnterframe.

Is there any chance to implement an FSM without the need to create a class?
From what I've read before, you have to create a class. I prefer to write the code on frames in flash and I still don't understand how to have external classes.

sentences:
What makes Unity3D games look so similar? For some reason, I'm quite good at guessing whether or not a game (both 2D and 3D) is made with Unity3D. But I can't really figure out why that is.

What makes Unity3D games look similar? Is it because people use the same textures? Or is it the texture filtering? The lighting? Something else? I'd really like to know for educational purposes.

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

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

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

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

Shader code http://pastebin.com/kNBzX4xU

Screenshot http://imgur.com/54wFI

sentences:
VBO GL_STREAM_DRAW double buffer or new buffer? There is some conflicting information on the STREAM usage specifier.

Apple's documentation states you should use double buffering and update the stream buffer that is not being read by the GPU.

OpenGL's reference documentation states you should only modify the contents of the buffer once. Which implies you should create a new buffer to write data instead of reusing the existing buffer.

Is there a reason to use the more complicated double buffering technique?

sentences:
Phantom objects in ray tracing I am attempting to add volumetric shadowing to an application I am working on to test some things. For this effect I wrote the following fragment

shader:#version 450

in float visible;
in vec3 normal;//Normal to the vertex
in vec3 vertexPos;//True position of the vertex (i.e it's location in space)

in vec2 texture_coord;

out vec4 outColor;//Final color of the pixel

uniform sampler2D text;

uniform vec4 color = vec4(1);//Default color
uniform vec3 lum = vec3(80,70,0.1);//A unique light position
uniform vec3 cameraPos = vec3(0);//The position of the camera in the world
uniform vec3 cameraDir = vec3(0);

float sphereIntersection(vec3 ray, vec3 origin, vec3 center, float radius)
{

    float a = dot(ray,ray);
    float b = -2*dot(center, ray)+2*dot(ray,origin);
    float c = -2*dot(origin,center)+dot(center,center)
              -radius*radius+dot(origin,origin);

    float discriminant =b*b - 4*a*c;

    float t, t1, t2;
    if(discriminant < 0)
    {
        return -1;
    }

    else
    {
        t1=(-b-sqrt(discriminant))/(2*a);
        t2=(-b+sqrt(discriminant))/(2*a);
    }

    if(t1<0 && t2>=0)
        t1=t2;
    else if (t1>=0 && t2<0)
        t2=t1;

    return min(t1,t2);
}

void main()
{
  vec3 l = vec3(lum-vertexPos);
  if(length(l)>0)
    l = normalize(l);
  vec3 c = vec3(texture(text,abs(texture_coord)));
  vec3 n = normalize(normal);
  vec3 e = cameraPos-vertexPos;
  e = normalize(e);
  vec3 h = normalize(e+l);

  outColor = vec4(c*(vec3(0.5)+0.5*max(0,dot(n,l))) + vec3(0.1)*max(0,pow(dot(h,n), 100)), 1);

  float t = sphereIntersection(vec3(90,70,1)-vertexPos, vertexPos, vec3(80,80,3), 6);

  if(t>0.01)
  {
    outColor = vec4(t/100,0,0,0);
  }
}

The issue is as follows, in the next image there's 2 shadows:

However as you can see, there's only one sphere and only one source of light and they are both hard coded, so I do not understand where the second shadow comes from (the one that does not have the circle).

sentences:
Generating color for mesh in Texture3D or shader? In Unity, I'm trying to choose between two ways of procedurally colorizing meshes (with vertex color). The main concern here is performance, knowing that my software is already GPU bound (more specifically on the memory bandwidth side)

First option: Generate the color in the fragment shader. The advantage here is that there is no memory transfert needed. The disadvantages are that the procedural generation of a color implies a pretty complex "algorithm" with branching(ifs) and noise and I'm worried that doing this calculation for every pixel is going to be really slow.
Second option: Generate all the colors in C#, store them in a 3DTexture and read it in the shader to assign color to each pixel. The disadvantage here is that if the texture is sent to the GPU every frame, that will obviously not help with my memory bandwidth problem... It depends on a thing that I'm not sure about, is the texture stored in the GPU (if I dont change it of course), or does Unity sends it back at every frame, or for each GameObjects?

Which one would you choose?
Do you see some other thing I should take into account?

sentences: How would I write a shader that supports 2 different texture coordinates? Hi I am not very good with writing shaders. How would I make a shader that simply supports 2 texture coordinates so I can load up 2 different textures to be used at the same time but on different parts of my world? Right now I have 1 texturecoord variable setup and I load a texture through it using GraphicsDevice->SetTexture(0, &Texture); and making sure my VertexDeclaration and FVF both support that, but how can I add a second texture to this? Would I make it so that I make separate coordinates and link the coordinates to a texture? How would I write that?

sentences:
Draw 3D ellipse in monogame/xna I am programming a 3d solar system (simulator).
To describe the path of a planet I wanted to add 3D rectangles.. and draw them.
But to no surprise it decreased the frame rate extremely.
Also it does not look nice:

Do You know how to handle this problem?
Is there another way to solve this?
Didn't found anything on 3D HLSL Circle Plotting.

sentences:
How do i make a minecraft server mod? Possible Duplicate:
  Mods for Minecraft Server - how does it work?

I have made some minecraft client mods, but i've started a server a mounth ago and i want to make a mod for it, but i cant find any tutorial on the internet. How can then the other guys making those mods for minecraft server know how they are going to do? Do they try forward as i tryed or are they doing something else. I would be glad if someone could tell me how to do or find tutorials for me, couse I have tryed to find them in nearly a week of searching. But i guess im searching at the wrong spot of internet, what do i know :o

sentences:
Centering Image inside ImGui window causes bug I've tried drawing RenderTexture directly to the ImGui window and I've stumbled upon a bug. Everything is drawn correctly until I center ImGui Image inside the ImGui window.
Centered Image:

Not centered Image:

As you can see when Image is centered in the ImGui window some lines aren't showing up (they are drawn and I'm not talking about first vertical line, last horizontal etc.) but when Image is slightly off-centered RenderTexture is drawn properly. Is it a bug or am I doing something wrong?
Example source code:
#include "imgui.h"
#include "imgui-SFML.h"

#include <SFML/Graphics.hpp>

const sf::Time TIME_PER_FRAME = sf::seconds(1.0f / 60.0f);
bool isTextureLoaded = false;

void render_grid(sf::RenderTexture &renderTexture)
{
    sf::Vertex line[2];
    for (int i = 0; i <= renderTexture.getSize().y; i += 32)
    {
        line[0] = sf::Vector2f(0, i);
        line[1] = sf::Vector2f(renderTexture.getSize().x, i);
        renderTexture.draw(line, 2, sf::Lines);
    }

    for (int i = 0; i <= renderTexture.getSize().x; i += 32)
    {
        line[0] = sf::Vector2f(i, 0);
        line[1] = sf::Vector2f(i, renderTexture.getSize().y);
        renderTexture.draw(line, 2, sf::Lines);
    }
}

void process_imgui(sf::RenderWindow &window, sf::RenderTexture &renderTexture, sf::Sprite &sprite)
{
    //ImGui::SetNextWindowPos(ImVec2{ 251, 20 });
    ImGui::SetNextWindowSize(ImVec2{ static_cast<float>(window.getSize().x - 251.0f), static_cast<float>(window.getSize().y - 20.0f) });
    ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{ 0, 0 });
    ImGui::Begin("Tileset", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysHorizontalScrollbar);

    renderTexture.clear();
    renderTexture.draw(sprite);
    render_grid(renderTexture);

    //float x = (ImGui::GetWindowSize().x - static_cast<float>(renderTexture.getSize().x)) * 0.5f; //doesn't draw grid correctly
    float x = (ImGui::GetWindowSize().x - static_cast<float>(renderTexture.getSize().x)) * 0.499f; //draws grid correctly
    ImVec2 imagePosition(x, 20.0f);
    ImGui::SetCursorPos(imagePosition);
    ImGui::Image(renderTexture, ImVec2(static_cast<float>(renderTexture.getSize().x), static_cast<float>(renderTexture.getSize().y)));

    static bool saveToFile = true;
    if (saveToFile)
    {
        sf::Image image(renderTexture.getTexture().copyToImage());
        image.saveToFile("correct.png");
        saveToFile = false;
    }

    ImGui::End();
    ImGui::PopStyleVar();
}

int main(void)
{
    sf::RenderTexture renderTexture;
    sf::Texture texture;
    sf::Sprite sprite;

    sf::RenderWindow window(sf::VideoMode(1600, 900), "Test");
    window.setFramerateLimit(60);
    window.resetGLStates();

    texture.loadFromFile("test1.png");
    renderTexture.create(texture.getSize().x, texture.getSize().y);
    sprite.setTexture(texture);

    renderTexture.draw(sprite);
    render_grid(renderTexture);

    ImGui::SFML::Init(window);

    sf::Clock clock;
    sf::Time timeSinceLastUpdate = sf::Time::Zero;

    while (window.isOpen())
    {
        sf::Time elapsedTime = clock.restart();
        timeSinceLastUpdate += elapsedTime;

        while (timeSinceLastUpdate > TIME_PER_FRAME)
        {
            timeSinceLastUpdate -= TIME_PER_FRAME;

            sf::Event event;
            while (window.pollEvent(event))
            {
                ImGui::SFML::ProcessEvent(event);

                if (event.type == sf::Event::Closed)
                    window.close();
            }
        }

        ImGui::SFML::Update(window, elapsedTime);
        process_imgui(window, renderTexture, sprite);

        window.clear();
        ImGui::SFML::Render(window);
        window.display();
    }

    ImGui::SFML::Shutdown();
    return 0;
}

Example texture:

sentences:
How much slower is it to draw on "half pixels"? I've noticed that games like Diep.io are using floating decimal points for thin stroke lines on the grid. I have even tried this myself, by adding 0.5 to all of the positions for the grid lines to make the lines more thin.

I heard it from a friend that drawing on half pixels causes the GPU to do more work to smooth it out, like anti-aliasing. I am really trying to make my game look nice, by making the most smoothest lines as I can. How much slower is it really, and should I use it in an online competitive 2D game using Canvas?

sentences:
Player clips into the ground when I press the restart button The title says it all. I have a subway surfers like game prototype, where I just added a restart button that can reload the scene. However whenever I press restart the charaters gets into a slightly lower position. After a few deaths the player is clipped into the ground and cannot jump at all.
I looked up so many similar questions, all about checking colliders and rigidbodies but I personally couldn't find anything. It also has to do something with my gravity and stuff. Because I have a gravity modifier that if I set to 1, this issue never happens. The problem is, that then the player jumps around like he is on the moon.
I also tried an experiment where I started my player from the air, not from the ground. And with every single restart the player fell faster and faster eventually falling trough the ground once again. So something can be with gravity.
This is what I have in the character controller. I wasn't satisfied with my physics and I wanted it to make a bit more interesting.
I tried readding colliders, putting the same scripts on brand new objects, checking on and off rigidbody options.
void Start()
    {
        playerRb = GetComponent<Rigidbody>();
        Physics.gravity *= gravityModifier;
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 xPos = new Vector3(xRange, 0, 0);
        if (Input.GetKeyDown(KeyCode.Space) && isOnGround)
        {
            playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
            isOnGround = false;
        }

sentences:
scrolling ruining bullet physics the code below is the bullet class for my shooter game in pygame.  as you can see if you run the full game (https://github.com/hailfire006/economy_game/blob/master/shooter_game.py) the code works great to fire bullets at the cursor as long as the player isn't moving.  However, I recently added scrolling, where I change a global offsetx and offsety every time the player gets close to an edge.  These offsets are then used to draw each object in their respective draw functions.

unfortunately, my bullet physics in the bullet's init function no longer work as soon as the player scrolls and the offsets are added.  Why are the offsets messing up my math and how can I change the code to get the bullets to fire in the right direction?

class Bullet:
    def __init__(self,mouse,player):
        self.exists = True
        centerx = (player.x + player.width/2)
        centery = (player.y + player.height/2)
        self.x = centerx
        self.y = centery
        self.launch_point = (self.x,self.y)
        self.width = 20
        self.height = 20
        self.name = "bullet"
        self.speed = 5
        self.rect = None
        self.mouse = mouse
        self.dx,self.dy = self.mouse

        distance = [self.dx - self.x, self.dy - self.y]
        norm = math.sqrt(distance[0] ** 2 + distance[1] ** 2)
        direction = [distance[0] / norm, distance[1] / norm]
        self.bullet_vector = [direction[0] * self.speed, direction[1] * self.speed]

    def move(self):
        self.x += self.bullet_vector[0]
        self.y += self.bullet_vector[1]

    def draw(self):
        make_bullet_trail(self,self.launch_point)
        self.rect = pygame.Rect((self.x + offsetx,self.y + offsety),(self.width,self.height))
        pygame.draw.rect(screen,(255,0,40),self.rect)

sentences:
Server logic on client side? I am very confused by the PUN implementation of the Photon networking engine. It looks like I don't have to write a separate server so I'm very curious how this works. I have done quite some KryoNet developing and fiddled around with LidGren, these libraries require you to create a server and client.

The client sends minimum data to the server.
The server verifies this data and runs the gameplay logic from it.
The server sends back minimum data so the client can update to the current server state.

Since PUN does not allow me to write my own server how does PUN work? I believe there is a server behind PUN but if it's the clients job of verifying the data this is a vulnerability.

So whats the deal with Photon? Can a competitive game make use of PUN?

sentences:
How to make party members appear and move to begin a conversation scene? A common conversation starting trope in JRPGs, when the party is represented as a single character, is for the characters to come out of the player's position and begin talking with each other and the original character.   Essentially they appear in the player's position and then move to a nearby square either one at a time or simultaneously.  Then they start talking in classic JRPG fashion with one message box after another from one or another character.

What's the easiest way to do this in RPG Maker MV?

Is there a way to do it so the characters appear at the same time and move to their conversation positions simultaneously? Or is that not worth the trouble?

I can't find or create a tag for rpg-maker mv

sentences:
What's the best way to make a game launcher? I am a new game dev, and would like to make a launcher for my games. All my games would be in ONE launcher, and it'd be similar to the Minecraft Launcher. I wanna do it for free too.
The main reason I wanna do it is to update my games. I don't have a file server, so the files would be on Google Drive.
Thanks!

sentences: What roles are important when staffing up a mobile studio? For a new studio that will be focusing on social, mobile platform games. What are roles do we need to fill and how many of each role would be ideal?

sentences: Unity - Cube edges are jagged I am new to Unity. I have a basic setup following Brackeys tutorial. When in game mode, I see the red cube having jagged edges. I tried increasing the antialiasing in Unity to 8x but it did not work. I also tried turning on antialiasing in my Nvidia control panel. But the issue still persists.

sentences:
Help with inventory! Ok so i made this inventory script but the items are not picking up and not appearing in the inventory. Im new to c# so that is why im asking this question also ive never done an inventory before. I want the medkit to go in the medkit slot. And bandage in the bandage slot and so on. Here are my scipts.
Here is my inventory script attached to the player.
public class MedInventory : MonoBehaviour
{
    public bool[] isFull;
    public GameObject[] MedkitSlot;
    public GameObject[] BandageSlot;
    public GameObject[] CoffeeSlot;
    public GameObject[] SyringeSlot;
}

Here is the medical pickup script attached to the item pickup.
public class MedPickup : MonoBehaviour
{
    private MedInventory medInv;
    public GameObject itemButton;

    private void Start()
    {
        medInv = GameObject.FindGameObjectWithTag("Player").GetComponent<MedInventory>();
    }

    void OnTriggerStay2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            if (other.CompareTag("medkit"))
            {
                for (int i = 0; i < medInv.MedkitSlot.Length; i++)
                {
                    if (medInv.isFull[i] == false)
                    {
                        medInv.isFull[i] = true;
                        Instantiate(itemButton, medInv.MedkitSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }

            if (other.CompareTag("bandage"))
            {
                for (int i = 0; i < medInv.BandageSlot.Length; i++)
                {
                    if (medInv.isFull[i] == false)
                    {
                        medInv.isFull[i] = true;
                        Instantiate(itemButton, medInv.BandageSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }

            if (other.CompareTag("coffee"))
            {
                for (int i = 0; i < medInv.CoffeeSlot.Length; i++)
                {
                    if (medInv.isFull[i] == false)
                    {
                        medInv.isFull[i] = true;
                        Instantiate(itemButton, medInv.CoffeeSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }

            if (other.CompareTag("syringe"))
            {
                for (int i = 0; i < medInv.SyringeSlot.Length; i++)
                {
                    if (medInv.isFull[i] == false)
                    {
                        medInv.isFull[i] = true;
                        Instantiate(itemButton, medInv.SyringeSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }
        }
    }
}

Please help and thanks!

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

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

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

Thank you.

sentences:
What data to store along a vertex Is there any other recommended data I should store in the vertex buffers aside from a vertex' coordinates, normals and texture coordinates?
For example data I'd need for a feature that almost every mature game engine implements later on?

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:
Making Buildings Transparent When the Player is Behind Them I am making a 3D twin stick shooter in Unity and this is a question I need to have answered while I am still in early development. The map my player is in will have very tall buildings that will easily block the player from the view of the camera. There will be no way to change the camera angle to look behind the building so how do I make the building transparent when my player goes behind it?

Any help is appreciated. Thank you.

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:
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:
Clutter for game GUI I'm pretty new to game development, having only written a simple 3d game for a class project, but I'd like to get started on a bigger project.

I'm writing an MMORPG to run in both the browser (WebGL) and natively (OpenGL ES 2). In choosing a GUI toolkit, I'm trying to find a style that work work natively and would be simple to emulate in WebGL.

I am considering using D or Go for writing my game, so interfacing with C++ libraries will be difficult, if not impossible. Of course, the language isn't the end goal here, so if using C++ will save considerable time, I'll bite the bullet and use that.

In order to reduce the amount of code I'll have to write for the browser, I'm considering using something simple like Clutter for basic abstractions, which I think will be pretty easy to emulate (layered canvases maybe?).

Does anyone have experience using Clutter for a 3d game?

Note:

I haven't used any game development libraries, and I only have limited experience with GUI libraries. I do have HTML+CSS experience, so maybe librocket is a viable solution?

Edit:

I'm also trying to be cross platform, so Linux/Mac/Windows.

sentences: Game state from Web to iPhone version? I'm currently in the planning stages for an Web and iPhone game. I'm developing it with Adobe AS3/Air. I was wondering if it's possible for people to be able to play the Web version, save their state of play and then pickup again where they left of on the iPhone version? (and visa versa) how that would be achieved? the Web version will probably be on Facebook, so could I link both versions through their FB UID?

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: GLSL mesh discard command? Is there a GLSL command similar to the discard, but it discards the whole mesh and not just a fragment?

sentences:
Resolution Independence in libGDX How do I make my libGDX game resolution/density independent? Is there a way to specify image sizes as "absolute" regardless of the underlying density?

I'm making a very simple kids game; just a bunch of sprites displayed on-screen, and some text for menus (options menu primarily). What I want to know is: how do I make my sprites/fonts resolution independent? (I have wrapped them in my own classes to make things easier.)

Since it's a simple kids game, I don't need to worry about the "playable area" of the game; I want to use as much of the screen space as possible.

What I'm doing right now, which seems super incorrect, is to simply create images suitable for large resolutions, and then scale down (or rarely, up) to fit the screen size. This seems to work okay (in the desktop version), even with linear mapping on my textures, but the smaller resolutions look ugly.

Also, this seems to fly in the face of Android's "device independent pixels" (DPs). Or maybe I'm missing something and libGDX already takes care of this somehow?

What's the best way to tackle this? I found this link; is this a good way of solving the problem?: http://www.dandeliongamestudio.com/2011/09/12/android-fragmentation-density-independent-pixel-dip/

It mentions how to control the images, but it doesn't mention how to specify font/image sizes regardless of density.

sentences:
Sprite batching seems slow I have implemented a sprite batching system in OpenGL which will batch sprites based on their texture. However, when I'm rendering ~5000 sprites all using the same texture I'm getting roughly 30fps.

The process is as followed

Create sprite batch which also create a VBO with a set size and also creates the shaders as well
Call begin and initialise the render mode (at the moment just setting alpha on)
Call Draw with a sprite. This checks to see if the texture of the sprite has already been loaded and if so it just creates a pointer to the batch item and adds the new sprite coords. If not then it creates a new batch item and adds the sprite coords to that; it adds the batch item to the main batch. If the max sprite count is reached render will be called
Call end which calls render to render the left over sprites in the batch, and also resets the buffer offset
Render loops through each item in the batch and will bind the texture of the batch item, map the data to the buffer and then draw the array. The buffer will then be offset by the amount of sprites drawn.

I have a feeling that it could be the method I'm using to store the batched sprites or it could be something else that i'm missing but I still can work it out.

The class files are at these URLs:

http://pastebin.com/iCB608tA (header)
http://pastebin.com/ZAytErGB (class)

On top of this, I'm also getting a weird issue where two sprites are batched on after the other the second sprite will use the same coordinates as the last. But, the one that is drawn after it is fine. I can't seem to find what is causing this issue.

sentences:
AABB-AABB sliding collision response I have many objects with AABBs and a player surrounded in an AABB. If I represent my player with a point everything works smooth with detection and wall sliding as a response (for example what wall sliding is, see this video).

If I represent my player with an AABB I first check if there is any AABB - AABB collision which works fine but I want the same sliding effect with this AABB box. I worked out a little trick to find the normals of both faces that collide but only works when I'm moving in one axis so that shouldn't be how it's done.

Below you'll see my scene. You'll see cubes surrounded with an AABB with a small offset and my camera that is at the center of an AABB (red lines).

How does one provide a good seamless AABB - AABB collision response algorithm that is not too hard to implement (like the one in the youtube video). I couldn't find anything useful on the web.

sentences:
How can i load a level in my gameengine wich is larger than 2GB? C# i were asking myself how could i load a large Level? My gameengine is written in C# and is rendering with Direct3D11. I just have my class called "Scenery" and the class is able to store all objects in a level (sceneryObject) with their components and features. My engine loads the serialized scenery, but i know that the maximal size of a .net object is 2gb. So how could my Scenery class load bigger levels? The .Scenery class contains a List with all the objects, and the Assets are included within the sceneryClass.
Do you thinkthe Scenery class should not include the Assets, and they should be stored extern?

Maybe somebody have a suggestion :)

Best Regards and thanks in advance!

sentences:
Collision Detection in Direction (SFML) I am experiencing a problem with collision detection, an efficiency problem. Right now I want to make it so that my player square stops traveling in the direction of collision into the static object. I followed what a guy did in a tutorial when he checked this type of collision but it's long and hard to understand let alone read. Is there an easier way to tackle this issue?

sf::RectangleShape player;
player.setSize(sf::Vector2f(50, 50));
player.setFillColor(sf::Color::Cyan);
player.setPosition(width / 2, height / 2);

sf::RectangleShape object;
object.setSize(sf::Vector2f(100, 100));
object.setFillColor(sf::Color::Green);
object.setPosition((width / 2) - 200, (height / 2) - 120);

sf::Vector2f velocity(0, 0);
float gravity = .1;

bool jumping = true;

sf::Event event;
while (window.isOpen())
{
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();

        if (event.type == sf::Event::KeyPressed)
        {
            if (event.key.code == sf::Keyboard::Space)
            {
                if (jumping == false)
                {
                    velocity.y = -3.5;
                    jumping = true;
                }
            }
            else if (event.key.code == sf::Keyboard::Right)
            {
                velocity.x = 3;
            }
            else if (event.key.code == sf::Keyboard::Left)
            {
                velocity.x = -3;
            }
        }
    }

    //Move the player
    player.move(velocity);

    //Gravity

    if (player.getPosition().y < height / 2)
    {
        velocity.y += gravity;
    }
    else if (player.getPosition().y >= height / 2)
    {
        player.setPosition(player.getPosition().x, height / 2);
        jumping = false;
    }

    //Check collision with object
    sf::FloatRect player_boundingBox = player.getGlobalBounds();

    if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().y + 50 < object.getPosition().y + 5 && player.getPosition().y + 50 > object.getPosition().y && player.getPosition().y < object.getPosition().y)
    {
        player.setPosition(player.getPosition().x, object.getPosition().y - 50);
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().x > object.getPosition().x + 90 && player.getPosition().x < object.getPosition().x + 99)
    {
        player.setPosition(object.getPosition().x + 100, player.getPosition().y);
        velocity.x = 0;
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().x + 50 < object.getPosition().x + 10 && player.getPosition().x + 50 > object.getPosition().x)
    {
        player.setPosition(object.getPosition().x - 50, player.getPosition().y);
        velocity.x = 0;
    }
    else if (player_boundingBox.intersects(object.getGlobalBounds()) && player.getPosition().y > object.getPosition().y + 97 && player.getPosition().y < object.getPosition().y + 99)
    {
        player.setPosition(player.getPosition().x, object.getPosition().y + 100);
        velocity.y = 0;
    }

    window.clear(sf::Color::White); //Clear

    window.draw(player);
    window.draw(object);

    window.display(); //Display
}

sentences:
How to use OpenGL functions from multiples thread? I'm writing a small game using OpenGL.

I'm implementing basic networking in this game and I'm facing a problem.

I have a thread in my client socket class that check for available data, when there are data I raise an event like this :

immutable int len = this.m_socket.receive(data);

if(len > 0)
{
    this.m_onDataEvent(data);
}

Then on my game class, I have a function that handle and parse data like this :

switch(msgId)
{
    case ProtocolID.CharacterData:

        // Load terrain with opengl, character model....

Im not able to call opengl functions because my opengl context is created from a different thread.

But I really don't know how I can solve this problem, I tried Google but it's really hard to find a solution.

I'm using D programming language if it can help.

sentences:
Why do my Box2D bodies occasionally get stuck and separate forcibly? I'm making a space game with LibGDX and Box2D. I made a video here to illustrate the issue.

Verbal description: When objects collide, they sometimes get stuck together and are then suddenly separated by a strong force.

Both objects have identical body definitions and fixtures:

bod = new BodyDef();
bod.type       = type;
bod.allowSleep = false;

shape = new CircleShape();
shape.setRadius(values[0]);

fix = new FixtureDef();
fix.restitution = 0f;
fix.friction    = 1f;
fix.shape       = shape;
fix.density     = 1f;

worldBod = world.createBody(bod);
worldBod.setTransform(position.x, position.y, 0);
worldBod.createFixture(fix);

Why might this be happening? How can I fix it?

Update: Here is some more info.

The Player class contains a function update(float deltaTime) with the rest listed below

force.x += (directionVector.x * SPEED)*deltaTime;
force.y += (directionVector.y * SPEED)*deltaTime;

//This helps keep the object in control from preventing forces greater then 3
if(force.x >= 3){
    force.x = 3;
}if(force.x <= -3){
    force.x = -3;
}if(force.y >= 3){
    force.y = 3;
}if(force.y <= -3){
    force.y = -3;
}
//This quickly reduces the force back down to 0
force.x *= 0.5;
force.y *= 0.5;

this.getBody().applyForceToCenter(force, true);

In the render part of the main game class I step the world with

gameWorld.step(Gdx.graphics.getDeltaTime(), 6, 6);
//although increasing or decreasing the itterations seems not to help

and Finally the hexagon's are created using the ShapeRenderer pulling the position and

sr.setProjectionMatrix(camera.combined);
sr.begin(ShapeType.Line);
sr.circle(p1.getBody().getPosition().x, p1.getBody().getPosition().y, 1);
sr.circle(barrierPole.getBody().getPosition().x, barrierPole.getBody().getPosition().y, 1);
sr.end();

sentences:
Rotating sprite around another sprite I am building a pool game, and I want to make the cue rotate around the white ball.

Here is the live code:

http://199.26.84.223/nocol.html

Here is the code for the white ball:

balls = game.add.group();
balls.enableBody = true;
balls.physicsBodyType = Phaser.Physics.P2JS;
wball = balls.create(350, 240 , 'ballW');
wball.body.setCircle(15);
wball.body.setCollisionGroup(wballCollisionGroup);
wball.body.collides([wballCollisionGroup, ballsCollisionGroup , sidesCollisionGroup , holesCollisionGroup , playerCollisionGroup]);
game.physics.p2.setImpactEvents(true);

Here is the code for the cue, which I call player:

    player = game.add.sprite( 0   , 0   , 'player');
    game.physics.p2.enable(player , true );
    player.enableBody = true;
    player.body.setCollisionGroup(playerCollisionGroup);
    player.body.setZeroVelocity();
    player.body.createBodyCallback(wball, ballHit , this);
    player.anchor.setTo(-0.5, 0.5);
    player.pivot.x = wball.x +150;
    player.pivot.y = 0;

    player.body.x = wball.x  ;
    player.body.y = 240 ;

The problem is that all pivot or anchor does is change the sprite image position. I got the cue to appear in the right place by using both pivot/anchor and it seems to work fine... the cue was rotating around the ball, but after enabling debug mode here is what I saw:

Basically only the position of the image has been changed but the sprite still rotates around the center which is the red part. If I run this code, the ball and cue are already colliding and the ball jumps around without player doing anything.

How can I rotate the cue around the ball without them colliding?

sentences:
glDrawArrays: Erasing the buffer between calls? I have two VBOs, assigned to names 1 and 2. Only 2 is being drawn. However, if I comment out VBO 2, VBO 1 is drawn with no problem. Here's the relevant code.

                for m in shader._models:
                    try:
                        # Set the model's transform matrix uniform
                        vbo, mode = m.render_data
                        glUniformMatrix4fv(
                            shader.uniforms['model'][0],
                            1,
                            GL_FALSE,
                            np.array(m.model_matrix))
                        vbo.bind()  # Binds the VBO.
                        glDrawArrays(mode, 0, len(vbo))
                    finally:
                        vbo.unbind() # Unbinds it.

glGetting GL_ARRAY_BUFFER_BINDING in the loop gives me alternating 1 and 2s, so the buffers are binding correctly. The second object is smaller and positioned in a different location, so they aren't hiding each other.

The only explanation I can think of is glDrawArrays clears the whole buffer every time it draws? What the heck?

sentences:
UE4 doesnt work with subfolders I am trying to create a file structure for my code in c++classes/Myproject (in UE4 editor). I added a new class and in UE4s "Add C++ Class" dialog box I set the path for the created scripts as MyProject/Source/MyProject/test, test being the subfolder I am trying to create, however when the editor finishes generating the files I get an error saying that it failed to find the files it generated.

...\MyProject\test\SysGen.cpp(4): fatal
error C1083: Cannot open include file: 'test/SysGen.h': No such file
or directory

In visual studio I can see and open the generated scripts, but it fails to compile. What do I need to do for this to work?
here are the files image taken from visual studio:

sentences:
Libgdx understanding screen size I'm trying to create my own jumper type game where the player moves up through an infinite y value. The problem I am having is getting the screen size to match up with the android screen.

  viewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera);
    camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

Currently I just want the sprite to be drawn in the center of the screen. I'm not worried about the game world size as it will differ from each device.

  camera.update();
    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    batch.draw(player.getKeyFrame(animationTime), Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

This draws the player somewhere in the upper right corner of the screen. It's my understanding that Gdx.graphics.getwhatever is used to get the dimensions of whatever your device screen is. So I'm wondering if I'm using the viewport class correctly or not?

sentences:
XNA: SpriteFont question I need some help with the SpriteFont. I want a different font for my game, other than Kootenay. So, I edit the SpriteFont xml, i.e:

<FontName>Kootenay</FontName>

or

<FontName>Arial</FontName>

No problem with Windows fonts, or other XNA redistributable fonts pack. However, I want to use other fonts, that I downloaded and installed already, they are TTF or OTF, both supported by XNA.
My problem is, I cant use them, I got this error:

  The font family "all the fonts i tried" could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font.

So, checking at the windows fonts folder, I check the properties and details of the fonts, I try all the names they have, and but never works. Maybe I need some kind of importing or installing in order to use them, I dont know, and I hope you guys can help me, thanks!

sentences:
Calculate how many degrees a physical device is off centre (offset) given X, Y, Z Let's say I have a physical device that I can rotate with my hands and receive X Y Z coordinates of that device. What I need to calculate is the offset - how far is the pendulum of gravity straight down. Basically how many degrees I am off centre.
Is there a way of doing so? I've googled a lot of questions but so far I'm struggling.
Thanks.
Updated:
There is a physical device (sensor) which I can rotate. The device sends its X Y Z coordinates and a calculated acceleration vector in mg (mill mg). I can read this data from this device using BLE. The device should lie flat while transportation, so I need to calculate how many degrees the device is off centre (which is the laying flat on table).
Updated x2:
I need to calculate the angle between the device's centre vector and a gravity pendulum (the blue angle) on the photo.

sentences:
SerializedPropertyBindings NullReferenceException Using:

Unity 4.6.1 Pro

Visual Studio 2013 Pro, c#

Team Foundation Connected to git vc

Windows 7 Premium

Building 2D iOS app (2D set up)

Details:

Periodically, this error is occurring. There is no pattern to invoke this error so far.

I then found this on the official Unity forums: Strange error showing up

But, I would like to avoid creating an entirely new project and re-importing everything, since it is getting to become a slightly large project. I do remember deleting an asset out of the file directory(not in unity), on accident, so this may be the issue. Is there any way to clean/wipe/fix this issue, w/o doing a fresh project and import?

I appreciate the guidance.

sentences:
Obtaining a certain type of object with component based design I'm trying to design my game to be component based rather than overly hierarchical. Essentially, every high level object in the game (like gun, or whatever) inherits and implements the interfaces that it needs. For example, IPhysics, IRenderable, IWeapon, etc.

There are a few cases where I'm uncertain how to obtain a specific interface from another.

For example. A Gun might inherit from IWeapon, IPhysics, and IRenderable. I then also have a player which inherits from IPlayer, IPhysics, and IRenderable. I need a way so that, when Player and Gun collide, if Player is not currently wielding a weapon, he should be able to wield the gun and hold a pointer to the IWeapon of the Gun.

Right now, when Box2D detects a collision between 2 fixtures, I use the UserData field to store the IPhysics pointer associated with the fixture, and therefore, the IPhysics.beginContact method is invoked.

From here, the Player needs to somehow be able to know that this is a weapon, and obtain an IWeapon* . This is the part I really have no idea on.

Any advice on solving something like this is appreciated, even if it means some kind of design change on my part. I'm just looking for a clear way on how to solve this sort of problem.

Thanks

sentences:
Compiled vs Scripting Plugin System I'm making a very simple game that revolves mostly around user-created mods. So far I've seen most games using Lua or something like Lua to enable user scripting, but recently I've seen people using dynamically loaded, AOT'd libraries to increase performance. When would I use one over the other?

The only advantages I can find are that scripting languages are easier to approach by non-programmers (particularly Lua), or that dynamic loading will improve performance and will be more lightweight (no need for an embedded interpreter).

sentences:
How to iterate over 25 Sprite Objects (Unity 5 - C#) I wanna show a minimap on the screen. The minimap would look like this (bottom right corner, this was done time ago in Visual Studio):

Have two problems with that, I have 25 Image objects created in the scene and 25 in the playercontroller script:

public Image minimap0, minimap1, minimap2, minimap3, ... , minimap24;

but I can't make to change its sprite, and also, I don't know how to change all 25 objects sprite with a "for" loop (the foor will look like this http://imgur.com/qfi1Ht1 ).

The map is stored in an array for checking positions.

sentences: Is there a way that I can use Krita assets that I draw in Spine for animation? I am using Krita to create my assets for a game. I am also using Spine so that I can animate those assets to add into my game. Is there a way that I can use Krita and Spine together? I would really like to not have to buy Photoshop or have to learn another software to create my assets.

sentences:
Level/Map file creation and processing with OpenGL How do levels/maps work in the game development world? Counter strike, which is a popular FPS that uses OpenGL as it's graphics library, has it's levels/maps created as *.bsp files. How do you create files like this, and use OpenGL to load them?

Thanks!

sentences:
How can I change view to orthographic using a menu? I'm writing the custom menu using MenuItem and I'm stuck trying to make scene view orthographic when 5 is pressed. What is the object or method I can use to set scene's view to orthographic (I don't mean the main camera, but the main view shown in the window).

This is a C# code of what I was trying to achieve:

[MenuItem("View/SetOrtho _5")]
static void SetOrtho() {
    var scene = ... //assign scene
    scene.setOrtho(true); //set orthographic view to the scene
}

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:
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:
Sparse voxel octree for 3d pathfinding and Manhattan distance I've been learning about using sparse voxel octree for 3d pathfinding based on Daniel Brewer's chapter in Game AI and his talk at GDC 2015.
One aspect that I'm really confused about is exactly what is considered to be a neightbor of a cell in the tree, and whether using Manhattan distance is alright or not. Let's assume that all the cells are of the same size and consider some cell C. How many neightbors will it have - 6, one for each side of the cube, or 27-1=26, all the cubes "touching" our chosen cell at least in one vertex?
It seems the former 6, but I don't see how that doesn't cause problems if we calculate distances between centers of the cells - it induces a manhattan norm, and there's lots of situations where that fails. I have some intuition why it might not be an issue if you do some type of "post processing" on the found path, but it could simply fail quite badly in finding a good path.
Brewer has mentioned using Manhattan distance throughout the talk as well to allow for easier computations, but: 1, it seems like a very problematic thing to me and 2, it seems to me like Manhattan distance is already being used when moving across neightboring cells of same size, which I would assume where the bulk of the expensive computation happens.
//
EDIT: Adding some examples of where it seems to me that Manhattan distance fails:

Green path corresponds to the good paths, red to the wrong paths. Technically the the green paths should be drawn in jagged way, as on the grid you can only move vertically/horizontally, but you can imagine that if we zoomed really close to them, that is really what they look like - it's just not visible from this distance.
sI -> eI is an example of the general issue with something like Dijsktra's - the red path has the same length as the green path in Manhattan distance and could get chosen. It would probably work fine with A* if we use something like euclidean distance for the Heuristic, since it will greedily go as close to the obstacle as possible.
sI -> eII shows the same problem, but fails with A* too.
I can imagine that both of the above are not huge issues - the pathfinding finds a general path which is good enough - when it comes to the agent actually following the path, they could for example set its next "target" as the furthest point on the path it can travel to directly (check a raycast/spherecast), or even do a few raycast checks along the line between the last point it can reach directly and the next one - the blue line in the image. We would set the local "target" to be a point on the blue line that is furthest away from the reachable point.
sII -> eIII doesn't seem like something that can be fixed like I described in the paragraph above. A* will simply find the wrong red path.

sentences:
How do I make an XML-specified animation show completely? I want to add animation to my game board when updating tile positions. I can start an animation at the right point, but there's a catch: When the translate animation starts, it seems like the animation is confined within the tile (button) or is just hidden behind another button. Instead, I want it to look like it is moving.

This is what happens:

This is what I want to happen:

Here's how I start the animations:

    Animation tile_up = AnimationUtils.loadAnimation(this, R.anim.tile_up);
    // This was a valid move. Add to moves and enable undo for this
    for(int i = 0; i < 5; i++)
    {
        buttons[x][i].startAnimation(tile_up);
    }

Here's the animation spec (in res/anim/tile_up.xml):

    <?xml version="1.0" encoding="utf-8"?>
    <translate
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shareInterpolator="true"
        android:fromYDelta="100%p"
        android:toYDelta="0%p"
        android:duration="100"/>

How can I fix this?

sentences:
Binding c++ templated functions to lua I have started using Lua as a scripting language for my game engine. It works perfectly for things like input, audio etc. However, I'm now trying to bind my entity component system functions which make heavy use of templates.

For example, getting a component of an entity in c++ would look like this:

uint32 entity = 1;
Transform &transform = registry.get<Transform>(entity);

and adding a component to an entity:

registry.add<Velocity>(entity, 0.0f, 0.0f);

From what I can tell, Lua cannot handle templated functions - I would have to bind a new function for each component e.g getTransformComponent(entity). This obviously isn't great and becomes a huge pain for the end user. I've had a look around and can't find anything that is particually helpful for my problem. I see a few people suggesting things like getComponent("Transform") but I don't see how this would be implemented in c++ as my components are PODs, no base 'Component' class?

sentences:
How to determine the end of list has been reached? I'm trying to animate my object according to a set of recorded values from kinect skeleton stream by saving the (x,y,z) stream from the skeletal data into a list and then set my objects x and y position from the x,y of the list. However, once the list end has been reached it starts to animate again from the start. I don't want that - I just want the model position to keep going in the positive X direction. Is there any way I can check if end of the list has been reached and to just update the model position in x direction?

Or is there any other way to continue moving my sprite once the points in the list are over... i dont want it to start animating all the way again..

   protected override void Update(GameTime gameTime)
        {

            //position += spriteSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

            //// TODO: Add your update logic here
            using (StreamReader r = new StreamReader(f))
            {
                string line;
                Viewport view = graphics.GraphicsDevice.Viewport;
                int maxWidth = view.Width;
                int maxHeight = view.Height;

                while((line = r.ReadLine()) != null)
                {

                    string[] temp = line.Split(',');

                    int x = (int) Math.Floor(((float.Parse(temp[0]) * 0.5f) + 0.5f) * maxWidth);
                    int y = (int) Math.Floor(((float.Parse(temp[1]) * -0.5f) + 0.5f) * maxHeight);

                    motion_2.Add(new Point(x, y));
                }

            }

                position.X = motion_2[i].X;
                position.Y = motion_2[i].Y;

            i++;

            a_butterfly_up.Update(gameTime);

            a_butterfly_side.Update(gameTime);

            G_vidPlayer.Play(mossV);

            base.Update(gameTime);
        }

sentences:
Why do we multiply perspective * modelview * point? A common line in vertex shaders is:

gl_Position = projection_matrix * model_view_matrix * object_space_vertex;

I've seen this a lot, why isn't it written like

gl_Position = object_space_vertex * model_view_matrix * projection_matrix;

?

That would be more intuitive I suppose. Is it mathematically wrong?

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:
ContentManager in XNA cant find any XML Im making a game in XNA 4 and this is the first time I'm using the Content loader to initialize a simple class with a XML file, but no matter how many guide I follow, or how simple or complicated is my XML File the ContentManager cant find the file; the Debug keep telling me: "A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in Microsoft.Xna.Framework.dll".
I'm really confuse because I can load SpriteFonts and Texture2D without a problem ...

I create the following XML (the most basic Xna XML):

    <?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="System.String">Hello</Asset>
</XnaContent>

and I try to load it in the LoadContent method in my main class like this:

System.String hello = Content.Load<System.String>("NewXmlFile");

There is something I'm doing wrong? I really appreciate your help

sentences:
What is this JavaScript gibberish? I am studying how to make a 2D game with JavaScript by reading open source JavaScript games and I came across this gibberish...

aSpriteData = [
    "}\"¹-º\"À+º\"À+º\"À+º\"¿¤À ~C_ +º\"À+º\"À+º\"À*P7²OK%¾+½u_\"À<¡a¡a¡bM@±@ª",    //  0 ground
    "a ' ![± 7°³b£[mt<Nµ7z]~¨OR»[f_7l},tl},+}%XN²Sb[bl£[±%Y_¹ !@ $",        //  1 qbox
    "!A % @,[] ±}°@;µn¦&X£ <$ §¤ 8}}@Prc'U#Z'H'@· ¶\"is ¤&08@£(",           //  2 mario
    "  ´!A.@H#q8¸»e-½n®@±oW:&X¢a<&bbX~# }LWP41}k¬#3¨q#1f RQ@@:4@$",         //  3 mario jump
    "   40 q$!hWa-½n¦#_Y}a©,0#aaPw@=cmY<mq©GBagaq&@q#0§0t0¤ $",         //  4 mario run
    "+hP_@",                                    //  5 pipe left
    "¢,6< R¤",                                  //  6 pipe right
    "@ &  ,'+hP?>³®'©}[!»¹.¢_^¥y/pX¸#µ°=a¾½hP?>³®'©}[!»¹.¢_^  Ba a",        //  7 pipe top left
    "@ , !] \"º £] , 8O #7a&+¢ §²!cº 9] P &O ,4    e",              //  8 pipe top right
    " £ #! ,! P!!vawd/XO¤8¼'¤P½»¹²'9¨  \"P²Pa²(!¢5!N*(4´b!Gk(a",            //  9 goomba
    "   Xu X5 =ou!¯¬a[Z¼q.°u#|xv ¸··@=~^H'WOJ!¯¬a=Nu ²J <J   a",          // 10 coin  // yui
    "@ & !MX ~L \"y %P *¢ 5a K  w !L \"y %P *a%¬¢ 4  a",               // 11 ebox // yui
    "¢ ,\"²+aN!@ &7 }\"²+aN!XH # }\"²+aN!X%  8}\"²+aN!X%£@ (",          // 12 bricks
    "} %¿¢!N° I¨²*<P%.8\"h,!Cg r¥ H³a4X¢*<P%.H#I¬ :a!u !q",         // 13 block
    makeSpace(20) + "4a }@ }0 N( w$ }\" N! +aa",                    // 14 bush left
    " r \"²y!L%aN zPN NyN#²L}[/cy¾ N" + makeSpace(18) + "@",            // 15 bush mid
    makeSpace(18) + "++ !R·a!x6 &+6 87L ¢6 P+ 8+ (",                // 16 bush right
    " %©¦ +pq 7> \"³  s" + makeSpace(25) + "@",                 // 17 cloud bottom left
    "a/a_#².Q¥'¥b}8.£¨7!X\"K+5cqs%(" + makeSpace(18) + "0",             // 18 cloud bottom mid
    "bP ¢L P+ 8%a,*a%§@ J" + makeSpace(22) + "(",                   // 19 cloud bottom right
    "",         // 20 mushroom
    "", // koopa 16x24
    "",             // 22 star
    "",                         // 23 flagpole
    "",         // 24 flag
    "",                 // 25 flagpole top
    "  6  ~  }a }@ }0 }( }$ }\" }! } a} @} 0} (} $} \"² $",             // 26 hill slope
    "a } \"m %8 *P!MF 5la\"y %P" + makeSpace(18) + "(",             // 27 hill mid
    makeSpace(30) + "%\" t!DK \"q",                         // 28 hill top
    "",         // 29 castle bricks
    "",                         // 30 castle doorway bottom
    "",                 // 31 castle doorway top
    "",         // 32 castle top
    "",         // 33 castle top 2
    "",             // 34 castle window right
    "",             // 35 castle window left
    "",         // 36 castle flag
    makeSpace(19) + "8@# (9F*RSf.8  A¢$!¢040HD",                    // 37 goomba flat
    "     *(!¬#q³¡[_´Yp~¡=<¥g=&'PaS²¿ Sbq*<I#*£Ld%Ryd%¼½e8H8bf#0a",         // 38 mario dead
    "   =  ³ #b 'N¶ Z½Z Z½Z Z½Z Z½Z Z½Z Z½Z =[q ²@ ³  ¶   0",           // 39 coin step 1
    "   ?@ /q /e '¤ #³ !ºa }@ N0 ?( /e '¤ #³  ¿  _a  \"",               // 40 coin step 2
    "   /  >  ]  º !² #¢ %a +  >  ]  º !² #¢ 'a  \"",               // 41 coin step 3
    "   7¢ +² *] %> \"p !Ga t¢ I² 4º *] %> \"p  ¡  Oa  \""              // 42 coin step 4
],

What does it do? If you want to look at the source file, here it is. Beware, there is more gibberish inside. I can't seem to make sense of any of it.

sentences:
A ball hits the corner slightly, where will it deflect? I am currently making an iOS Game but I have a small problem. The game is simply a ball which you can control to avoid obstacles and find the food. When the ball hits, e.g. the top or the bottom of an obstacle, it's easy, the y-speed is just inverted. Same with left and right, where the x-speed is inverted.

But what happens when the mass point of the ball doesn't touch a side of the obstacle, but its surface is? Where will it be deflected? What's the maths behind that?
Here's an image to illustrate the problem:

Thanks in advance for help!

sentences:
D3DXLoadSurfaceFromResource failed to load bitmap image I'm working on a small DX9 game project for learning purpose. I'm current dealing with resources manager file (*.rc) which I'm not used to (I have only worked with direct file until now).
If I use D3DXLoadSurfaceFromFile, it worked fine, the image was drawn on windows. When I changed to D3DXLoadSurfaceFromResource, I think it can not load the image, only a black screen & the Hresult that it returns is S_FALSE.
This is the create surface function :
bool Surface::CreateSurface()
{
    if (FAILED(m_Device->CreateOffscreenPlainSurface(
        m_Width,
        m_Height,
        D3DFMT_X8R8G8B8,
        D3DPOOL_DEFAULT,
        &m_Surface,
        NULL
    )))
        return false;

    if (FAILED(D3DXLoadSurfaceFromResource(
        m_Surface,
        NULL,
        NULL,
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(m_RsSymbol),
        NULL,
        D3DX_DEFAULT,
        0,
        NULL
    )))
        return false; // S_FALSE and return false while debug
    return true;
}

This the render function :
void GWindow::Render()
{
    Surface Hello_Brown(146, 146, m_lpD3DV, IDB_SAMPLE); // IDB_SAMPLP will be assigned to m_RsSymbol
    LPDIRECT3DSURFACE9 backbuffer;
    if (NULL == m_lpD3DV)
        return;

    m_lpD3DV->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);

    m_lpD3DV->GetBackBuffer(
        0,
        0,
        D3DBACKBUFFER_TYPE_MONO,
        &backbuffer
    );

    m_lpD3DV->StretchRect(
        Hello_Brown.GetSurface(),
        NULL,
        backbuffer,
        NULL,
        D3DTEXF_NONE
    );

    m_lpD3DV->Present(NULL, NULL, NULL, NULL);
}

Where I am wrong and how do I fix it?
Resource file : link
I linked the file above, because it too long to post here.

sentences:
Unity Animator default values overwriten I have created a project to reproduce the problem I'm currently facing.
I'm running a simple unity animation that moves a game object and expect to be able to reset the gameobject position. This can be done by adding an empty animation, that (since it does not change anything) simply writes the default values, thus returning our gameobject to its original position.

But here is where things get complicated: if the animator gameobject is set inactive while the animation is running, new incorrect defaults values will be saved when gameobject is activated, and I am unable to reset my gameobject position.

To reproduce this issue, run the attached project:
(Download from here)

Change the stop method to "PlayEmpty"
Hit Start Animation and watch the left "Hello world" text travel.
While it is traveling, click Disable Text GO. The left text disappears.
Click Enable Text GO and see the text comes back at its last location.
Click Start Animation and watch the left "Hello world" text travel.
Click Stop Animation - the text is returned to the position where it was when enabling the gameobject, rather than its original position.

Any help is welcome, suggestions on how to change the code to make the above scenario work.

Thanks,
Yaniv

sentences:
How do I implement a field of vision for AI entities? I am considering how to implement a field of vision system for my AI entities, but am not sure on the order of steps to take. The thought process that I had was to use a combination of radial distance and dot product.

Keeping in mind that this is a 3D environment (meaning that all vectors have 3 components), and I will be using quaternions for the orientation of all entities.

What order should I do these in? and is my logic accurate?

Dot product: Taking the position of the playerObject, and the position of the AIEntity create a vector, and then take the orientation quaternion, and convert that to a vector of fixed length, and perform the dot product between them (testing for a specific range of values) to see if it is within a given arc.

Radius test: Simple 3D radius to determine distance.

I know for sure that a dot product test should be quite simple (3 subtractions, 3 multiplications, 2 additions, and however many operation to turn a quaternion into a vector), but arriving at the orientation vector I have no direct idea (if this process could be explained it would be of great help, I know I would have to multiply by the needed magnitude after normalizing), and radius test is also simple (3 subtractions, 3 additions, and 4 multiplications) both of these would still include a boolean tests, but which order would reduce faster?

My first guess would be to be the dot product, and then the radius test; As the dot product would be outside of bounds if the player is outside of the arc or to far away, and the radius test would only fail if the object is to far away. I understand that both tests can give false positives, but for some reason I feel that the dot product test would give fewer.

sentences:
How to avoid subpixel values in a resolution independent 2D game with orthographic projection? I'm trying to do resolution independent rendering of moving sprites in a 2D game. My plan is work in a fixed coordinate system in my world (for example 960x540) and use orthographic projection to scale that up or down to fit the viewport. I do letterboxing to handle different aspect ratios.

According to most tutorials, I am free to use whatever dimensions I like for the view frustum, but I found that in many cases that leads to the problem that I end up using subpixel values on the viewport. For example a vertex at (62,62) in a coordinate system of 960 x 540 ends up at (51.6666667,51.6666667) on a viewport with the dimensions 800 x 450.

I noticed two kinds of problems with that:

the texture sampling changes all the time for objects that are in motion depending on where the vertices are in relation to a pixels center
my objects get stretched horizontally or vertically by a pixel from time to time due to rounding

What is the best practice to avoid this (while maintaining resolution independence in terms of movement speeds and so on)? And where would be the best place to do address this? Before passing the vertices to the shaders or inside the vertex shader?

sentences:
Novice Mobile Game Developers | Publishing on our own or Publisher? So we are almost done with our first indie game, developed on Android. We believe that the game has potential, our graphics guy is damn good so we have some good eye candy in our game.

Now we are thinking what should be our starting step? We can purchase the Google Play account and launch it on our own, but we aren't sure if we'd be able to advertise it well and get something big out of it.

Or we can contact a publisher, and talk about some deal.

Which one is better? What are the pros and cons of both, considering this is only our first game and we intend to make a lot more. Also considering that we're only students yet, currently in our senior year. We would love to generate some revenue out of it.

What are the best ways of contacting publishers? How do we approach them and deal with them?

Many thanks for your kind help!

sentences:
How 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:
Follow point of interest by applying torque Given a body with an orientation angle and a point of interest or targetAngle, is there an elegant solution for keeping the body oriented towards the point of interest by applying torque or impulses?

I have a naive solution working below, but the effect is pretty 'wobbly', it'll overshoot each time, slowly getting closer to the target angle - an undesirable effect in my case.  I'd like to find a solution that is more intelligent - one that can accelerate to near the target angle then decelerate and stop right at the target angle (or within a small range).

If it helps, I'm using box2d and the body is a rectangle.

def gameloop(dt):
    targetAngle = get_target_angle()
    bodyAngle = get_body_angle()
    deltaAngle = targetAngle - bodyAngle
    if deltaAngle > PI:
        deltaAngle = targetAngle - (bodyAngle + 2.0 * PI)
    if deltaAngle < -PI:
        deltaAngle = targetAngle - (bodyAngle - 2.0 * PI)
    # multiply by 2, for stronger reaction
    deltaAngle = deltaAngle * 2.0;
    body.apply_torque(deltaAngle);

One other thing, when body has no linear velocity, the above solution works ok.  But when the body has some linear velocity, the solution above causes really wonky movement.  Not sure why, but would appreciate any hints as to why that might be.

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: How would I create a billboard that is fixed to my camera's farplane? I'm trying to set a GameObject(plane) to be positioned at my camera's farplane. I plan on using this billboard as a sort of dynamic skybox. How would I create a billboard that is fixed to my camera's farplane?

sentences:
Geometry shader for multiple primitives How can I create a geometry shader that can handle multiple primitives? For example when creating a geometry shader for triangles, I define a layout like so:

layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;

But if I use this shader then lines or points won't show up. So adding:

layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
layout(lines) in;
layout(line_strip, max_vertices=2) out;

The shader will compile and run, but will only render lines (or whatever the last primitive defined is).

So how do I define a single geometry shader that will handle multiple types of primitives? Or is that not possible and I need to create multiple shader programs and change shader programs before drawing each type?

sentences:
What is the purpose of indices in 3D rendering? Suppose you were creating a 3D cube in OpenGL. You implement the necessary vertex data for the object (cube). What would be the point of using indices?

 void CreateCube()
        {
            const Vertex VERTICES[8] =
            {
                { { -.5f, -.5f,  .5f, 1 }, { 0, 0, 1, 1 } },
                { { -.5f,  .5f,  .5f, 1 }, { 1, 0, 0, 1 } },
                { {  .5f,  .5f,  .5f, 1 }, { 0, 1, 0, 1 } },
                { {  .5f, -.5f,  .5f, 1 }, { 1, 1, 0, 1 } },
                { { -.5f, -.5f, -.5f, 1 }, { 1, 1, 1, 1 } },
                { { -.5f,  .5f, -.5f, 1 }, { 1, 0, 0, 1 } },
                { {  .5f,  .5f, -.5f, 1 }, { 1, 0, 1, 1 } },
                { {  .5f, -.5f, -.5f, 1 }, { 0, 0, 1, 1 } }
            };

            const GLuint INDICES[36] =
            {
                0,2,1,  0,3,2,
                4,3,0,  4,7,3,
                4,1,5,  4,0,1,
                3,6,2,  3,7,6,
                1,6,5,  1,2,6,
                7,5,6,  7,4,5
            };

    //....

    glBufferData(GL_ARRAY_BUFFER, sizeof(VERTICES), VERTICES, GL_STATIC_DRAW);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(INDICES), INDICES, GL_STATIC_DRAW);

In the above example, a cube is created with the necessary vertices in world space. What is the relevance for the indices?

sentences:
Signed Distance Fields: How are different colour channels used to improve output of sharp corners? The naive approach to implementing signed distance field font rendering suffers quality issues where sharp corners get softened (either outward- or inward-facing corners, i.e. convex or concave corners).

Step-by-step, just how are a second and third channel used to improve the final output? How are these channels produced, as compared with a single channel (for which the process is straightforward)?

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: Who use javaFX for commercial quality games? Are there any companies work with javaFX for building videos games ?

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:
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:
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:
Procedurally generated satellite view textures for large landmass rendering I'm rendering a big land mass to be viewed from high altitude (40+ km), so I need satellite view style textures to be generated on the fly. The per vertex attributes I've got are:

Biome (forest, snow, desert, mountain, etc)
Elevation
Moisture
Temperature

Question is, is this even possible by solely shader code without any textures to sample from? It's downright impossible to find a decent looking texture pack for satellite view style textures. So far all techniques I've found were based on generating textures on existing terrain data, what I need is a procedural way to generate those on the fly per arbitrary terrain.

This is more or less the looks I'm aiming to achieve with already generated mesh and more biomes(tundra, desert, bare, shrubland, etc) and perhaps more "zoomed in":

sentences:
Gdx.input.setInputProcessor(stage) doesn't work I have an image and I want to make clickable this image. I have already done this a lot of times, but this time doesn't work. Probably because the image is from a class which extends Image:

public class BitmapFontGenerale extends Image
{

BitmapFont bitmapFont;
String scritta;
private float x;
private float y;

public BitmapFontGenerale(BitmapFont bitmapFont1, String string, float scale)
{
    bitmapFont = bitmapFont1;
    bitmapFont.setColor(Color.BLACK);
    bitmapFont.getData().setScale(scale);
    scritta = string;
}

@Override
public void draw(Batch batch, float parentAlpha)
{
    bitmapFont.draw(batch,scritta,x,y);
}

public void setX(float x)
{
    this.x = x;
}

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

public float getX()
{
    return x;
}

public float getY()
{
    return y;
}

}

This is the code which I used to set the input:

image.addListener(new ClickListener()
{
    @Override
    public void clicked (InputEvent event, float x, float y)
    {
       Gdx.app.log("CLICKED ", "CLICKED");
    }
});
stage.add(image);
Gdx.input.setInputProcessor(stage);

This code works if image is from Image class and not if it's from a class which extends Image. Note: I need to extend Image class. What's the problem?

sentences:
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:
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:
Implementing behavior in a simple adventure game I've been entertaining myself lately by programming a simple text-based adventure game, and I'm stuck on what seems like a very simple design issue.

To give a brief overview: the game is broken down into Room objects. Each Room has a list of Entity objects that are in that room. Each Entity has an event state, which is a simple string->boolean map, and an action list, which is a string->function map.

User input takes the form [action] [entity]. The Room uses the entity name to return the appropriate Entity object, which then uses the action name to find the correct function, and executes it.

To generate the room description, each Room object displays its own description string, then appends the description strings of every Entity. The Entity description may change based on its state ("The door is open", "The door is closed", "The door is locked", etc).

Here's the problem: using this method, the number of description and action functions I need to implement quickly gets out of hand. My starting room alone has about 20 functions between 5 entities.

I can combine all actions into a single function and if-else/switch through them, but that's still two functions per entity. I can also create specific Entity sub-classes for common/generic objects like doors and keys, but that only gets me so far.

EDIT 1: As requested, pseudo-code examples of these action functions.

string outsideDungeonBushesSearch(currentRoom, thisEntity, player)
    if thisEntity["is_searched"] then
        return "There was nothing more in the bushes."
    else
        thisEntity["is_searched"] := true
        currentRoom.setEntity("dungeonDoorKey")
        return "You found a key in the bushes."
    end if

string dungeonDoorKeyUse(currentRoom, thisEntity, player)
    if getEntity("outsideDungeonDoor")["is_locked"] then
        getEntity("outsideDungeonDoor")["is_locked"] := false
        return "You unlocked the door."
    else
        return "The door is already unlocked."
    end if

Description functions act in pretty much the same way, checking state and returning the appropriate string.

EDIT 2: Revised my question wording. Assume that there may be a significant number of in-game objects that don't share common behavior (state-based responses to specific actions) with other objects. Is there a way I can define these unique behaviors in a cleaner, more maintainable way than writing a custom function for each entity-specific action?

sentences:
How can I navigate to a target between bodies moving along fixed paths? The problem: An autonomous ship starts at the outskirts of a solar system, and wants to move to a moving target, which is one of the planets. There are also many other planets moving at the same time, and these should be considered the only obstacles. I want to find the optimal path to the target. To keep it simple, the world is 2D, and the planets are moving in uniform circular motion around the sun as opposed to how planets actually behave.  Also, assume the ship knows pretty much everything about the world. Most importantly, the location, speed, and orbit radius of every planet.

With complete knowledge, this seems conceptually simple. For any planet and any time, you can find its location by doing some fairly simple math. But how would you apply this to pathfinding? Would it be just to pathfind in 3 dimensions: x, y, and t? In theory this makes sense, but I think working that out to an actual solution would involve a lot of complications. Is it really as simple as 'setup a* on a grid with x,y,t values'?

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:
writing problems with MonoDevelop of Unity 3D MonoDevelop was automatically installed by UnityHub.
The text editor poses a lot of problems because you can not insert a specific character
(I position myself, the positioning is not famous and when I insert, it erases the following characters!)

Is there any way to fix this editing problem?
Or
should I install another version of MonoDevelop? If yes, I downloaded his msi file but after I do not know how to install it on my installed Unity

Thank you for your help

sentences:
2d tile map render rotation math? I am working on a personal project and am trying to make a 2d tile map render that needs to handle rotation.

I am using raylib to handle the drawing stuff onto the screen and am using this function to draw a tile:

void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint);

How do I calculate the new coordinates of the tiles after the rotation and the individual rotation of each tile if I want to rotate the tile map?

I also need to figure how to do mouse click detection for tiles when they are rotated with their new coordinates and how to do ‘collision detection with cursor’ with rotated squares/tiles.

And due to the way the project is set up I cannot rotate the camera.

Extra info/diagram:

sentences:
Octree Frustrum Culling times came when i had to implement some culling into my engine. I started by reading some stuff and so far so good. I managed to create an octree which can effectivly divide my geometry's vertices (per mesh)  into an octree. But here i have some Questions:

Currently i am using immediate mode to test if the culling works. And it does work, i am recursivly traversing the tree's nodes and testing against the node's bounding box if the frustum intersects with it. Repeat untill leaf is found and render that leaf's geometry (with immediate mode for testing) But now i would like to use VBO/VAO's to render the geometry in the leaves and here i see two options:
- 1.Each time the i traverse the tree push the leaves that intersect with the frustrum into a list then get the vertices out of them and construct a VBO and send it to be rendered.
- 2.Pre build a VBO for each leaf then just rebind for each visible leaf and render.

Anyway, which is the better option rebuilding a new vbo each time the frustum changes, or just rebinding multiple vbos (which is also expensive).
Also is this even the right approach , maybe i am missing something.

bool view_Culling(CFrustum& frusrum, COctree *node)
{
if (!node)
    return false;

if (frusrum.CubeInFrustum(node->GetCenter().x, node->GetCenter().y, node-       >GetCenter().z,(node->GetWidth()/2.0f)))
{
    if (node->IsSubDivided())
    {
        view_Culling(frusrum, node->OctreeNodes()[TOP_LEFT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_LEFT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_RIGHT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_RIGHT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_LEFT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_LEFT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_RIGHT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_RIGHT_FRONT]);
    }
    else
    {
        //use prebuilded vbo here
        //or push these vertices here in a list later build a dynamic vbo
        //from them
        node->DrawOctree(node);
        return true;
    }
}
return false;
}

sentences:
The gist of tweening with WebGL / OpenGL I am trying to wrap my head around how to take advantage of shaders for things like tweening.

For example, there are these simple easing equations, which we can use like this:

var iteration = 0
var totalIterations = 200

requestAnimationFrame(render)

function render() {
  var currentValue = easeOutCubic(iteration, -100, 650, totalIterations)
  // apply current value to some object
  myObject.x = currentValue
  // do that for each object in the scene

  requestAnimationFrame(render)
}

function easeOutCubic(currentIteration, startValue, changeInValue, totalIterations) {
  return changeInValue * (Math.pow(currentIteration / totalIterations - 1, 3) + 1) + startValue;
}

I'm wondering how you can translate something like this to using a shader to calculate the easing function. This is my attempt at piecing things together.

var vert = `
precision mediump float;

attribute float aPosition;
uniform vec2 uScreen;
uniform mat4 uModel;

void main() {
  vec2 position = vec2(aPosition, cubicOut(aPosition));

  position.x /= uScreen.x / uScreen.y;

  gl_Position = uModel * vec4(position.x, position.y, 1.0, 1.0);
}

float cubicOut(float t) {
  float f = t - 1.0;
  return f * f * f + 1.0;
}
`

var frag = `
precision mediump float;

void main() {
  gl_FragColor = vec4(0.9, 0.4, 0.6, 1);
}
`

var dims = []

function render() {
  dims[0] = gl.drawingBufferWidth
  dims[1] = gl.drawingBufferHeight
  gl.clearColor(0, 0, 0, 1)
  gl.clear(gl.COLOR_BUFFER_BIT)
  gl.viewport(0, 0, dims[0], dims[1])

  bindShaders()
  draw()

  requestAnimationFrame(render)
}

My main question is how I can tween multiple properties on multiple objects. I get the multiple objects part, but not sure how exactly to do multiple properties. For example, every object in a game will have it's color, alpha, x, y, width, and height, and rotation tweened.

color
alpha
x
y
width
height
rotation

If I wanted to create a shader that can tween all of these properties, I'm not quite sure if that's possible or what it would look like.

Wondering if one could point me in the right direction.

My first guess was to do this in the shader:

void main() {
  vec2 position.x = vec2(aPosition, cubicOut(aPosition.x));
  vec2 position.y = vec2(aPosition, cubicOut(aPosition.y));
  // width...
  // height...

  gl_Position = uModel * vec4(position.x, position.y, 1.0, 1.0);
}

But the shaders don't do width/height/rotation, just points. So I'm wondering generally (a) how many shaders this might need, and (b) a rough point-in-the-right-direction on how to go about calculating the width/height/rotation in the shaders, as well as if we can pack color/alpha/x/y all into one shader, given they might have different easings.

Let me know if it's too broad and I will try to break it up.

sentences:
In game level editor using AIR or stand alone app using Java or C# I'm in the process of choosing technologies to build the level editor of a Flash RPG game.

On one side I can use AIR and build a ingame level editor that's probably going to give the best result. The problem is, I think it will be very hard, I don't have good memories using the UI libraries of AS3. I think that would take at least 3 more times (to build the editor) than the other approach.

Or I can use some mature set of tools to build the editor, like the ones commonly used with C# or Java.

The question is: Is it worth the trouble to build the editor in AIR? Or using a stand alone editor is just fine?

EDIT: Me and my team are the only people using this editor.

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:
Triangles go missing as Z changes I'm rendering a height map using shader-based OpenGL (3.3 to be precise). The height map data is from a grayscale bitmap (2D array of bytes). The dimension of the bitmap is 256 x 256.

With this data, being the Y value, I calculate X and Z as corners of uniformly distributed cells in a grid. I generate the vertices and upload it to a VBO. I generate indices and populate an IBO; indices are of type GLshort.

I've implemented a free roaming camera to roam around the terrain and verify its correctness. As I move around everything renders fine, except in some angles, particularly when viewing the terrain from above/afar, I see that some triangles in peaks of mountains go missing. In this position, if I vary the camera's position along its Z axis, I see the missing triangle are also varying. When I go closer to the peak, the error goes away and everything is nice and whole.

Culling

I've read other similar questions here, which mainly suggest that it could be because those triangles are deduced as back facing and thus may disappear when facet culling is enabled. To rule that case out, I tried glDisable(GL_CULL_FACE) in vain.

Z fighting

I thought of this issue too, but it doesn't make sense. Z fighting happens when two fragments have the same depth buffer value, but the triangles appearing in place of the missing ones (in a slightly different dull colour; see image below) are behind the missing ones and not at the same Z and thus shouldn't have this problem. In either case, I tried enabling and disabling depth test to be sure, but to no avail.

Floating-point

Worried about floating point issues, I make sure that the vertices of the terrain are distributed around the origin i.e. if each cell is a square of length c, then both X and Z values of vertices are distributed equally around 0 e.g. X doesn't vary between 0 to 256 but from -128 to 128, assuming a per cell dimension to be 1 unit.

Draw

Other than those I tried changing the way I give draw calls to GL: glDrawElements with GL_TRIANGLES, glDrawElementBaseVertex and glMultiDrawElementsBaseVertex with GL_TRIANGLE_STRIP didn't change the the situation too.

I tried searching on the internet for an explanation but I'm at a loss there too, particularly when one doesn't know the keyword to search for. This should be happening fairly commonly in serious games since they all have terrains of some kind. Is there a proper name for this, and a solution?

sentences:
How can I simulate a limited (256) color palette in OpenGL? On Twitter, I found this screenshot of a game in development:

The image on top seems to be without any color limitation. But the two other pictures at the bottom have a 256 color palette.

I want to achieve a similar effect in my game (I am using OpenGL). How can I do so?

sentences:
Acceleration and Deceleration During Rotation I'm attempting to have a sprite rotate in a way where its rotation speed increases until it has reached the halfway point in its rotation, to which it starts to slow down. I'm currently calculating the halfway point by calculating the amount of time it should take to rotate the sprite, and then checking if a current time variable is larger.

The code works rather well except for the fact that I can't figure out how current time should increment each update. Currently I'm using delta time, but that doesn't work. I'm thinking it needs to be some combination of the calculated time to rotate and delta, but I haven't gotten it yet (clearly).

EDIT:
Specifically, currentTime shouldn't be incremented by delta solely, but I have no idea what it should be in place of delta.

        if (currentTime <= timeToRotate)
        {
            rotationSpeed += 5f * delta;
            currentTime += delta;
        }

        else
        {
            if (rotationSpeed > 5f)
                rotationSpeed -= 5f * delta;

            else
                rotationSpeed = 5f;

            currentTime += delta;
        }

sentences:
Get intersected volume of two planes in 3D I'm working on AABB - AABB collision response and I'm having trouble figuring one part out. My situation is as follows (see image).

I have a player AABB (blue) and an object which collides (brown). I've drawn a few faces for both AABB's. The player moves towards the cube and collides with two planes (colliding planes have their normal's drawn). These normals will be returned in the code in the 'normals' vector. I then check the opposing planes and try to get the volume of the intersected plane (right side of image).

I based my face detection algorithm on the following question : AABB - AABB Collision, which face do I hit?

The Two AABB's colliding (blue is Player AABB and brown is object)

If I have multiple normals returned (which happens when two faces collide) I want to calculate the highest intersected volume between the collided faces and take that normal as the normal to base my collision response on (right side of image). It works for some faces but for the other half it doesn't work and I assume this has to do with change of vertex order which make my substractions pointless in some cases.

Is there some general way to calculate the volume of two intersecting planes in 3D that helps me resolve my response?

Code attempt for calculating highest volume between two (not working as it should):

functionThatDoesCollisionResponse
{
    [...]
    // Calculate size differences first
    for(int i = 0; i < normals.size(); i++) // Normals is vector filled with all intersected plane normals.
    {
        Vector oppNormal = normals[i].Negative();
        Plane pFace = this->GetPlaneFromNormal(player, oppNormal); // Returns plane with specified normal
        Plane oFace = this->GetPlaneFromNormal(object, normals[i]);
        sizeDifs.push_back(this->CalculateSizeDifference(pFace, oFace)); // Pushes differences of size in Vector for later calculation
    }

    // Don't take average but take highest intersected volume plane
    GLfloat min = 9999999.99f;
    Vector bestNormal;
    for(int i = 0; i < sizeDifs.size(); i++)
    {
        GLfloat opp = sizeDifs[i].x * sizeDifs[i].y * sizeDifs[i].z;
        if(opp < min)
        {
            min = opp;
            bestNormal = normals[i];
        }
    }
    [...]
}

Vector CollisionEngine::CalculateSizeDifference(Plane p1, Plane p2)
{
    GLfloat xDif = p1.topLeft.x - p2.topLeft.x;
    GLfloat yDif = p1.topLeft.y - p2.bottomLeft.y;
    GLfloat zDif = p1.topLeft.z - p2.bottomRight.z;
    return Vector(abs(xDif), abs(yDif), abs(zDif));
}

sentences:
Applying angular velocity distorts model I am calculating the orientation of a sphere through the following code

wV = new Vector3(0, pi/2, 0);
w = new Quaternion(wV, 0);
// o is the current Orientation
o.Normalize();
w = 0.5f * w * o;
// dt is the elapsed time since the last frame
o += w * dt;

However it seems that over time the sphere tends to become distorted and then shrink back to its original size. Is this due to the simplicity of the integration or am I doing some simple mistake?

sentences:
Keeping balance between widely different character classes So I've been theory-crafting an idea for a game I think would be interesting, but I'm trying to work out the kinks in my idea. Here's my dilemma:

Let's say a player can choose between two classes, being a foot soldier or piloting a large vehicle like a tank. To keep gameplay diverse, there needs to be some players as foot soldiers and some as tanks. In games such as BF4, the individual soldier has so many anti-vehicle weapons that vehicles are actually somewhat weak. Is there a good way to balance classes such that an endgame infantry unit is equal(not inferior or superior) to a vehicle such as a tank or ship?

I was also thinking of an AI squad mechanic, where the player can command a small number of AI foot soldiers, so this might be worked into the balancing. I'm just trying to think of a way to have all classes be appealing to the player.

sentences:
How do I work around the "You are missing the recommended JDK" error? After switching to 2019.4 LTS I got this error (using Windows 10)

You are missing the recommended JDK. Install the recommended version using Unity Hub.

I installed the JDK using Unity Hub many times now, still the same error.
Tho I don't think it's getting installed.
As you can see below, the "OpenJDK" checkbox remains blue no matter how many I try to install it.

When I tried downloading and installing the JDK (JDK 1.8.0_181) myself I get this error instead:

You are missing the recommended JDK, versions other than 1.8.0 are not officially supported.

sentences:
How can I add a sprite to gameobject to make the gameobject highlight? When I'm running the game and then moving the mouse cursor over the menu it's highlighting it with some blue color: In the screenshot the OPTIONS is highlight.

Now I want to use the same highlight sprite to highlight the word THE in white at the top in the screenshot but to make it highlight all the time without the mouse cursor.

I have New Text in the Hierarchy and in the Assets I have Select and Select is the sprite I want to highlight with the word THE:

I tried to add a Sprite Renderer component to the New Text but the New Text have already a Mesh Renderer so I can't add the Sprite Renderer.

sentences:
How to make a platformer character go DOWN a 315 degree slope? Alright, so I got this code I'm trying to write, but the player won't go down the slope, it goes down and up perfectly on the 45 degree slope, but the 315 degree one is a mess. it goes "up" the downward slope, get's stuck and some other stuff. Anyway here's the code:

//you're in a double for loop going through every tile in the map, the int's being used are x, and y

//check if the tile is a slope
if (lv.type[lv.tile[x, y]] == Tiles.SLOPE)
{
   //create a rectangle collision box
    Rectangle tileCol = new Rectangle(x * lv.tileSize, (y * lv.tileSize), lv.tileSize, lv.tileSize + 1);

    //if player collision "col" collides with "tileCol" and you haven't done this before this itteration (only happens once per full double loop)
    if (col.Intersects(tileCol) && !onSlope)
    {
        //get the angle of the tile
        float angle = lv.angle[lv.tile[x, y]];

        //get the x distance of how far away the player's right is inside the tile
        float dist = (col.X + col.Width) - tileCol.X;

        //constructs the opposite of a right triangle
        float opposite = (float)(Math.Tan(MathHelper.ToRadians(angle)) * (dist));

        if (angle < 90)
        {
            //if player's right is less then or equal to tile's right
            if (col.X + col.Width <= tileCol.X + tileCol.Width)
            {
                //place player on slope. this works properly
                pos.Y = tileCol.Y - opposite;
                //tell the program we don't wanna go through this again until the next full loop starts.
                onSlope = true;
            }
        }

        else if (angle > 90){
            if ((col.X + col.Width) >= tileCol.X)
            {
                //this is where the error is. the player goes "up" a slope that's 315 degrees, instead of down it.
                //how do I make the player go down the slope that's 315 degrees!?
                pos.Y = tileCol.Y + opposite;
                onSlope = true;
            }
        }
    }
}

currently using this code, it makes the player move in a 45 degree angle on the 315 degree blocks.

else if (angle > 90)
                            {

                                if (col.X >= tileCol.X)
                                {
                                    pos.Y = tileCol.Y + lv.tileSize + (dist * -1);

                                    onSlope = true;
                                }
                            }

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: Does opengl performs Visibilty algorithms based on z-index? Does OpenGL performs Visibilty algorithms based on z-index? Or we have to write our own algorithms. Mainly I'm referring to z-buffer algorithm. Is it in-built?

sentences:
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:
Why are setcolor and color not reset When I do a color exchange directly on the material in playmode, but then I go back to editmode, why do the settings still remain?
For example:
mymaterial.SetColor("_Color", blue);
or
mymaterial.color = blue;

sentences:
SpriteKit Obj-C – How to add a force on a node a certain distance according to screen size I have an SKSpriteNode that I'm trying to throw up to a certain point on the screen. I've tried applying an impulse and/or force according to the screen size, but that has strange results. I've also tried changing the sprite's velocity according to the screen size. Here's some code I tried.

- (void)createFlyingButton
{
    NSLog(@"Flying button created!");

    // Create the button.
    SKSpriteNode *button = [SKSpriteNode spriteNodeWithImageNamed:@"BlueButton"];
    button.name = @"BlueButton";
    button.size = _buttonSize;
    button.position = CGPointMake(randomInRange(self.size.width * 0.25, self.size.width * 0.75),
                                  -(_buttonSize.height * 3.0));
    button.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:_buttonSize.width * 0.5];
    button.physicsBody.collisionBitMask = 0.0;
    [self addChild:button];

    // Send it flying.
//    button.physicsBody.velocity = CGVectorMake(randomInRange(-self.size.width * 0.4, self.size.width * 0.4),
//                                               randomInRange((self.size.height * 1.6), self.size.height * 1.8));
//    [button runAction:[SKAction applyImpulse:CGVectorMake(randomInRange(-self.size.width * 0.1, self.size.width * 0.1),
//                                                          randomInRange((self.size.height * 0.8), self.size.height * 0.8))
//                                    duration:1.0]];

}

Any other suggestions?

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:
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:
Easy Method to Change Color on UI Elements This isn't a language-specific thing as far as I'm concerned.  I was wondering what may be a quick way to change the COLOR of a certain on-screen element such as a button and its associated text.

I would assume there is a trick to making a graphics engine so maybe individuals pixels or groups of sprites can have their colors easily shifted.  A lot of game interface buttons and such have this so you know when an event like a click has occurred.

Any pseudo code would be helpful and I am working in Android (not XML fluff), but again, this probably is not a very specific question, just an inquiry on how to go about this.

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:
LibGDX Z index for groups Have three groups, A, B and C.

Let B and C be children of A.

Now set

B.setZIndex(3)
C.setZIndex(2)

Why is C drawn over B, if B has a greater Z index?

If you do this:

C.setZIndex(2)
B.setZIndex(3)

It works. However, I want to set B's index before I set C's. So, what's up?

(I know that C is drawn over B because each group contains an image)

sentences:
Is Unity + Scala.js possible or even makes sense? I never actually used Unity (yet) and I have no possibility to check anything now, but I'm thinking about Unity for my project. I actually know C# (and hate it for some unimportant reason) and I think I'm able to learn JS or UnityScript, but I just want to use a language I know and love - Scala.

There is Scala.js - a tool that compiles Scala code to JS code. And i'm thinking: is it possible to write Scala code in some IDE (Intellij), compile it to JS code and load into Unity? And if it IS possible, what difficulties may I encounter? Does this idea even makes sense, or should I forget it, use C#/Learn JS/UnityScript or just search some Scala game frameworks?

sentences:
Changing the rendering resolution while maintaining the design layout I would like to increase the FPS of my project.

Currently I would like to try reducing the resolution at which the scenes are rendered.

Let's say I never want to draw more than 1280*720. What ever the real resolution is. How should I proceed?

I tried pEGLView->setFrameSize(1280, 720); but only reduces the displayed size of the frame on screen (boxing).

In my activity I tried setting the size of the "surface" but this seems to completely break the layout (as defined by setDesignResolutionSize).

@Override
public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView surfaceView = new Cocos2dxGLSurfaceView(this);
    surfaceView.getHolder().setFixedSize(1280, 720);
    return surfaceView;
}

Is there a way to simply set the scene resolution and display the result full screen?

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:
looking for a system for writing branching dialog I'm creating an HTML5 RPG and need to write NPC dialog. In my beta, I wrote the dialog in spreadsheets and assigned lines to NPC by ID. Branching required writing a complicated flag system. It was impossible for anyone to read through it and understand what was going on.

I'm looking for a better alternative to writing branching story dialog. The dialog will require some degree of in-text markdown support (so I can be sure which text to highlight with CSS). In the spreadsheet, that looked like

  "Hello, my name is [name: John]. Welcome to [location: Aragon]. Please fetch the [keyword: sword]"

Would would appear as:

  "Hello, my name is John. Welcome to Aragon. Please fetch the sword"

These would be higlighted/handled differently in code.

sentences:
How to generate random points on the surface of a quadrilateral Alright, I'm sure there has to be a simple way to do this but it eludes me at the moment.

I want to be able to generate random points on the surface of a quadrilateral in 3D space. (Defined simply as four points) What is the best way to go about doing this?

If the quad is a rectangle, this is trivial to do with random interpolation between points. However, this won't work for me since my quads aren't guaranteed to have rectangular properties.

sentences:
Map building - Tower Defense Before diving too deep into my question, let it be known that I am learning as far as java script goes and figured a simple Tower Defense game would be an excellent way to learn things.

So I have found a simple background image with a path drawn on it and my question is how would I go about building a path so that I can animate my objects.
Would I have to take the image and overlay a grid system, or can I store the path in some sort of array and have my objects move across it?

Here is the background image:

sentences:
moving first person camera with the mouse on right click I am new to game development and I am trying to get the game input working. I have successfully got all the movement keys for walking/running/looking around working; however, I am having a terrible time with the mouse lol.

Basically, I am trying to move the camera with the mouse when the user holds the right mouse button down and drags. I want to rotate the camera in that direction. So dragging to the right rotates right, dragging right/down will rotate right/down, etc.. I do not want the cursor to stay in the middle of the screen (this is not a FPS). I want the cursor to stay in the location it was in when the user first right clicked.

I am guessing this is probably not nearly as complicated as I am making it but I cant seem to find anything that has helped thus far. I have found several tutorials/excerpts on it but I havent got mine working yet. Below is my code for the MouseMove event (C# - I am using SharpDX framework).

            if (Input.Mouse.IsRightMouseDown &&
                Input.Mouse.PositionHasChanged(new Vector2(mouseEventArgs.X, mouseEventArgs.Y)))
            {
                var deltaY = mouseEventArgs.Y - Input.Mouse.OriginalRightMousePosition.Y;
                var deltaX = mouseEventArgs.X - Input.Mouse.OriginalRightMousePosition.X;
                var angle = (float)Math.Atan2(deltaY, deltaX);

                Camera.RotationY -= (float)Math.Sin(angle) * Global.MouseRotationSpeed;
                Camera.RotationX -= (float)Math.Cos(angle) * Global.MouseRotationSpeed;

                Input.Mouse.ResetMousePositionToOriginal();
            }

I would appreciate any help/advice I can get!! :)

Thanks in advance!!!

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:
Can a block-chain with embedded shared content stop cheating? I want to make a game where users create their content and embed it in a block-chain. For example, they have a small x,y grid. In the grid they place objects... After the grid is made they share it via block-chain with others. The other players then experience this content and try to pass it unfairly. I feel like there is a way in the block chain to stop them via agreement or algorithm?
Is this possible?

sentences:
How to save a global reference of an instantiated gameobject? In my game, when I instantiate a particular prefab, I need to show a GUI window, then let player do some actions, finally close that window and update the caller GameObject with the info inserted from user.

So my question is: how to save the reference of the GameObject caller to update it at the end of the user action.

Consider that I call some sub functions and I don't want to pass a GameObject through all functions.

Is there a way to save a gameObject reference in a global variable ? I'm using a static class for that purpose.

sentences: Does Amazon Lumberyard support AR yet? I would like some help regarding whether Amazon Lumberyard supports augmented reality (AR) or not. It clearly mentions VR is supported but nothing about AR support. It looks as if we just have to attach an AR plugin on engines like unreal, unity, etc. So will it work here?

sentences:
Find new position of rotated by 10 degrees line I have a line that goes to x (x1) of 300, and then I rotate the line by -10 degrees. How can I get the new x (x0) of the rotated line?

Here's a picture to show what I mean:

Are there any books that would help me learn this stuff?

sentences:
Someone downloaded my game but it failed on Game Start due to code that doesnt exist As stated in the title, they get the following error:

 ############################################################################################
 FATAL ERROR in
 action number 1
 of Other Event: Game Start
 for object obj_music_controller:

 ds_map_find_value argument 1 incorrect type (undefined) expecting a Number (YYGI32)
 at gml_Script_scr_checkLastLoggedInJson
 ############################################################################################
 --------------------------------------------------------------------------------------------
 stack frame is
 gml_Script_scr_checkLastLoggedInJson (line -1)
 gml_Object_obj_music_controller_Other_2

The function ds_map_find_value() is not being called in the script scr_checkLastLoggedInJson(). (Even if it was, how could it be happening at line -1?)

Nor is it called in the Game Start event of the obj_music_controller object.
I also checked every use of ds_map_find_value() in the entire game and they are all fine.

Furthermore, this is only happening with 1 person. And they have tried uninstalling it and re-downloading. Even after i uploaded a new version of the game, this still happened to them and only them.

EDIT: scr_checkLastLoggedInJson()

var result = false;

if (file_exists("saveJson.json"))
{
    var saveJson = scr_loadJSONFromFile("saveJson.json");//ds_map
    var saveJsonNames = saveJson[? "Names"]; //ds_list
    var userSaveData = noone;
    var saveJsonSaves = noone;

    if (ds_list_size(saveJsonNames) == 1) //If there is only 1 user, that is the one to load.
    {
        result = true;
        var username = saveJsonNames[| 0];
        global.username = username;
    }
    else
    {
        //Find the user who was last logged in and assign them to global.username.
        for (var i = 0; i < ds_list_size(saveJsonNames); i++)
        {
            var username = saveJsonNames[| i];
            saveJsonSaves = saveJson[? "Saves"];//ds_map

            if (!is_undefined(username))
            {
                userSaveData = saveJsonSaves[? username]; //ds_map

                if (userSaveData[? "Last Logged In"])
                {
                    result = true;
                    global.username = username;
                    ds_map_destroy(userSaveData);
                    ds_map_destroy(saveJsonSaves);
                    break;
                }
            }
        }
    }

    if  (ds_exists(userSaveData, ds_type_map))
    {
        ds_map_destroy(userSaveData);
    }

    if  (ds_exists(saveJsonSaves, ds_type_map))
    {
        ds_map_destroy(saveJsonSaves);
    }

    ds_list_destroy(saveJsonNames);
    ds_map_destroy(saveJson);
}

return result;

sentences:
Unity : shader that uses mesh.uv to tile texture atlas and mesh.uv2 to tile light atlas I'm using a texture atlas and a light atlas to tile a mesh. I have the texture atlas working fine. I can apply textures and create a sort of tile map on my coded mesh. At the moment I'm using the built-in Self-Illum Diffuse shader.

The problem with this shader (and all others I've tried) is that it uses the same UV map for both the texture and the illumination, the result is, ie, that all grass tiles appear with the same level of light.

What I would like to do is apply two different UV maps: UV to tile the textures, and UV2 to tile the lighting. This would allow me to tell Unity which tiles should be lit up and which should not. The end result I'm looking for is that I will be able to display cubes that are close to a light source texture bright, and those further away darker.

I've attached a very ugly drawing of what I hope to achieve (I've drawn a 2D map but I'm actually working with a 3D mesh, IE: a deformed plain, and the Light Atlas of course has a Alpha layer).

I've got the UV maps nailed down and applied to the mesh. What I'm looking for is a way to tell a shader to read the two UV maps separately.

I would expect what I'm doing to be quite common and am really surprised that Unity doesn't have this built-in somewhere.

sentences:
What to use instead of UNet? If you look at this Link you'll see UNet is deprecated and will be removed in the future.

I'm developing a mobile multiplayer game, i've red official advise about it but they say "You can publish it with 2018.4 (LTS)" and I can't use 2018.4 version because in my project i use LWRP which is not in the 2018.X versions.

I've found the alpha version of the new system right here

My questions are:

1- Should i use the alpha version of the new system? And can i publish my game with it?

2- Should i wait for the new system came out? (I can't wait for months)

3- Should i try to use other third party systems like Photon?

Or is there any way to publish my game with nice multiplayer system?

Note: I can't pay for multiplayer matchmaking system. Because of that i want to make Hosting multiplayer game.

sentences:
How can I implement a side scrolling seamless fog shader? I've run into a problem trying to code a 2d game. The way I've set up the game is that you run through underground dungeons and fight enemies, for ambiance I've added a smoke/fog shader to superimpose over the dungeon backdrop. However, the noise/fog isn't seamless. As in, the fog is always the same even when moving through the map, it doesn't move with the player/camera.

How do I make it so the fog is generated whenever the camera moves sideways/upwards while still being seamless, as in fitting in with the fog from before moving the camera?

For example, when I move right, the fog background should move left, instead of being the same backdrop anywhere I am on the map.

The shader I've set up is based on this one from Morgan McGuire/patriciogv:

// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;

float random (in vec2 _st) {
    return fract(sin(dot(_st.xy,
                         vec2(12.9898,78.233)))*
        43758.5453123);
}

// Based on Morgan McGuire @morgan3d
// https://www.shadertoy.com/view/4dS3Wd
float noise (in vec2 _st) {
    vec2 i = floor(_st);
    vec2 f = fract(_st);

    // Four corners in 2D of a tile
    float a = random(i);
    float b = random(i + vec2(1.0, 0.0));
    float c = random(i + vec2(0.0, 1.0));
    float d = random(i + vec2(1.0, 1.0));

    vec2 u = f * f * (3.0 - 2.0 * f);

    return mix(a, b, u.x) +
            (c - a)* u.y * (1.0 - u.x) +
            (d - b) * u.x * u.y;
}

#define NUM_OCTAVES 5

float fbm ( in vec2 _st) {
    float v = 0.0;
    float a = 0.5;
    vec2 shift = vec2(100.0);
    // Rotate to reduce axial bias
    mat2 rot = mat2(cos(0.5), sin(0.5),
                    -sin(0.5), cos(0.50));
    for (int i = 0; i < NUM_OCTAVES; ++i) {
        v += a * noise(_st);
        _st = rot * _st * 2.0 + shift;
        a *= 0.5;
    }
    return v;
}

void main() {
    vec2 st = gl_FragCoord.xy/u_resolution.xy*3.;
    // st += st * abs(sin(u_time*0.1)*3.0);
    vec3 color = vec3(0.0);

    vec2 q = vec2(0.);
    q.x = fbm( st + 0.00*u_time);
    q.y = fbm( st + vec2(1.0));

    vec2 r = vec2(0.);
    r.x = fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*u_time );
    r.y = fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*u_time);

    float f = fbm(st+r);

    color = mix(vec3(0.101961,0.619608,0.666667),
                vec3(0.666667,0.666667,0.498039),
                clamp((f*f)*4.0,0.0,1.0));

    color = mix(color,
                vec3(0,0,0.164706),
                clamp(length(q),0.0,1.0));

    color = mix(color,
                vec3(0.666667,1,1),
                clamp(length(r.x),0.0,1.0));

    gl_FragColor = vec4((f*f*f+.6*f*f+.5*f)*color,1.);
}

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:
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:
sound stops after scene reloads in unity3d I'm recently facing problem regarding the inclusion of sounds in my game. Although i have used the technique of DontDestroyOnLoad() for background sounds and that work perfectly fine. But for the casual sound, it is creating problem that it stops during scene reloads. I have my script below that contains AudioClips and AudioSources and that script is attached to an empty game object, and calling that script in different scripts for the playback of the sounds.

AudioScript.cs

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

public class AudioScript : MonoBehaviour {

    public AudioClip pinshit;

    public AudioClip rowlingball;

    public AudioSource rowling;

    public AudioSource hit;

    public AudioClip cheer;

    public AudioClip strike;

    public Text counttext;

    public AudioClip spare;

    public AudioClip sorrow;

    public AudioClip winaudio;

    GameObject[] music;

    // Use this for initialization
    void Start () {

        rowling = GetComponent<AudioSource>();

        music = GameObject.FindGameObjectsWithTag("class");

        if (music.Length == 1)
        {

        }
        else
        {
            for (int i = 1; i < music.Length; i++)
            {
                Destroy(music[i]);
            }
        }

    }

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

    }

    private void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
    }
}

To play sound on different actions routines

sorrow.clip = GameObject.FindWithTag("class").GetComponent<AudioScript>().sorrow;

                sorrow.Play();

                sorrow.volume = 1;

sentences:
How can I build an array of coordinates of a truncated icosahedron's faces? I can easily get a list of coordinates of all the vertices—the Wikipedia page has formulae and this page has a list of them, but that doesn't tell me which ones are part of which face.

What I'd like is to create an array of 32 faces, and for each one have:

The 3-coordinate of the center of the face
The rotation of the face about the center point
Whether it's a pentagon or a hexagon

How can I generate that data?

sentences:
What are projection independent ways of determining whether a normal is facing the viewer? A position v and normal n are given in world coordinates. Also there is a view matrix V for world-eye coordinate transition and a projection matrix P for eye-ndc transition. I would like to determine, whether the normal is facing the viewer.

If we assume that P is a perspective matrix, we can compare the normal direction with the direction to the viewer, both in eye-space. Note that the approach won't work for an orthographic projection, because there is no well defined eye position. But if P is orthographic, we only need to check the Z coordinate of n in eye space. Nevertheless, I'm seeking a solution that does not make assumption about what projection type we're using.

One way of achieving this is to compute the inverse P' of P and retrieve the viewing direction as a vector spanned between P' [u.x, u.y, -1] and P' [u.x, u.y, 1], where u is v transformed to ndc. The drawback here is that it requires inverting a matrix and in my case also passing it to the shader.

Another solution would be to construct a small triangle around v within the normal plane of n, and check what's its winding direction in the ndc. The problem with this approach is that it's computationally heavy and it's still seems to me more like a hack than a proper solution.

I am not very satisfied with these two solutions. Do you have any other ideas? Am I missing something very simple?

EDIT:
Since it seems unclear why the dot(v - eye, n) < 0 is not satisfactory in my case, I post an exaple showing the difference between perspective and ortho projection for this particular problem.

As you can see, the vector is facing slightly away in the perspective projection, but clearly towards in the orthographic projection. More specifically, a face having that particular normal would be culled in perspective, but not in ortho.

sentences:
Unity (C#): How can I create dialogue to be used in my game? (also critique my system?) I've created my own system for handling dialogue. There's a class for each 'node' or part of dialogue. It contains the following variables: identifier (identifiers are unique for each NPC, but not globally, ie "1", "2"), a text variable, a list of strings (which are the option button values), another list of strings (which contains option identifiers), and a string which is used for passing custom functions through. A collection of these Dialogue classes are made, and then stored in a dictionary, with the key of each being the identifier.

public string identifier;
public string text;
public List<string> options;
public List<string> optionIdentifiers;
public string onCloseFunction;

public Dialogue(string identifier, string text, List<string> options, List<string> optionIdentifiers, string onCloseFunction = "") {
    this.identifier = identifier;
    this.text = text;
    this.options = options;
    this.optionIdentifiers = optionIdentifiers;
    this.onCloseFunction = onCloseFunction;
}

At the start, the dialogue with identifier 1 will be chosen, and the text displayed, with each of the buttons.

If the first option is chosen, that is index 0 in the options list. The index selected is used to get the correct identifier from the identifier list, which will return "2_1". This is then used to find the next dialogue.

The system fortunately works, however I'm wondering if I've overcomplicated this, and if there's a simpler way to do this.

Building further on this, it isn't easy to sort out the conversations to appear in. I have made the class 'Dialogue' serializable, so the properties are displayed in the unity window. I've made a public array of dialogue, which then is turned into a dictionary with the corresponding key identifiers.

public Dialogue[] dialogueList;
public DialogueLibrary dialogueLibrary;

void Awake() {
    Dictionary<string, Dialogue> dict = new Dictionary<string, Dialogue> ();
    for(int i = 0; i < dialogueList.Length; i++)                // Add all dialogue from inspector into dictionary
        dict.Add(dialogueList[i].identifier, dialogueList[i]);
    dialogueLibrary = new DialogueLibrary (dict);
}

This allows me to add dialogue as such:

The biggest problem I have with this, is the fact that it's just... not very nice to deal with. For example, if there were 30 pieces of dialogue, and I wanted to add another between 2 and 3, I would have to either increase every identifier afterwards, or use something like 2a for an identifier. Furthermore, it would be a lot better if I could read the dialogue list from an XML file.

What I'm stuck with is how I can create this XML file. I need some software that can simply create the conversations and export them in XML. Honestly I'm not sure how to go about this. Is there any software which exists already which could do something like this, or should I create my own in Visual Studio? I'm not sure how I'd go about creating something like this in visual studio. Ideally the software would be similar to mind maps, where the node of text is the dialogue text, and the connecting arrows have text on, and are equivalent to the options. Identifiers should ideally handle themselves.

Can anyone give me any pointers in what direction I should take, and if the direction is creating my own program, could anyone suggest any resources which would help me?

I understand this is a long message and I'm asking a lot, but any help, comments or even constructive criticism on my system would be greatly appreciated. Thanks in advance.

sentences:
unity game engine - should I be using a di framework / ioc container Is it worthwhile for a solo dev to take up the widely recommended practice of using a dependency injection framework within the unity game engine? I have seen reason for concern regarding the clash of development methodologies that seems to have put some people off. If you would recommend against the practice, what would be a better substitute to avoid rigid bindings and singletons.

The focus of this question is primarily on the supposed clash with the unity way of things, which has apparently made a lot of people feel like they are spending more of their time fighting their tools instead of making games. I don't want to spend all my time worrying about nice code and have no game at the end of it, so advice and answers are appreciated.

So far my thinking is that it might be worthwhile for larger projects/ long term projects or projects with a team of more than a few people, but for small projects, time limited projects and indie/hobbyist projects its probably not a worthwhile investment of effort. Instead so far I'm thinking a minimum of tdd but then whatever you feel comfortable with, trying to maintain some of the most important principles in programming, such as yagni, kiss and srp. I watched a talk by johnathon blow where he essentially says to keep things simple and don't overthink them.

Am I mistaken in my assesment? Am I attributing more effort to working with di frameworks than is fair? Is it skewed by my inexperience? If you work with di and you find it actually speeds up your workflow while at the same time gaining the advantages di offers, please leave a comment or answer as you are someone I would love to hear from.

sentences:
Simple GLSL example to render a 2d textured quad? I would really love to add shader support in my game , although i can't seem to find a SIMPLE example on how to setup opengl for using shaders.

So i would like to ask : Does anyone knows if there are any SIMPLE examples for beginners ? (ie Rendering a simple 2d quad or something like that)

sentences:
Why can't I access LocalPlayer at runtime in a starterGui script, but I can in the console at runtime? In
StartGui -> ScreenGui -> TextLabel -> Banner (a script)

I've got
local ever = false
while (not ever) do
 wait(1)
    local player = game:GetService("Players").LocalPlayer
    print(player)
end

When I Play, I see nil every second in the console.  But if I type = game:GetService("Players").LocalPlayer into the console, I see the name of my character.
What subtle thing am I missing?

sentences:
Proper Angled-Top Down Wall Collision? Sorry about the vague title, it's kind of hard to say what I want to do in a few words.

In my top-down game, I'm having a problem implementing proper collision for walls facing north (that is, you can actually see the surface of the wall, as opposed to the other directions, where you can see just the top).

I have a proper bounding box that detects the alpha values of the sprite, and generates a proper bounding box around only the visible pixels, like so:

http://a.pomf.se/kfrxtm.mp4

However, when dealing with walls, I run into a problem.
With my current implementation, there are two options I have:

Set the walls so that the player can pass through them. This leads to the player walking "on" the walls, like so:

Set the walls so that the player can not pass through them. This leads to the player's head colliding on the bottom of the wall, like so:

In the image, the player can not move forward any more.

My solution to this, would be to place the bounding box around the player's feet. However, this would interfere with my alpha-based system, and other collision systems (enemies hitting the player, etc.)

How should I approach this?

If my question is unclear, I can provide more images and descriptions of what I'm trying to achieve.

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:
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:
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:
Applying MVC in Game Development Suppose one is working on a game which has more than one component of code where the data, view, and logic is disjoint from the workings of another component of code (i.e. all games have a main menu and the game itself, with their looks, logic, and data being independent). How best should one lay an application out?

I see at least two options:

Top-level code creates model, view, and controller objects which then each have fields of each area of the application. For example, the model object may have a menuData field and a gameData field. Each of the view and controller would also have something similar. Additionally, the main controller would have access to the main view and main model.
Top-level code creates an object for each area of the code (i.e. menu and game), and then each of these has their own model, view, and controller.

Are either of these the best way to go about this? Is there a more common approach than MVC?

sentences:
Unrealscript tutorials for self-made maps I've been looking up tutorials for UnrealScript, but I'm very confused by what I find.

All tutorials seem to use Visual Studio and nFringe for the coding, plus the UDK editor for the maps.

Every tutorial I've come across seems to assume I want to either modify UT2004 or edit physics. This is not the case. I plan on making some custom maps in UDK with no textures or anything, and script some events for those maps. Lights turning on and off. Doors opening and closing. Walls shifting. That kind of stuff.

As such, the tutorials I've found are confusing and take up a lot of time and configuration I don't understand. Can someone get me on the right path for what I'm trying to do here?

sentences:
How do I play multiple animations at once with an MonoGame skinned mesh? I am working with the SkinnedMesh from this tutorial.
I am at the point where I want to let my character run (which already works), but when I press the punch key on my keyboard, I only want the upper half of the body to play the punching animations while the lower part of the model continues running. What would I need to change in this example to accomplish this effect?

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:
How can I have an RPG character redirect / glance off stationary objects and keep going? I am attempting to create an effect in a game that is identical to the effect I've shown in the attached gifs. Essentially, the character, when they are running or walking and hit an object that is stationary, if it's possible, (meaning there is a valid path for continuation) they should glance off the side of said object and keep going.

In this first GIF I am only holding the UP directional key, notice how the character glances to their right:

In this second GIF I am only holding the DOWN directional key, notice how the character glances to their left:

In this third GIF I am only holding the UP directional key, notice how the character glance first to their left and then to their right:

Could someone describe the process that I would need to follow in order to do this type of collision detection into redirection?

sentences:
How to recalculate AABB after rotation? I'm facing a problem trying to calculate the AABB on my models after rotation is applied. The rotation is not applied on the vertex positions directly, but in a seperate rotation matrix - just multiplied with the projection matrix and set as uniform. Currently I'm calculating the min/max of the vertexes on all three axes (x, y, z) to calculate the AABB. This works well, as long as the model is unrotated.

AABB calculateAabb() {
    glm::vec3 center, extend;
    glm::vec3 min, max;
    for (size_t i = 0; i < getVertexCount(); ++i) {
      if (positions[i * 3] < min.x){
        min.x = positions[i * 3];
      }
      if (positions[i * 3 + 1] < min.y) {
        min.y = positions[i * 3 + 1];
      }
      if (positions[i * 3 + 2] < min.z) {
        min.z = positions[i * 3 + 2];
      }
      if (positions[i * 3] > max.x) {
        max.x = positions[i * 3];
      }
      if (positions[i * 3 + 1] > max.y) {
        max.y = positions[i * 3 + 1];
      }
      if (positions[i * 3 + 2] > max.z) {
        max.z = positions[i * 3 + 2];
      }
    }
    extend = (max - min) * 0.5f;
    center = min + extend;
    return AABB(center, extend);
  }

The std::vector positions[] contains all vertexes in the order x, y, z - getVertexCount() returns positions.size()/3. My rotation matrix is described by a single angle on the y axis glm::eulerAngleY(glm::radians(angle));.

My question is: is there any way to calculate the AABB for the rotated model without applying the rotation matrix to all the vertexes individually? How can I get min/max values on the axes from a rotated coordinate system?

sentences:
Make transform.up face toward velocity while preventing transform.forward from rolling? I have been working on a personal project that is suppose to mimic Anthem. I am using a state machine for the character controller that I intend to integrate with the Unity's Animation state machine.
I am calculating a new velocity that makes the player follow the mouse when flying, and I am making transform.up = Velocity so that the player appears to be going head first towards its velocity.
The issue is that when you start to rotate in a circular way on the xz plane, the player will start to roll and its transform.forward moves from facing towards the ground (which is what I want) to facing the sky.

The core code is in public override Update():
public class s_MechFlyt : MechStates{

  float flySpeedPercentage;

  public s_MechFlyt(in MechController Master) : base(Master){
    flySpeedPercentage = 2.5f;
  }

  public override void Update(){
    if (_Master.SprintButtonHeld){

      Quaternion Rot = Quaternion.Euler(-_Master.DMouse.y , _Master.DMouse.x , 0);

      _Master.Velocity = Rot * Vector3.forward * _Master.Stats.Speed * flySpeedPercentage;
      Vector3 Rotation = _Master.Velocity;**
      //Rotation.y = Mathf.Clamp(Rotation.z, 0, 50);
      _Master.transform.up = Vector3.Normalize(Rotation);
      //_Master.transform.rotation = Rot;

      //_Master.transform.rotation = Quaternion.RotateTowards(_Master.transform.up, _Master.Velocity, 5);

      _Master._Controller.Move(_Master.Velocity * Time.deltaTime);

      if (_Master.JumpButtonHeld){
        _Master.ChangeStates("hover");
        _Master.transform.up = Vector3.up;
      }

    }
    else{
      _Master.ChangeStates("fall");
      _Master.transform.up = Vector3.up;
    }
  }

  public override void EnterState(){
    _Master.CamController.ChangeStates("flying");
  }
}

sentences: Unity - Lots of 3d models I have about 60 3D models with each model being about 4mb in size.If i import them all to unity, my app will be about 240mb in size!.My app requires internet access so should i just upload my models to a server or something?

sentences:
How to achieve a Neon-Light effect? I'm wondering how to achieve a neon-light type effect. For example, in Pac-Man Chamipnship Edition:

Or in Geometry Wars:

Is that a Bloom Effect? Or what techniques would I have to look for?

sentences:
Developing Kinect game for Xbox360? Possible Duplicate:
  Can you access Kinect motion sensing from XNA?

bunch of questions:

Is it possible for me to create a Kinect application using XNA and deploy it to Xbox360 platform?
What should I use, will Kinect SDK for Windows be okay for this task?
What about licenses, is it free to use or should I pay for licenses?

Thanks for any answer or url...

sentences:
Circle to Circle collision - bad accuracy Circle1 (blue) is moving and its X and Y bounds are the screen (meaning it bounces off the walls).

Circle2 (black) is stationary. Circle1(blue) is supposed to bounce off of Circle2 without intersecting, regardless of the collision point. As you can see on the image below, the blue circle bounces off properly only at the blue arrow spots, otherwise(red arrows), blue ball goes INSIDE the black circle, gets stuck in there for a second and then gets out.

I have no idea why this is happening. Please take a look at my code and help me out.
Thanks.

public void handle(ActionEvent t) {
                if (counter++ % 5 == 0) {
                    // Moves the ball depending on the values of X and Y
                    circle.setLayoutX(circle.getLayoutX() + X); //velocity
                    circle.setLayoutY(circle.getLayoutY() + Y); //velocity

// Bounce off the walls (working perfectly)
                    final Bounds bounds = canvas.getBoundsInLocal();
                    boolean leftWall = circle.getLayoutX() <= (bounds.getMinX() + circle.getRadius());
                    boolean topWall = circle.getLayoutY() <= (bounds.getMinY() + circle.getRadius());
                    boolean rightWall = circle.getLayoutX() >= (bounds.getMaxX() - circle.getRadius());
                    boolean bottomWall = circle.getLayoutY() >= (bounds.getMaxY() - circle.getRadius());

//THE PROBLEM IS HERE

//Collision between circle1 and circle2 (stationary black circle.
                    double dx = circle.getLayoutX() - circle2.getLayoutX();
                    double dy = circle.getLayoutY() - circle2.getLayoutY();
                    double radii = circle.getRadius() + circle2.getRadius();

                    if ( (dx * dx) + (dy * dy) <= radii * radii) {
                        X = X * -1; //X gets inverted to change direction

                    }

 //The code below is working perfectly.
                    // If the bottom or top wall has been touched, the ball reverses direction.
                    if (bottomWall || topWall) {

                        Y = Y * -1;
                        //circle.setLayoutY(circle.getLayoutY() - 50); - Wasn't working. Had to create X and Y to fix the problem.

                    }
                    // If the left or right wall has been touched, the ball reverses direction.
                    if (leftWall || rightWall) {
                        X = X * -1;
                    }
                }
            }

        }));

        loop.setCycleCount(Timeline.INDEFINITE);
        loop.play();
    }

P.S. Apologies for the amazing paint skills :D

sentences:
How can I move the camera to create a parallax effect? Right now I am making an application which can be described as model viewer for iPad Pro. The client wants to have an orbiting camera around the object and in addition he wants to have a parallax effect similar to iPhone 3D wallpapers which will is based of of tilt of the tablet.

My problem right now is that I am not really sure how to calculate the parallax effect and how to rotate the camera (or model) to create the 3D effect. Can you give me an idea how to do this ?

Thank you

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:
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:
Is it possible to use DirectX in pure C program? I want to try something simple with Direct Sound. Just want to know if it's possible.

Or maybe I need some other API?

sentences:
Moving a game object along a 2d vector by knowing the Rotation in degrees (Unity) I am hoping one of you fine fellows can help me again.
Basically I have been making a game like Asteroids in Unity. But its in a 3d world space (pretty much not relevant except I am using X and Z axes, and the rotation angle is on the Y axis).

When the user presses "W" this adds some power towards the thrust. It also records the objects current rotation in transform.eulerAngles.
(i've verified that the angle of y is correct. So a value of 90 is showing when my ship is facing right).

I have used Mathf.Cos/Sin and that angle value to move the object along X,Z axes.

But for some reason it isnt moving in the same direction as it should. -I tried it with some offsets like thrustAngle - 45 (or 90 etc) and it doesnt adjust it as expected. (reducing it be 45 seems to have a bigger impact than expected for example).

Here is the lines of code, have I got the Cos Sin part incorrect?

    void HandleInput(){
    // activate weapon
    if (Input.GetKey(KeyCode.Space))
    {
        FireWeapon();
    }
    // Rotate left
    if (Input.GetKey(KeyCode.A))
    {
        transform.Rotate(0, -rotationSpeed * Time.deltaTime, 0);
    }
    // Rotate right
    if (Input.GetKey(KeyCode.D))
    {
        transform.Rotate(0, rotationSpeed * Time.deltaTime, 0);
    }
    // activate thrusters
    if (Input.GetKey(KeyCode.W))
    {
        thrustAngle = transform.eulerAngles.y -90;
        if (currentThrust < maxThrust)
        {
            currentThrust += accel;
        }
    }
    else
    {
        if (currentThrust > 0f)
        {
            currentThrust -= thrustDecay;
        }
    }
    if (Input.GetKey(KeyCode.S))
    {
        if (currentThrust > 0)
        {
            currentThrust -= decelThrust;
        }
    }

    transform.position += new Vector3(Mathf.Cos(thrustAngle), 0, Mathf.Sin(thrustAngle)) * currentThrust * Time.deltaTime;
    Debug.Log("angle: " + thrustAngle);

    if (currentThrust < 0f)
    {
        currentThrust = 0f;
    }

}

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:
How can I convert a 3ds Max .max to a Cinema 4D .c4d and maintain the animation? I have recently purchased this asset from the3dstudio.com:

http://www.the3dstudio.com/product_details.aspx?id_product=193089

It has a corrupt .3ds file available, and a .max (as well as what appears to be a broken .dfx and a textureless and animation-less .obj).

I wrote the site administrator, who attempted to make me a new .3ds file from his master copy (I'm assuming the working .max file) but said:

"The .3ds export doesn't seem to be completed so normally we would just re-export it but I can't get a good export on this model. Only the low-poly control mesh wants to export so I emailed the author to see if they can get us a better file and will let you know as soon as they reply.

"With any non-max format you will not have any rigging in the model as common formats (3ds, dxf, obj, etc) do not support things like rigging (which are program specific) so any export to 3DS (and thus C4D) would just be the geometry, textures, and basic materials."

So it was my understanding based on my very limited knowledge and this e-mail I got that none of the formats that I'd be able to get into Cinema 4D would be able to carry animation data. Then I saw this Elance job posting:

http://www.elance.com/j/convert-3d-studio-max-animation-cinema-4d/19612175/

Now obviously that's not, like, internet canon: I realize just because there was a listing on some site somewhere that made it seem like it was possible doesn't make it true. But it looks like that team in India was willing to do it for sixty bucks, which makes it hard to believe it could be that in-depth of a process. But maybe that's my naïveté about either 3D or American to Indian currency conversion rates or both.

So, is this possible?

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: Angle between two points I have a character who walks to random points in my room in Unity. The problem is he always faces one direction, I want to write in C# a piece of code that will get the direction the character is currently facing and the position of the target, then works out the angle between them to turn the character that amount. I have tried the LookAt function but that makes the character walk in an arc shape towards the target which looks very unnatural as it constantly looks at the target.

sentences:
Unity3d Sprite Mask Nonexistent in Build I am developing a 2D game which uses sprite masks to limit the player's information to a circle around them. The feature works perfectly in the Unity Editor. It can be disabled and reenabled, have the shape of the mask itself change, and more.

However, whenever I build the project and run the executible the screen is blank. If I disable the sprite masks altogether, the sprites are all visible. I have debugged Unity3d builds before, but that was specifically looking at variables as they changed during the execution of the program.

Does anyone have any specific knowledge related to sprite masks or have any idea why this would occur? I can provide more information if necessary. My current thought is that the sprite mask is masking everything for some reason. It's weird to me though that it would only break in the build.

All help is appreciated.

sentences:
Distributing damage across units in an army I'm working on a game similar to the web game Utopia, insofar as players have a number of units with different values for attack and defense.

Question: how do I distribute damage across units when a conflict plays out?

Let's say I have two units:

Infantry: 3 attack, 3 defense
Cavalry: 5 attack, 1 defense

Let's say the player has 100 infantry (300 attack, 300 defense) and 50 cavalry (250 attack, 50 defense); the player now gets hit with an attack of 100 points of damage.

How do I resolve this in a way that doesn't force players to understand damage and micro-optimize, also given that I'm not going to store individual units' health values after the conflict?

If I distribute damage to weakest units first, 33 infantry will die; but players will spam cavalry and keep a small number of "fodder" infantry around to absorb damage.
If I distribute damage to strongest units first, 50 cavalry die; but players will spam infantry, thinking that stronger units are "not worth it" because they always die.
If I distribute damage randomly (eg. some infantry get 1 damage, some get 2, some get 3 and die), I will likely end up with players thinking that conflict is not effective, because a number of units took damage but didn't die (and I don't keep track of damaged units -- they heal afterward).

Is there a distribution algorithm I can use that doesn't have any of these side-effects and appears "fair" to the player? If not, how can I make this make sense so players understand how this should work, without me hindering certain types of strategies?

I wrote an answer to a question here that looks similar, but I explicitly didn't tackle the problem of fairly distributing damage without sabotaging different strategies.

sentences:
A Quick HLSL Question (How to modify some HLSL code) Thanks for wanting to help!

I'm trying to create a circular, repeating ring (that moves outward) on a texture.  I've achieved this, to a degree, with the following code:

float distance = length(inTex - in_ShipCenter);
float time = in_Time;

///* Simple distance/time combination */
float2 colorIndex = float2(distance - time, .3);

float4 shipColor = tex2D(BaseTexture, inTex);
float4 ringColor = tex2D(ringTexture, colorIndex);

float4 finalColor;
finalColor.rgb = (shipColor.rgb) + (ringColor.rgb);
finalColor.a = shipColor.a; // Use the base texture's alpha (transparency).

return finalColor;

This works, and works how I want it to.  The ring moves outward from the center of the texture at a steady rate, and is constrained to the edges of the base texture (i.e. it won't continue past an edge).  However, there are a few issues with it that I would like some help on, though.  They are:

By combining the color additively (when I set finalColor.rgb), it makes the resulting ring color much lighter than I want (which, is pretty much the definition of additive blending, but I don't really want additive blending in this case).
I would really like to be able to pass in the color that I want the ring to be.  Currently, I have to pass in a texture that contains the color of the ring, but I think that doing it that way is kind of wasteful and overly-cumbersome.

I know that I'm probably being an idiot over this, so I greatly appreciate the help.

Some other (possibly relevant) information:

I'm using XNA.
I'm applying this by providing it to a SpriteBatch (as an Effect).
The SpriteBatch is using BlendState.NonPremultiplied.

Thanks in advance!

EDIT: Thanks for the answers thus far, as they've helped me get a better grasp of the color issue.  However, I'm still unsure of how to pass a color in and not use a texture.  i.e. Can I create a tex2D by using a float4 instead of a texture?  Or can I make a texture from a float4 and pass the texture in to the tex2D?

DOUBLE EDIT:  Here's some example pictures:

With the effect off:

With the effect on:

With the effect on, but with the color weighting set to full:

As you can see, the color weighting makes the base texture completely black (The background is black, so it looks transparent).  You can also see the red it's supposed to be, and then the white-ish it really is when blended additively.

sentences:
Adding SpriteFont in Monogame My question is probably something you guys have heard before - "How do you add SpriteFont's in Monogame's content manager?" The simple answer to this is, right click the 'Content' folder, go on 'Add New Item' and then you'll find it there. In my case however, there is no SpriteFont.

As far as my development environment goes, I am using Windows 7 and Visual Studio 2012. Upon getting Visual Studio, I installed MonoGame 3.2. My project is a MonoGame Windows Project (C#). As far as I can see, there are absolutely no options to add SpriteFont's to the MonoGame content manager. Right clicking the Content folder and going on Add New Item simply gets me this:

No sign of SpriteFont anywhere, whether I look under Visual C# Items or Online. What am I doing wrong?

The above is my content manager. If I go on Edit, New Item and then add my SpriteFont this way it will add, however the moment I go on Build, it will say 'MGCP has stopped responding'. This makes me think something is missing... A certain something called XNA Game Studio 4.0. I did some research and found a couple tutorials that tell you to install this, which makes me wonder if it is indeed needed. A friend of mine however is adamant that XNA Game Studio is not needed and that the only thing I need is VS 2012 and MonoGame.

Am I doing something wrong? Am I missing something? And is the answer to all my problems XNA Game Studio 4.0?

sentences:
How to implement Vector3.MoveTowards follow with random movement I want to implement an AI behavior where an enemy runs towards the player while sidestepping randomly and aggressively (like in this video: https://www.youtube.com/watch?v=35Ut_C4eL40)
Currently I am just using Vector3.MoveTowards but that results in smooth movement which isn't exactly what I need. I've tried adding an offset to the target using Random.insideUnitCircle but it just doesn't work.
If anyone could give me an algorithm to implement it'll be great. Thanks

sentences:
Is flash game development not considered 'proper' game development? I've come across this a couple of times. That flash game development is not 'proper' game development when compared to XNA or even Unity. Mentioned here:
Need guidelines for studying Game Development

Also here in some comments : Where to start with game development?

This judgement also befalls java, according to some. Is it because in flash its so easy to draw graphics and to import and add on to the stage any element we want and also because flash needs a 'container program' to run and others don't?

But flash is by far way easier to 'distribute' than any other of those mentioned above. Maybe except for iphone or android games.

sentences:
Roblox, custom chat filter So, I would like to add my own chat filter to my game, how would I do this?

eg:
Player says: "DIE"
Goes through chat filter and comes out as: "###" or any other string I specify.

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 many resources are too many? I don't know if this question is too broad but I am finally working on a game I want to release and I find that questions like: "can I really add another 10 frames?", "Do I really need that animation?", "Can I add more background effects?" etc. are always on my mind and limit my creativity.

I am trying to find an answer online without success, and as a hobby developer with no real training it is hard to know what is considered "too many" resources.

I suppose it differs depending on what you plan to release it for etc, but is there a general rule of thumb? I want to release for Android and ios.

For example I have a main character, and right now he has these animations:

 atlas = Assets.manager.get(Assets.runner, TextureAtlas.class);
        tallAnim = new Animation(1/10f, atlas.findRegion("runner1"), atlas.findRegion("runner2"), atlas.findRegion("runner3"), atlas.findRegion("runner4"));
        shortAnim = new Animation(1/10f, atlas.findRegion("short_runner1"), atlas.findRegion("short_runner2"), atlas.findRegion("short_runner3"), atlas.findRegion("short_runner4"));
        hitAnim = new Animation(1/10f, atlas.findRegion("runner_hit1"), atlas.findRegion("runner_hit2"));
        flyAnim = new Animation(1/10f, atlas.findRegion("runner_fly1"), atlas.findRegion("runner_fly2"));
        animation = tallAnim;

I want to add more but I am stopping my self because I don't know if this is too much. Right now he has 12 frames, and I am rendering a scrolling background and 2 different enemies (each with 3 frames) and a few other objects. Do I need to start limiting my game or is it hard to reach a point of "too much"?

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

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

sentences:
Providing texture coordinates and using indexed drawing at the same time Please consider the following vertex structure

struct vertex {
    vec3 posL, normalL;
};

Using this vertex layout, we can provide the vertex data in an interleaved way, i.e. (posL,normalL),(posL',normalL'),...
This works pretty fine in combination with indexed drawing via glDrawElements().

However, if we add texture coordinates to our vertex structure, i.e. consider

struct vertex
{
    vec3 posL, normalL;
    vec2 tex;
};

things get more complicated. Since one and the same vertex (meaning it's position) may participate in a variety of different faces with varying texture coordinates, I wondered how one would provide such vertex data to the vertex buffer.

One solution would be to quit storing the data interleaved and provide it a linear way, i.e. (posL,posL',...),(normalL,normalL',...),(tex,tex',...) where each tuple has the same length. Doing so, we would hold related things together (i.e. the k-th element of each tuple forms exactly one input the vertex shader sees).

But we would push much more data to the pipeline than necessary. So, what's the "ideal" solution to this problem? If one suggests to use different buffers, how does the vertex shader know, that texture coordinate tex at position i in Buffer 2 corresponds to the tuple (posL,normalL) at position j in Buffer 1?

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: 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 do I handle collision detection so fast objects are not allowed to pass through walls? I'm creating a 2d sidescrolling shooter, and I'm having a little trouble with collision detection for the bullets. Everything including the bullets are objects with their own polygons / update methods.

The trouble is that bullets go fast, and at 60 frames per second (what the game runs at) a bullet will often skip right through a wall -- since it moves more than the width of the wall during in the update interval -- and continue happily on its way since the polygons will never actually overlap.

What can I do about this? The only thing I've been able to come up with is to draw a line from the old position to the new position and do collision detection on that, but line drawing for collision detection is recommended against by the slick2d documentation. How can I solve this?

sentences:
Using Delta for a stopwatch, delta too fast than real time seconds I search for methods to create a stopwatch on libgdx and came across with this:

public void trigger(float delta){

    playTime += delta;
    playTimeRounded = ((double)Math.round(playTime * 100) / 100);
    Gdx.app.log("deltaTime", delta + "");
}

But its not accurate and its much faster. How can i create an accurate stopwatch?

sentences: How to store NPC movement data? In my 2D tile-based game, I have NPCs that move around on a fixed path. I am putting the information about the NPCs in a .plist file that is loaded on startup. The thing is, I'm not sure how to format the data specifying the path that the NPC moves on. What I was thinking was to have an origin property, a horizontalMovement property, and a verticalMovement property, so when the starts at its origin, then walks right the number of tiles specified by horizontalMovement, then walks the number of tiles down specified in verticalMovement, etc. However, this doesn't seem like the best approach. Is there a better way to store the movement data?

sentences:
Determining the location of installed/on disk game assets I've been thinking a lot about the best way to store and load assets in your filesystem.  By this I mean where in the file system to store them, and how to retrieve them when loading etc., as opposed to how their stored when the program is actually running.  I would imagine that this would be a fairly common question, but I can't seem to find it anywhere else, perhaps because I'm not asking it properly.

So far, I have found two strategies, and I would like to know what other ones there are.

Storing the assets in an absolute path on the system.  You may have to get the users home directory if the user doesn't need to be an admit/root to install the game, and other OS dependant stuff would probably need to be done to ensure that the path is actually valid, but it seems like this could work well.
Get the game's location on the system, and assume that assets can be found in an adjacent directory.  I don't think there is any OS independent way to do this, but it does seem feasible.  This might be nice as it doesn't require the user to install the game, making it all around more portable, but it does seem like it would destroy an OS paradigm where specific portions of the game when in a certain place in the os (say /usr/games, and the executable would go in a different directory).

Both of these ways do seem a bit clunky, so are there any other ways to get the location of your assets?  Otherwise, which is used more in games you've worked on?  Thank you.

sentences:
How to limit resolutions display in monogame I can Add resolutions to the list. Here is part of code.

List<Vector2> resolutions = new List<Vector2>();
foreach (var item in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
{

    for (int i = 0; i < item.Width; i++)
    {
        for (int z = 0; z < item.Height; z++)
        {

            resolutions.Add(new Vector2(i,z));
        }
    }
}

That is all great and dandy...but i wanna for example remove 320x200 up to 1024x768? Is there is any way to do that and how can i set/see refresh rate?

sentences:
How do modern game engines achieve real-time rendering vs Blender's "slow" rendering? I'm new to both gamedev and Blender, and there's something I can't shake:

In Blender, a single render (even using the more advanced Cycles renderer) can take up to 45 seconds on my machine. But obviously, in a game, you can have amazing graphics, and so rendering is obviously happening continuously, multiple times a second in real-time.

So I'm also wondering what the disconnect is, regarding how "slow" Blender's renders seem to be, versus how game engines achieve real-time (or near real-time) rendering.

sentences:
Android: Layouts and views or a single full screen custom view? I'm developing an Android game, and I'm making it so that it can run on low end devices without GPU, so I'm using the 2D API. I have so far tried to use Android's mechanisms such as layouts and activities where possible, but I'm beginning to wonder if it's not easier to just create a single custom view (or one per activity) and do all the work there.

Here's an example of how I currently do things: I'm using a layout to display the game's background as an image view and the square game area, which is a custom view, centered in the middle.

What would you say? Should I continue to use layouts where possible or is it more common/reasonable to just use a large custom view? I'm thinking that this would probably also make it easier to port my code to other platforms.

sentences:
Component based architecture - Rendering approach? I'm planning to use a component based architecture for a new 3D game engine I plan to work on, however I don't know how to approach the rendering side of things.

I can see two options here:

Every renderable game object has a RenderComponent, which stores a mesh and OpenGL-specific stuff like VBOs and VAOs. When the time comes to have update() called, it will use OpenGL to render itself.
Every renderable game object has a MeshComponent. When it's time to render, the Renderer would go through a list of all MeshComponents, extract vertex and material information, and render it.

Which option would be most flexible if I want to implement things like post-processing (bloom, motion blur), skyboxes, LOD, blending/transparency or implementing a deferred renderer?

sentences:
Why do I get 'Input Assembler: "No mesh available for stage"' error? My question is basically why VS2012 tells me that there is no mesh available for the Input Assembler stage because if I click on the DeviceContext next to the Draw call in the Grahics Event List the Input layout is set correctly, the vertex buffers, too, the index buffer is NULL as I do not call DrawIndexed and the primitive topology is set correctly. My background color is drawn using g_pImmediateContext->ClearRenderTargetView( g_pRenderTargetView, Colors::MidnightBlue );. Only the mesh does not appear. What did I miss?

If anything maybe this file which can be opened using VS2012 may help, it is the Graphics Experiment.vsglog file (link no longer available).

Here is my InputLayout struct:

struct VERTEXPOSITIONCOLOR
{
    DirectX::XMFLOAT3   position;
    DirectX::XMFLOAT4   color;

    static D3D11_INPUT_ELEMENT_DESC* GetVertexLayout()
    {
        static D3D11_INPUT_ELEMENT_DESC layout[] =
        {
            { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT,
                0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
            { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT,
                0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
        };
        return layout;
    }

    static UINT GetNumElements(){ return 2; }
};

sentences:
Is linear filtering possible on depth textures in OpenGL? I'm working on shadow maps in OpenGL (using C#).
First, I've created a framebuffer and attached a depth texture as follows:
// Generate the framebuffer.
var framebuffer = 0u;

glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);

// Generate the depth texture.
var shadowMap = 0u;

glGenTextures(1, &shadowMap);
glBindTexture(GL_TEXTURE_2D, shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMap, 0);

// Set the read and draw buffers.
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);

Later (after rendering to the shadow map and preparing the main scene), I sample from the shadow map in a GLSL fragment shader as follows:
float shadow = texture(shadowMap, shadowCoords.xy).r;

Where vec3 shadowCoords is the coordinates of the fragment from the perspective of the global directional light source (the one used to create the shadow map). The result is shown below. As expected, shadow edges are jagged due to using GL_NEAREST filtering.

To improve smoothness, I tried replaced the shadow map's filtering with GL_LINEAR, but the results haven't changed. I understand there are other avenues I could take (like Percentage-Closer Filtering), but I'd like to answer this question first, if only for my sanity. I've also noticed that other texture parameters (like GL_CLAMP_TO_EDGE rather than GL_REPEAT for wrapping) don't function for the shadow map, which hints that this may be a limitation of depth textures in general.
To reiterate: Is linear filtering possible using depth textures in OpenGL?

sentences:
How 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:
How to detect whether a transform has rotated left or right I have a game object in my scene, and I want to know how can I calculate whether this game object rotating to the right or to the left.

For example :

if(check whether the transform rotated to the right)
{
    print("rotate to right");
}
else if(check whether the transform rotated to the left)
{
    print("rotate to left");
}
else
{
    print("no rotation");
}

sentences:
Processing periodical operations on the database I program MMO strategy game (C# monogame) like Goodgame Empire or Travian for Windows Phone.

The server part of the game will run on Windows Server and MS SQL database.

I'm trying to figure out a way to perform periodical operations over players' data. My point is that, for example farm will produce one piece of food every minute and I need store it to database in real time.

I thought about that when registering a new player would cause the database start new job, but for example at 2000 players on the server I'm not sure if I do not
kill performance. I want to find optimal solution and I wanted to ask your opinions on what you think would be the best solution.

sentences:
How can I implement an asset update/download in a libgdx application? I am building a game based on libGdx and I want to be able to check for and download updated assets at some point before the player starts playing. The game is being built for PC and for Android.

I haven't been able to find much on downloading assets. It seems libGdx assumes all assets will be packaged with the game or already on "external" storage and available for the AssetManager.

So far, the best option I've found is setting up updating code prior to starting the libGdx application.

How can I have my assets download while the libGdx application is running? Possibly to allow some interaction while waiting, or progressive asset downloads allowing limited game play. My goal is to allow for dynamic updates to assets, and to allow users to get into the game quicker. Especially new players, I don't want them waiting on a download screen before they see anything of the actual game.

sentences:
Procedural Generation, Game Updates, & Butterfly Effect NOTE: I asked this on Stack Overflow a few days ago but had very few views and no response. Figured I should ask on gamdev.stackexchange instead.

This is a general question / request for advice on maintaining a procedural generation system through multiple post-release updates, without breaking previously generated content.

I am trying to find information and techniques for avoiding "Butterfly Effect" issues when creating procedural content for games. When using a seeded random number generator, a repeating sequence of random numbers can be used to create a reproducable world. While some games simply save the generated world to disk once generated, one of the powerful features of procedural generation is the fact that you can rely on the reproducability of the number sequence to recreate a region multiple times in the same way, removing the need for persistence. Because of the constraints of my particular situation, I must minimise persistence, and need to rely on purely seeded concent as much as possible.

The main danger in this approach is that even the slightest change in the procedural generation system can cause a butterfly effect that changes the entire world. This makes it very tricky to update the game without destroying the worlds that players are exploring.

The main technique I've been using to avoid this problem is to design the procedural generation in multiple phases, each of which has its own seeded random number generator. This means that each sub-system is self contained, and if something gets broken it will not affect everything in the world. However this seems like it still has a lot of potential for "breakage",even if in an isolated part of the game.

Another possible way of dealing with this problem could be to maintain complete versions of your generators within the code, and keep using the right generator for a given world instance. This seems like a maintenance nightmare to me though, and I'm curious if anyone actually does this.

So, my question is really a request for general advice, techniques, and design-patterns for dealing with this problem of the butterfly effect, especially in the context of post-release game updates. (Hopefully that's not too broad a question.)

I am currently working in Unity3D / C#, although this is a language agnostic question.

UPDATE:

Thank you for the replies.

It's looking more and more like static data is the best and safest approach, and also that when storing a lot of static data is not an option, having a long campaign in a generated world would require strict versioning of the generators used. The reason for the limitation in my case is the need for a mobile based cloud save / sync. My solution may be to find ways of storing small amounts of compact data about essential things.

I find Stormwind's concept of "Cages" to be a particularly useful way of thinking about things. A cage is basically a reseed point, preventing run-along effects of small changes, ie caging the butterfly.

sentences:
Implementing cheat safe loot algorithm at clientside I am developing a "city building" type of browser based flash/flex game. I was checking some of the implementation of existing one of the popular games in facebook using decompilers. I noticed they have implemented the loot algorithm the client side and sending the loot item to the server which I think is not cheat safe.

Knowing the fact that there are cheaters every where and it is easy to manipulate the messages and send the best loot always, is there any way we can counter this type of cheats?

I dont have a concrete solution designed for it yet but I am thinking to track the drops by maintaining the loot history.

So instead of mere updating the resources/inventory, I will implement a logic which will compare the loot with history to see if the player is receiving the rare drops excessively and flag the user or take a smart decision (which I don't have yet)

Or

Is it a good idea to implement the loot algorithm in the server side? Since this is "city building" kind of game, where it will not have extensive user actions like in typical RPG games which can trigger loot events.

sentences:
Hello World with FlashDevelop, Flixel, AS3: uneffective SWF macro I just started with FlashDevelop and Flixel, and I already have a question. I created this basic hello world:

package
{
    import org.flixel.*;
    [SWF(width = "640", height = "480", backgroundColor = "#000000")]; //Set the size and color of the Flash file

    public class HelloWorld extends FlxGame
    {
        //...
    }
}

When I run this "game", using Flash Player, I get a 800x600 window with a white background, even though I specified it's 640x480 with a black background. Am I doing anything wrong?

I am using Flex 4.6.0, and the target platform is Flash Player 10.1. I have the debugger version of Flash Player 11 installed (WIN 11,5,502,146 to be exact).

In the .xml file (found in the obj folder) I found the following:

<default-size>
    <width>800</width>
    <height>600</height>
</default-size>

Changing the size/color through the properties window of my FlashDevelop project does work fine...

It seems to ignore the [SWF(...)] macro entirely: what's going on?

sentences: How do games go about designing weapon damage? In Action-RPG games, I was wondering how weapon damage numbers  and attack speeds are decided on. Do most games come up with their own or do they "steal" numbers from other games? How would I go about coming up with my own numbers?

sentences:
Why does Unity editor freeze up if left unfocused for a while? If Unity editor loses focus for too long (such as because I'm tabbed out into my browser or Blender), then I find that it needs about 15-30 seconds until I can interact with it again when it gets focus again. It seems like it is paused.

Is this a bug or my fault?

sentences:
best way to compute vertex normals from a Triangle's list hi
i'm a complete newbie in computergraphics so sorry if it's a stupid answer.
i'm trying to make a simple 3d engine from scratch, more for educational purpose than for real use.

for now i compute only face normals. in this way:

i have a Surface object with inside a Triangle's list. i compute normals inside Triangle class, in this way:

triangle.computeFaceNormals() {
    Vec3D u = v1.sub(v3)
    Vec3D v = v1.sub(v2)
    Vec3D normal = Vec3D.cross(u,v)
    normal.normalized()
    this.n1 = this.n2 = this.n3 = normal
}

and when building surface:

t = new Triangle(v1,v2,v3)
t.computeFaceNormals()
surface.addTriangle(t)

and i think this is the best way to do that.. isn't it?

now.. this works, ok. but light it's not smoothed. i'm trying to compute also vertex normals. (i'm testing my engine with tubolar surfaces so i have almost all vertex shared with more then one triangles)

i've found this simple algorithm: flipcode vertex normal
but.. hei this algorithm has.. exponential complexity? (if my memory doesn't fail my computer science background..) (bytheway.. it has 3 nested loops.. i don't think it's the best way to do it..)

any suggestion?

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:
Getting crash on glDrawElements Here is the code where I initialize the VAO, vertex attributes(also the main VBO) and EBO(im using my own wrapper class for these "databuffers" to hide some of the API features and make life easier so i dont think the problem will be in the generic class as it was working without problems)

void initVAOManager(const bool& ebo) {

    if (_vaoID == 0)
        glGenVertexArrays(1, &_vaoID);

    glBindVertexArray(_vaoID);

    /**
    Here is the main data buffer (positions,colors,UVs)
    If it doesn´t exist a new one is created
    **/
    if (!_mainBuffer)
        _mainBuffer = new DataBuffer<T>(GL_ARRAY_BUFFER);

    _mainBuffer->bindBuffer();

    if (!_eboBuffer && ebo) {

        _eboBuffer = new DataBuffer<eboData>(GL_ELEMENT_ARRAY_BUFFER);

        _eboBuffer->bindBuffer();
    }

    //This is the position
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, position));

    //Color attrib pointer
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, color));

    //UV
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, uv));

    _mainBuffer->unbindBuffer();

    if (ebo)
        _eboBuffer->unbindBuffer();

    glBindVertexArray(0);
}

Then the render function (dont mind the for loop, as i want to render multiple objects from the batch in one function):

void renderBatchNormal()
{
    uploadData();

    glBindVertexArray(_VAOManager->getVAO());

    std::vector<eboData>

    for (std::size_t i = 0; i < _DATA.size(); i++) {
            glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    }

    glBindVertexArray(0);

    clearData();
}

The upload data function send a data from the vectors to their buffers, I can send it too but as Im using my generic wrapper and it worked before with normal drawings I assume there is no problem.
And finally a class eboData(if anyone wondered) (basically just a blank class with an array of 6 indices)

class eboData {
public:
    GLuint indices[6];
};

However, this is causing crashes on the line where I try to execute the glDrawElements command, I read that it can be caused with no binded VAO while binding the ELEMENT BUFFER but as you can see from the code I´m doing it right(at least I think that). However, if I change the following line with:

std::vector<eboData> _eboVector;

glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, _eboVector.data());

The code is working (problem is also that I don´t know how to render second item in the buffer as it is showing only the first one). Do you have any ideas what can cause this crash?

PS:
glGetError() returns 0.

sentences:
In modern AAA games with open environment and lot of static content (eg : crysis), how is occlusion culling performed? Two ideas i have in mind :

1) Scene is rendered to a invisible buffer, using low resolution and low polygon count models (or even using only bounding volumes like cubes or spheres). The buffer is then checked to know what is visible or not. Before rendering the low resolution scene, some frustum culling could be applied, to already remove as much objects as possible.

2) A tool is run on the static map and will perform complex (and thus slow) ray tracing to know for some 3d positions on the map what is visible and what is not. All that information is then stored in a efficient way that can be user later at runtime (eg: an octree)
This solution would only work for static meshes (eg : building) not moving objects.

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:
Configuration management in XNA I come from a .net web background so I am accustomed to using xml .config files.  What is the XNA equivalent?  It seems to me that using the same practice of a xml config leaves your game open to easy modification (which can be good, I know). In my day-life web development the configs live on servers where users can't access.  XNA games live purely on the client (most of the time).

Say I have some values I want in a config, can the config be obfuscated or is there a different configuration management system for XNA?  Is the only solution to hardcode the values back in before release so they are not accessible?

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:
Jumping a sprite while moving in a Bezier action I'm creating a game and I need the sprite to jump (move up and down basically) while it's moving on a bezier path so it moves vertically while it still follows the path. If I do this while it's moving along the bezier path:

[mySprite runAction:[CCJumpBy actionWithDuration:0.1 position:ccp(0,0) height:10 jumps:1]];

It jumps vertically but instantly it returns to the position on the path. What I want is to jump relative to the path.

Does anyone know anything about it?

It would looks something like this:

The curve is a sequence of CCBezierBy's by the way.

Thanks.

sentences:
How can I implement a simple "jump" action with three.js and/or Physijs? Assume I have a simple Physijs object like this car.  How can I adapt something like this to "jump" (hydraulics ftw!) when pressing spacebar for instance?

I'm currently thinking applyCentralImpulse should come into play.

sentences:
Portal 2 Authoring Tools: func_instance_io_proxy not working? I have a func_instance (which I made myself) of a door in my map. It is supposed to open when a cube is fizzled. I also put a checkmark indicator to make sure I had the cube's logic correct. When the cube is fizzled, the checkmark indicator lights up, but the door does not open. To make sure the door was working, I put a logic_auto into the prefab which opened the door when the map loaded. This worked correctly. I therefore think that there is something wrong with the func_instance_io_proxy, but I do not know what. Here are some screenshots:

The cube targets the openDoor relay's trigger input via the func_instance_io_proxy. It also targets the checkmark indicator, which properly lights up when the cube is fizzled.

My door func_instance. The relay on the left opens the door, and the one on the right closes it.

The logic_auto targets the closeDoor relay on startup, which does execute properly, as the door is closed when I go to test the map.

Finally, the func_instance_io_proxy targets the openDoor's trigger input. However, when I try and access it via the cube, it does not work, and the door does not open.

*By the way, I am running this on linux via wine, which is why it looks like windows 98

**Off-topic question, is this the right place to post this, since it is technically map making, not game development?

sentences:
How do I sample a cubic shadow map in DirectX 11? I've implemented a cubic shadow map for dealing with omni-directional light sources in my scene. By defualt it produces hard shadows

Obviously a shadow map with higher resolution (currently using 512x512) would produce a finer edge but that would also result in larger memory footprint for the application.

I'm currently using a very simple approach to sample the cubic shadow map using the TextureCube::SampleCmp method

float depthBias = 0.002f;
float shadowFactor = omniShadowMap.SampleCmp( omniShadowSampler, -lightVec, lightVecLength / pointLight.positionAndRadius.w - depthBias );

if( shadowFactor == 0.0f )
    shadowFactor = 0.5f;

return float4( ( finalDiffuse + finalSpecular.xyz  ) * shadowFactor , 1.0f );

The SamplerComparisonState is configuered like this

D3D11_SAMPLER_DESC samplerDesc;

samplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.MipLODBias = 0;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;
samplerDesc.BorderColor[0] = 0.0f;
samplerDesc.BorderColor[1] = 0.0f;
samplerDesc.BorderColor[2] = 0.0f;
samplerDesc.BorderColor[3] = 0.0f;
samplerDesc.MinLOD = 0.0f;
samplerDesc.MaxLOD = 0.0f;

One approach would be to use Percentage-Closer Filtering but I don't know how to access the texels in a TextureCube.

Any suggestions? Thank you!

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:
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:
Confused about DXT/DDS compression and color depth I have done my research on DDS/DXT compression, and the information is kind of "everywhere." It is rather difficult to even find good, organized, sensible information on color depth. However, it is apparent that DXT5 changes the image to... RGB565?

Alright, so I am restricted to 16 bit color and RGB565. Makes sense.
I also read that converting it yourself, choosing the colors in the image, can stop or even entirely prevent loss of detail.

Nvidia's Photoshop plugin seems to degrade the quality to something much worse than other programs are capable of when converting an image to RGB565.

In particular, I use an absolutely wonderful tool which allows me to choose the colors. I altered my image to actually only include 128 colors. This is less than the 256 allowed by RGB565.

However, Nvidia's Photoshop plugin seems to ignore those colors, and chooses its own- as if I never changed the image in the first place. It's identical to what it was if I convert it to DDS from 24 bit Truecolor.

Why is Nvidia's tool not keeping my color table?
Why is it still lossy, and significantly worse at Nvidia's 256 colors, when my 128 color version is so superior and loses no quality or detail?

Currently, I am using "COLOR QUANTIZER", which is the best tool I have found to lower the number of colors without losing image quality.

I might be a little confused, as apparently TexturePacker's RGBA5555 is 20 bit and unsupported in a lot of frameworks, which confused me thinking RGB565 and RGBA5555 were both 16 bit. (Dur! The non-existence of RGBA5555 in google threw me off bigtime.) However, I assume I could easily achieve RGBA4444 (16 bit with alpha) because my colors can degrade in COLOR QUANTIZER to 128 colors, and RGBA4444 supports 256 colors. When I use TEXTUREPACKER or other programs, it is worse quality than in COLOR QUANTIZER. This program is simply superior in my experience, and I have been obsessive with all tools available to find the best one.

My images: PNG with pre-multiplied alpha. Can degrade to 128 colors, in COLOR QUANTIZER, before losing any quality. Alpha is a very big requirement, so RGB565 and DXT1 are out of the question. These are small sprites, which are smaller than 100x200.

My Goal: Low memory consumption and compression. Obviously, the best way to handle this would be DDS/DXT5 so I can keep the textures compressed in memory. Although I could handle RGBA4444, it is only a 2:1 compression, while DXT5 is 4:1. I would much prefer to use the DDS format.

sentences:
Choosing a level editor of a 2d platformer I'm working with a small team on a 2D platformer game in Java (LibGDX) that uses Box2D for physics.
Our team is looking for a tool to make the levels (that we will be able to integrate with the Box2D physics, and the graphics).
We want a tool that is able to work with polygons (not with tiles), and that can be used from Linux (and preferably Open Source).
Any suggestions ?

(Of-course I can write a little level-editor specific to our game, and if this is the case please write, but I would like to avoid that if there is another way )

sentences:
XNA 2D: How to load/unload specific content by level I'm writing a 2D room-based* platformer using XNA, and I'm trying to figure out the best way to load resources based on what the current map requires. Basically, I need to (want to) dispose of the loaded tileset/textures and load just the ones the next map requests at every transition (ideally, I'll check if they're actually different first), without killing off the more universal textures (player sprites, etc.).

I've seen a few forum posts saying the best way to do this is to create a second instance of ContentManager, but they never go into detail on how to do this correctly.

Currently, my XML map files each contain strings with the filenames of all necessary assets. I was planning on having my XmlReader method load the textures as their names were read, but then I realized I knew neither how to instantiate the second ContentManager, nor where to instantiate it--i.e., should it be in the MapFactory class that's loading the map, or in the static LevelManager that's calling the MapFactory (passing the new ContentManager as a parameter to the MapFactory, along with the name of the desired map)?

Alternatively, is there a simpler/cleaner way to do this? I'm more concerned with the code being easily comprehensible than efficient right now, as this is my first attempt at this kind of game.

*Ex. Castlevania, Metroid, but simpler (for now). I'd like to implement constant streaming eventually (chunks loaded as they are approached), but I want to get this part down first.

UPDATE: Instantiated the second ContentManager using this.Services inside the Game class (it was the only way I could find to get access to Game.Services, which is what everywhere online says to use in the ContentManager constructor). Should have thought of that sooner. For anyone confused by this in the future, the full line of code is:

ContentManager myContent = new ContentManager(this.Services, "myContent")

sentences:
Pathfinding with portals? I'm not making a game with portals in it (one way or bidirectional). These portals instantly teleport characters from one location to another. How would I implement pathfinding?

Here's an animation showing the portals in action, and different paths taken: http://www.makeitshareit.com/animation/86137

How do I perform pathfinding whilst taking in the possibility of using the portals as shortcuts? If I just use A*, the portals may wreak havoc with the admissibility requirement. How can I also make it reasonably efficient, such as avoiding quadratic complexity with respect to the number of portals?

sentences:
What dimensions should you use for a perspective projection frustum? What dimensions should you use for a perspective projection frustum? Initially I created a perspective matrix based on the width and height of the screen, with a calculated zNear value based on a 45degree FOV.

// OpenGL example
// For height of 800, zNear is calculated to be ~965.
zNear = (height / 2.0f) / tan(Deg2Rad(45.0f) / 2.0));
zFar = 100000.0f;
glFrustum(-width / 2.0f, width / 2.0f, -height / 2.0f, height / 2.0f, zNear, zFar);

But then I realised that this isn't a sensible idea and you shouldn't base your frustum on pixels, and you should use logical units instead (else when the window / screen changes size, objects will change position or size).

So now I'm wondering what dimensions I should use for the logical planes of the frustum? How do you choose a zNear value? Is it sensible to base it on the desired FOV? I'm aware that having a small zNear value can mess with the z-buffer, which is why I initially based it on the FOV.

My current thoughts are of using a logical near plane of TopLeft: -10000, -10000 and BottomRight: 10000, 10000. But then that generates a zNear value of ~24142 based on 45degrees FOV, which seems awfully high. What advice do you have? What dimensions should you use for a projection frustum?

sentences:
Should I go with Windows Phone 7 or Try Android? I already know C# and am familiar with XNA.

So it would make sense to develop for the Windows Phone 7, but would it be worth while to learn Java, get familiar with Android, and instead develop for Android devices?

Android has been around longer so it would probably have a larger user base. Is it really worth it to try to develop for one of the more popular mobile platforms. (Windows Phone 7 has been out for like a month?)

I haven't tried either one yet though. I'm also going to buy a phone, so this decision would probably influence the phone that I buy. (to develop/test on)

sentences:
Tilemap Collision Generation - Tracing Polygons with Slopes I've been using Godot for my game, but it has a unfortunate quirks with tilemap collision where physics objects can bounce weirdly near tile seams and kinematic bodies can often get stuck in seams as well. For early alpha work, I've been able to get around this by not using tilemap collision and then tracing the contours by hand... Well this isn't going to scale well to 200 rooms (or whatever I end up having) and could easily lead to mismatched collision data, so I've decided that this process needs to be automated.

Tilemaps have a few different tile types - fully solid, diagonal slopes, and 2:1 slopes.

My first attempt matched each of these types to a half-tile size, marking each vertex as solid or not solid, and then combining all the vertices (with their overlap) into a single grid of vertices. I could then use all of these together by marching along the perimeter and probing ahead to detect corners. Turns out this works well for convex corners but has serious issues in concave corners, plus there isn't enough data to detect slopes properly, so it often resulted in extra slopey parts or cutting into slopes just slightly.

From there I decided to add some extra information on the vertex grid, such as whether a vertex is a slope edge and doing clever things surrounding the properties of how it overlaps, but it's quickly blowing up into a lot of specific cases.

I spent much of today thinking about adding vertex normals to each tile definition, but I realized it wasn't going to work without adding a bunch of different tile solidity types.

Are there better approaches than what I'm thinking that don't involve brittle/lossy intermediate representations or ridiculous amounts of special cases?

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:
Player animating the wrong direction once he is rotated I have used the scripting root motion move the player when using an 'inplace' animation.

All works correctly until the players rotation is off 0,0,0.
This is expected as the movement is along the transform.z axis but how can I account for the rotation in the script and apply it so the movement is correct in game?

The gorillacontroller script is the script we are trying to fix On playerGorilla. animator is on the playergorilla. The gorilla1 is the gameobject holding the mesh and the bones for the character.

I will also add the transforms are moving this was my silly mistake because I had tool handles in global instead of local.

This makes it even more confusing however because all tranform.z (blue axis) are facing the correct way for the animation to work but the animation is only ever playing in the original direction where the rotation is 0,0,0,0.

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Animator))]

public class RootMotionScript : MonoBehaviour {

    void OnAnimatorMove()
    {
          Animator animator = GetComponent<Animator>();

          if (animator)
          {
               Vector3 newPosition = transform.position;
               newPosition.z += animator.GetFloat("Runspeed") * Time.deltaTime;
               transform.position = newPosition;
          }
    }
}

sentences:
Moving camera vertically only after player is too high or too low In my 2D platformer game, I find it very exhausting for the player if the camera follows the player all the time. So, I looked up for some tricks to make camera movement feel more natural.

The first trick is from James Doyle, where the camera follows a target instead of the player itself. Thus, I can safely use Mathf.Lerp for the target, and avoid having jitters.

The second thing I want to do is to limit the vertical movement of the camera. That is, I don't want the camera to move up and down whenever the player jumps. It is dizzying.
Instead, I want camera to follow the player only if player is vertically too high or too low.

Here is roughly what I do:

\\PlayerController.cs

    public Transform cameraTarget;
    private void FixedUpdate()
    {
       if(Mathf.Abs(transform.position.y - cameraTarget.position.y) > verticalLimit )
         cameraTarget.position = new Vector3(cameraTarget.position.x, Mathf.Lerp(cameraTarget.position.y, transform.position.y, Time.fixedDeltaTime), cameraTarget.position.z);
        if (Input.GetAxisRaw("Horizontal") != 0)
        {
            cameraTarget.localPosition = new Vector3(Mathf.Lerp(cameraTarget.localPosition.x, Input.GetAxisRaw("Horizontal")* cameraAheadAmount, 0.8f * Time.fixedDeltaTime), cameraTarget.localPosition.y, cameraTarget.localPosition.z);
        }

    }

The problem for this approach is that whenever the vertical distance between the player and the camera target is less than the limit, the camera does not follow the player anymore.
So, what I get is basically a camera following the player from down below, again, all the times.

I thought of using a boolean flag to tell the camera follow the player when vertical limit is exceeded, but then when do I set and unset the flag?

I am new to Unity's Update() and FixedUpdate() logic, so I cannot somehow design a workaround. Is there a simple way to do this?

sentences:
Unity is not responding in Ubuntu 18.4 I am running the build Unity executable in ubuntu 18.04 and it may take a while to load the asset. When I wait, I always receive a window telling me "You can choose to wait for a while to let it continue or force the application to completely exit." For a while, Unity will run and it looks like works well.
My question is, what is the impact of this? Why does ubuntu send the message? How to deal with it?

sentences:
Unity - Where should downloaded level data be stored? I've been looking around and it appears suggestions are only to store data to UserPrefs, or PersistentDataPath.

I intend to have map files streamed to the client on demand, and saved for reuse. UserPrefs seems inappropriate for large blobs. PersistentDataPath is per computer user, thus duplicating data and space usage. I believe Program Files has access restrictions too.

What are the current best practices for storing runtime data that meet the following criteria?

Is shared across user accounts to avoid wasting disk space.
Doesn't require elevated permissions.
Doesn't annoy the user (such as data being placed in My Documents).
Can be modified at any time.

sentences:
OpenGL is box blur this slow? I've never tried blur until recently, and by that i've noticed fps drop when doing box blur. My fps will go down from 4000-5000 fps to 1000-1500 fps. Currently rendering at 853x480 frame buffer and window size.

Is this normal? Oh, and i'm only rendering a basic triangle.
Here's the fragment shader code (pretty much the same from open.gl):

#version 150

in vec2 fTexCoord;

out vec4 finalColor;

uniform sampler2D tex;

const float blurSizeX = 1.0f / 853.0f;
const float blurSizeY = 1.0f / 480.0f;

void main() {
    vec4 col = vec4(0.0f);
    for (int y = -3; y < 4; y++) {
        for (int x = -3; x < 4; x++) {
            col += texture(tex, vec2(fTexCoord.x + x * blurSizeX, fTexCoord.y + y * blurSizeY)) / 49.0f;
        }
    }
    finalColor = col;
}

Thank you in advance.

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:
Struggling to implement A* pathfinding execution So I've implemented pathfinding to my game which works well with a tile based map. All tiles have an x & y integer coordinate for example the tile on the top left would be 0,0 the adjecent tiles would we 0,1; 1,0 and 1,1. My pathfinding returns a path based on these coordinates.

My game however is using float coordinates. So that an entity is basically able to stand on or between two tiles at the same time. For that  the tile coordinates are multiplied by 32 (the size of one tile). That means the first tile would be 32,32  and the adjecent tiles 64,32; 32,64; 64,64

My approach was to get a target X and Y from my pathfinding to calculate the next step and multiply it by 32. So if the entity is supposed to move to the top left for example the targetX and Y would be 1*32, 1*32.

After the targetX & targetY is set i'll increase or decrease the coordination of moving entity by its movementspeed, when it's reached its targetX & targetY i'll get the next step and to the same until no steps are left.

However I'm encountering various problems because it's not really possible to set an entity to a certain field because its possible to stand on two tiles at the same time and entities only have float coordinates. Especially when an entity is supposed to move around a narrow corner its getting stuck because of the offset between the pathfinding and the float coordinates of the entity.

I hope my problem became more or less clear, how could I deal with that or how is dealt with that problematic in general? I'm glad about any advices.

Edit: No diagonal movement is intended.

sentences:
Is a recursive game object update better than a linear one? I have a tree of gameobjects, so every node contains a list of children.
In update function:
Is it better to do recursive or linear walking through game objects.

update() {
    update self;
    foreach child call update;//recursive call
}

or

array of children = root.getAllChildrenRecursive
foreach child in array of children call update; //linear walking through gameobjects.

sentences:
how to check a condition for too many objects in a list that you dont know count of them I'm working on a defense game that I need a way of knowing if every enemy in a wave is dead. I wanted to use a counter for it:

foreach (GameObject g in group1)
{
    if(g == dead) {
        deadCount++;
    }
}
if(deadCount == allEnemiesInWave)
{
    goToNextWave();
}

but I think it's not a safe or accurate way. Is there any better way?

Edit:
This question is not like Check if all gameobjects are destroyed. In my question, I wanted to make a condition on many objects, in the other one, OP wanted to check if such objects existed.

sentences:
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:
Is it possible to index different vertex attributes with different index buffers? Let's say I've got a vertex which is part of many triangles. I can just reference those with an index buffer.  But is it possible to share it's position but have different texture coords for each triangle?  e.g.

+--+--+
|\ |\ |
| \| \|
+--X--+
|\ |\ |
| \| \|
+--+--+

The center vertex, X, is shared. If I want each square to have a different texture then I would need to store four distinct UV coordinates for the centre vertex.  Is this only possible by creating it four times?

sentences:
Stop animation playing automatically I've created an animation to animate a swinging mace.

To do this I select the mace object in the scene pane, open the animation pane, and key it at a certain position at 0:00.

I'm prompted to save this animation in my assets folder, which I do, as maceswing

I then rotate the mace, move the slider through time and key it in a different position. I move the slider through time again, move the object to the original position and key it.

There are now three things in my assets folder:

maceswing appears to be my animation, but I have no idea what Mace Mace 1 and Mace 2 are. (I've been mucking around trying to get this working so it's possible Mace 1 and Mace 2 are just duplicates of Mace. I still want to know what they are though)

When I play my game, the mace is constantly swinging, even though I didn't apply maceswing to it. I can't stop it. People say there's some kind of tick box to stop it constantly animating but I can't find it.

My mace object only has an Animator component:

Unticking this component doesn't stop the animation playing so I have no idea where the animation is coming from. Or what the Animator component actually does.

I don't want this animation constantly playing. I only want it to play once when someone clicks a certain button:

var Mace : Transform;
if(Input.GetButtonDown('Fire1')){
    Mace.animation.Play('maceswing');
};

Upon clicking the 'Fire1' button, I get this error:

MissingComponentException: There is no 'Animation' attached to the "Mace" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "Mace". Or your script needs to check if the component is attached before using it.

There is no 'Animation' attached to the "Mace" game object, and yet I can see it swinging away constantly. Infact I can't stop it! So what's causing the animation if the game object doesn't have an 'Animation' attached to it?

My maceswing animation object:

sentences:
Combine rotation XZ (horizontal) with YZ (vertical). Math formula I'm trying to make a rotation vertically and horizontally around a point at the same time but I'm not able to combine both.

I have this formula for the horizontal rotation:

camera.position.x = x * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - x * Math.sin(inc)

And this one for the vertical:

camera.position.y = y * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - y * Math.sin(inc)

I guess I need to use a Matrix, but not sure how. Here an example with Three.js:
https://codepen.io/josema/pen/xyQoga

sentences:
Why do I get this file loading exception when trying to draw sprites with libgdx? I'm having trouble with the "Drawing Images" section on the libgdx tutorial.  I set up the documents completely and I typed the code as follows:

public class Game implements ApplicationListener {
        public static final String LOG = Game.class.getSimpleName();
        private FPSLogger fpsLogger;
        private SpriteBatch batch;
        private Texture texture;
        private Sprite sprite;
        private TextureRegion region;

        //removed irrelevant code for this question...

        @Override
        public void render() {
                texture = new Texture(Gdx.files.internal("android.png"));
                region = new TextureRegion(texture, 20, 20, 50, 50);
                sprite = new Sprite(texture, 20, 20, 50, 50);
                sprite.setPosition(10, 10);
                sprite.setRotation(45);

                Gdx.gl.glClearColor(0f, 1f, 0f, 1f);
                Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
                batch.begin();
                batch.draw(texture,10,10);
                batch.draw(region,10,10);
                sprite.draw(batch);
                batch.end();

                // output the current FPS
                fpsLogger.log();
        }
}

I went through the tutorial on the website but when I run the code I get errors:

Exception in thread "LWJGL Application"
com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: android.png at
com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)  at
com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:55) at
com.badlogic.gdx.graphics.Texture.load(Texture.java:175)  at
com.badlogic.gdx.graphics.Texture.create(Texture.java:159)    at
com.badlogic.gdx.graphics.Texture.<init>(Texture.java:133)    at
com.badlogic.gdx.graphics.Texture.<init>(Texture.java:122)    at
com.game.Game.render(Game.java:46)    at
com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop (LwjglApplication.java:163) at
com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: android.png (Internal)     at
com.badlogic.gdx.files.FileHandle.read(FileHandle.java:108)   at
com.badlogic.gdx.files.FileHandle.length(FileHandle.java:364)     at
com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:156)  at
com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:134)  ... 8 more

I set the android.png in my assests folder in my android project linking it to the desktop one, I don't understand what I'm doing wrong.  What is making these errors?

sentences:
Why use textures that are Power of Two? Possible Duplicate:
  Why are textures always square powers of two? What if they aren’t?

I am using C# and XNA (also MonoGame for other platforms than Windows) to create a game in 2D. Ususally for all textures I use the NVidia plugin for Photoshop to create DDS files with precomputed mip-maps (either full color, or DXT-5).

How important is it, nowadays, to stick to textures with extensions that are a power of two? What are the advantages and disadvantages of doing so?

The background of my question for that I use a number of quite large background images in with 1980 x 1080 pixels in size and storing them in textures of 2048 x 2048 pixels size seems like a tremendous waste of memory.

Let me stress that I am aware that having only power-of-two textures has been important in the past for certain specific optimizations BUT I would like to know whether this TODAY (GPUs of the last ~2 years, current consoles etc.) is still required?

sentences:
Separating Assets in Unity Well, my question in rather simple - or so I hope. What I would like to do is separate my game assets in the Unity game engine into separate files for the build. This way not all the assets are in one large file, therefore making for easier and faster updates (don't have to re-download one large file if there's only a small change to one asset). How would I go about doing this? The best case solution would be if I could have everything separated during the final build, this way if I update one tree asset I don't need to update all tree assets, but I'm not sure if this is possible.

Example Structure:
+ A common set of assets that's loaded on startup (menu textures, trees used often, etc).
+ A set containing trees, rocks, and other foliage.
+ A set containing various scripts (AI scripts that would get updated frequently for example).

Thanks for the help!

sentences: Where could I look online to learn about being a game designer? I'm interested in being a video game designer but I know next to nothing about how to do what ever it is I will be doing as a game designer. Could you offer any advice of a good online area where I could learn about the basics of game designing and later on the more complicated information.

sentences:
Creating a static background when using camera transforms in Allegro 5 How can I draw a static bitmap for the background of an Allegro 5 graphics window, if I'm using camera transformations to apply perspective to bitmaps in front of the background so it appears that they're otherwise in a 3D space?

If I try simply drawing a bitmap to the backbuffer without any transforms applied, and then call al_use_transform on a perspective transform when drawing the other objects, the "background" moves along with the transform.

sentences:
Why do I get compile errors in every project, even new ones, and how do I fix them? I downloaded the latest version of Unity as you can see in the snap.

I just created a new project and when I press the play button it shows compile error even if I have not created anything nor any script. I receive 4 blank errors in Unity and one non critical. I am not able to clear them except the non critical one.

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:
Baked lightmap: Parts of scene appear too dark I'm having trouble setting up global illumination in my Unity 2021.1.1 URP project
Parts of my scene are appearing completely dark, I'm only using directional light and area light on the windows, here's the baked lightmap view:
In the corner as you can see it's completely dark

Here's the Shaded view:
The corner again

Generally the whole scene is pretty dark, it'd like to brighten it up a bit, but the corner is just horrendous.
Those are my lighting settings

Also the Environment settings as per request:

sentences:
Is keeping all my game art in a static class wasting memory? When I make games, I generally create a static class called Art that has static fields to track all content in the game. For example

public static class Art
{
    public static SpriteFont defaultFont;

    public static Texture2D playerSprite;

    public static void LoadContent(ContentManager content)
    {
        defaultFont = content.Load<SpriteFont>("Fonts/DefaultFont");
        playerSprite = content.Load<PlayerSprite>("Sprites/PlayerSprite");
    }
}

My question is do these objects in my art class take up memory for the duration of the games lifetime? The point of this class is to only have to load my art once in the game and have easy access to the assets anywhere in my project, but at what cost?

sentences:
How do you create test for unity variables that are set through the [SerializeField] tag? I need to create some tests for a bunch of variables that are initialized via the editor, So in the script they are always null and can't be set publicly.

Usually using the tag is a good way to encapsulate the code but with tests how do I check such a variable? Example:

public class thing
{
    [SerializeField]
    private string line;

    //constructor(s), methods, etc..

    public void setLine(string text){line = text; }
}

How do I check the value of the string after it is set inside a test?
(preferably without creating a getter method)

sentences:
Unity: How do I only show parts of objects that overlap [2D] I'm working on a 2D Unity project where the player can only see objects in their field of view. I have successfully created a mesh that overlaps anything that would be in the player's field of view, but now I'm having trouble with only showing parts of objects that the mesh overlaps with.

Here is what I have so far (the gray area is the player's field of view which is a mesh:

Here is the type of thing that I'm looking for:

What can I do to get that desired effect? Shaders (I have no clue how to use shaders)? Colliders? Any ideas would be greatly appreciated. If there is any info you need that I didn't provide, comment and I add the necessary info. Thank you in advance!

sentences:
Unused methods after component inheritance in component based architecture? I have a GameObject class, which contains Components, like:

Renderer
Camera
Behaviour
Rigidbody

First I inherited all of them from Component which has an Update() method, and it is called every frame on every game objects' every component.

But then I noticed, that** Renderer and Camera's Update method is unused**. (There are classes like RenderData & CameraData which are isolated and made from primitives, and upon creation of these Components, these Data's pointer is sent to the GraphicsEngine which will process them every frame.)

So having an unused method is bad. So I created a DynamicComponent class, which inherits from Component, and Behaviour & Rigidbody classes are inherited from it.

I moved the Update() from Component to DynamicComponent, and I have now 2 containers at gameobjects:

Components (for components which are inherited directly from Component)
Dynamic Components (for components which are inherited from D.Comp.)

And every frame I only call DynamicComponents' Update().

Now I'm having another issue. There is the Behaviour class, where should be a Start() method, which is called on every Behaviour when the scene is fully initalized.

That means that I should have a Components, D.Components and also a Behaviours container at game objects.

This looks very bad to me.

Having a Component class, with Start(), Update(), etc is very simple and makes a very clean code, but this means that only a few derived classes implement its virtual methods.

What should I do?

sentences:
Transform vertices in a line differently? With a GL_LINE, is there a way to have the vertex (or geometry) shader treat the first and second point differently?

i.e. In a line from p0 -> p1 I'd like to apply a different transform to p0 than to p1.

I know how to do this with a computer shader, but I was wondering if there is a way to do it with a vertex/geometry shader.

sentences:
How to achieve an GPS-Based game like "Parallel Kingdom" I'd like to use Google Maps, in my game, much like "Ingress", "Pokémon GO" and "Parallel Kingdom".
When I take a deeper look into the Android API/Google Maps API, and dozens of forums, I noticed that it's very hard to display sprites or even animations using the Google Maps API. Someone said that you need to layer stuff. Someone else said it's better to use game engines for that. No one tells me how to begin. I opened Android Studios and made a new Google Maps project. I compiled and ran the app. There is the map, so I guess I have completed the first step.
How do I combine the Google Map with an extra view or LibGDX layer for displaying sprites? How manage this with a multiplayer server?
I am wanting to set my map up like "Parallel Kingdom", which you can see, below.

sentences:
What is the "DirectX for Managed Code Update"? I came upon this site while looking for information about working with DX in managed code and saw that MS released something containing a 'DirectX for Managed Code Update'.
This sounds promising but I can't find much information about it.

Is this an out of date update referring to what was formerly Managed DirectX, or something new*?

If new, has anyone used it? How does it compare to SlimDX?

(*as new as it can be from June last  year)

sentences: Unity 2D game object moving up in curve? How can I make a rigidbody2d game object moving up curve like the attached screenshot?

sentences:
Turn Based Game - Best approach for Server communication. TCP/IP or REST API? I want to create a turn base multiplayer game where each player simultaneously takes his/her actions, and ends the turn. Both will see what the other player did afterwards and the next round begins.

Think of it as some kind of chess, but both players take turns at the same time without seeing it until both end their turn.

I though about a server software that creates direct TCP/IP connections to both players and communicates the necessary stuff like what the other player did, who lost/won ect. The usual stuff.

But thinking of TCP/IP port limitations this could mean a limitation of about 65000+ users per server? Meaning 32500 active matches per server?

Then I thought about some kind of dispatcher. Like a REST API server that generates a unique game id and all players call the service with their ID (e,g transferring everything with JSON or some binary data).

I am not quite sure which approach is the better one. Maybe I am wrong at some point? Running a background service for each match seems to be my approach for both solutions (GameManager Class instance creation or a new process gets started communicating via named pipes or localhost). Maybe someone has some experience with this or another great idea? :)

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:
Drawing the box2D rectangles i'm using SDL2.0/OpenGL + Box2D with C++ to learn some stuff about games, so i created two rectangles bodies: a small box(dynamic) wich will fall into the second body: the ground(static), i draw them on the screen with OpenGL primitives, as recomended i'm not using "pixel thinking", i'm using meters to represent everything, well, the problem is that i can't get a good physic simulation, just almost, when rendering i can see the small box falling into the ground but it don't touch the ground, it gets real close but don't touch, i really can't understand why, so i came here to see if can get some help:

Here we create the bodies(and do other things):

void MyLoop::onCreate(){
world = new b2World(b2Vec2(0, -10));

player = new Player(world);
//creates the player body
player->create();

//Creates the ground
b2BodyDef bdef;
b2PolygonShape* pshape = new b2PolygonShape();
b2FixtureDef fdef;

bdef.type = b2_staticBody;
ground = world->CreateBody(&bdef);

pshape->SetAsBox(40.0f, 1.0f);
fdef.shape = pshape;

ground->CreateFixture(&fdef);
ground->SetTransform(b2Vec2(20.0f, 0.5f), 0);

glMatrixMode(GL_MATRIX_MODE);
glLoadIdentity();
//configurating the apropriate scale
glOrtho(0, 40, 0, 20, 1, -1);

delete pshape;
}

The most important here is the bodies creation and the glOrtho call wich will set the camera to our coordinate system.

The creation of the player body:

b2BodyDef bdef;
bdef.type = b2_dynamicBody;

pbody = world->CreateBody(&bdef);

b2PolygonShape* pshape = new b2PolygonShape();
pshape->SetAsBox(0.5f, 1.0f);

b2FixtureDef fdef;
fdef.shape = pshape;
pbody->CreateFixture(&fdef);
pbody->SetTransform(b2Vec2(19.0f, 10.0f), 0);

So now we go to the render loop: i get the bodies position with getPosition() method and use them to draw the bodies:

glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);

player->render();

float x = ground->GetPosition().x;
float y = ground->GetPosition().y;

renderer.begin(GL_QUADS);
renderer.setColor(0.0f, 0.0f, 1.0f);
renderer.drawRectangle(x - 20.0f, y + 0.5f, 40.0f, 1.0f);
renderer.end();

SDL_GL_SwapWindow(window);

world->Step(1 / 20.0f, 8, 3);

The player render:

float x = pbody->GetPosition().x;
float y = pbody->GetPosition().y;

renderer.begin(GL_QUADS);
renderer.setColor(0.0f, 1.0f, 0.0f);
renderer.drawRectangle(x - 0.25f, y + 0.5f, 0.5f, 1.0f);
renderer.end();

sentences: Why does the Modelview Matrix in OpenGL not have accurately signed vector values for look vectors? When I do a GluLookAt(0.0, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0) so that I'm 500 units up on the positive Y axis looking down at the origin with the top vector of the camera pointing toward the negative Z axis, that means my unit vector, mathematically speaking, should be (0.0, -1.0, 0.0) correct?  If I'm looking down toward the negative Y axis now and want to move closer to the origin, I'm supposed to subtract the number of units from my camera's current position of 500 so that the Y value gets smaller which means I'm moving the camera forward in the direction I'm pointing.  How come when I do a glGetFloatv(GL_MODELVIEW_MATRIX, mycopy) to get the current matrix right after the GluLookAt command is executed, I end up getting a Look Vector of (0.0, 1.0, 0.0) so that it's a positive Y value?  mycopy[2], mycopy[6] and mycopy[10] are the look vector values.  I know I can negate it to get the negative Y value but it seems like a cheap move.  Why does OpenGL do this in the modelview matrix when REAL mathematics states that it should be a negative Y value for the look vector?  If anyone can help me understand this, I would greatly appreciate it.  :)

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:
In a HTML/JavaScript game, what audio should I use for Internet Explorer? I'm planning some HTML5/Javascript games. They will be casual games for the most part, but would still benefit from music and sound effects. I would really like to use the <canvas> and <audio> features. I do not anticipate needing to play any movie files like .avi or .mp4.

But I run into a problem. According to this chart, Microsoft Internet Explorer does not support .wav or .ogg! And Safari doesn't support .ogg.

So now I'm making my own chart for what audio files I should use for what browsers. Here it is so far:

                     SFX        Music

Desktop Chrome      .wav        .ogg
Desktop Firefox     .wav        .ogg
Desktop IE          ???         ???
Desktop Safari      .wav        .m4a (alac)
Desktop Opera       .wav        .ogg

Mobile Chrome       .wav        .ogg
Mobile Firefox      .wav        .ogg
Mobile IE            ???        ???
Mobile Safari       .wav        .m4a (alac)
Mobile Opera        .wav        .ogg

(I could not find any info for Microsoft Edge on whether .wav or .ogg will work in the <audio> tag.)

As you can see, the big question lies in Internet Explorer. What audio formats should I use for sound effects and music?

It appears that HTML5 only supports 3 types: mp3, wav, and ogg. So for Safari I will need a plugin or some way to play .m4a music natively if possible. mp3 is out of the question due to absurd licensing fees. Flash/Shockwave is out of the question too.

I have read that something called bgsound can be used in IE, but it's "not standard". I've never used it before and don't know what it is.

So what audio formats should I use for IE? What is the "normal" way that IE plays sound and music in the first place? I really hope I don't need some plugin like Silverlight because those are a pain to users, especially casual game users.

sentences: Does bad AI lead to more sales? Games like HL2 and FEAR are legendary for having excellent AI. Recent titles (as of 2018) leave much to be desired. With improvements in our understanding of probability related state machines, and general machine learning (or AI as it's called sometimes) improves, it generally feels many commercial titles forego the development of good AI. Anecdotally, I have personally experienced in recent titles (where the AI is dumb as per say - far cry, wildlands, etc.). I feel having dumb AI may sell games more (giving a more accomplished feeling, pushing players towards multiplayer, etc.). So, let me pose the question, does any research show that bad AI leads to more sales?

sentences:
Math and physics, where to start? the only math I know how is to add the velocity to position. Thats it. i would like to know how to do more stuff, physics, collision detection with stuff other than perfect circles, etc.
But where ever I go online to find source to learn I always end up with something that assumes prior knowledge, which is understandable in a lot of cases. But I don't know where to go to learn math and physics from the absolute beginnings. Also I'm dyslexic, so sites or ressources with just definitions of concepts and no relatable examples wont help that much. So could someone give me some links to books and/or sites that can help me learn math and physics for game development.

sentences:
Raytracer texture mapping (to triangle mesh) leaving artifacts So I am trying to get OBJ loading working in my raytracer. Loading OBJs works fine, but I am having some trouble with getting the texture mapping working.

Here is an image of my result. It is supposed to be a black sphere with colored "latitude and longitude" lines, with a black spot in the middle. But it seems like every second triangle is left black. You can see the result here:

My prof said that it looks like the normals are backwards, but I don't think that is the case because the shape is still being hit - and the color of the "wrong" triangles is the color of background color of the texture (ie. black in this case).

When I load the OBJ, each vertex has a UV coord associated with it. What I do to get a UV coord when a ray hits the shape is as follows:

T: the triangle that was hit
hp: where on the triangle the ray hit
v1,v2,v3: the vertices of the triangle, each has a UV coord UV1, UV2, UV3

find the distance to each v[i] from hp (d1,d2,d3 respectively)
find the weight of each of these (w1 = d1/(d1+d2+d3), same for d2,d3)
find the weighted UV coord: UV1/w1 + UV2/w2 + UV3/w3

find the pixel color based on this weighted coord

Does anyone have any ideas what might be going on? I can post parts of my code if you think that would help.

sentences:
(Efficiently) Generate Unique Random Numbers Sorry my terminology is somewhat limited so I'll have to use more words to explain what I mean.

In games that require critical hits, I've heard it's not good to generate a random number but instead one should randomly pick a number from a list of possibilities then exclude that number from the next picking. This way, the dev is given more control over the player's experience.

To do this, I've been thinking somewhere along the lines of generating a random number then excluding that number from the next generation. In C#, how can I exclude a number from a random number generation? I don't think that using a while loop to continually check for another number if the currently generated one is excluded is a very efficient method, especially when most of the numbers have been excluded. Is there a built-in method to do this or some clever way to implement it?

Not: I need upwards of 100 numbers to possibly generate so hard-coding it would be tedious.

sentences:
VBO interleaving dillema I'm trying to write a map editor for a unity game using openGL. In order to do that, I need to unpack it's resource files to get meshes, textures and other good stuff.

In doing so, I've discovered that unity mesh asset stores vertices, normals, texture data, and any other per-vertex type data in one interleaved array.

I have two choices here. First is to leave the data as is and push it into a single VBO and then use attrib pointer to adjust strides and whatnots to make it work. When I read data from file into memory, I can just read whole array with a single ifstream::read method call.

Second choice is to unravel all data into it's separate channels and have a separate VBO for each data type. I personally prefer it this way, but this means that I need to deinterleave that array. I'm unsure how to do this efficiently. The most obvious way (and very inefficient) is to read it char by char and store each char in appropriate array, depending on channel structure. I could maybe mess with it a bit and set it up to read it channel per channel (meaning 2-4 chars at once) instead of char by char. This still seems very slow to me.

Maybe I could load the whole array into memory and then deinterleave it there, but I'm still unsure of method that would be fast.

The priority is for the program to be fast while drawing, and deinterleaved multiple VBO setup is said to be faster due to lesser amount of cache misses.

To give you a sense of numbers, the game I'm looking at contains about 2630 different mesh assets, with each containing an estimated average of 500 vertices.

How do I deal with this? I will be loading all this data just once on program startup anyway, so it doesn't have to be super fast, but I don't want to force the user to wait for too long even then. Maybe number of vertices altogether is small enough for it to be very fast regardless, but I don't want to commit to either way before I have some idea of what I'm doing.

Bottom line is, should I just leave it interleaved, or is there some efficient way to deinterleave it? Am I jumping the train here, being scared of leaving it interlaved? I know I should probably benchmark both cases, but both cases are drastically different in my case and would require huge code changes, not to mention I'm nowhere close to actually drawing the scene I need to.

sentences:
GLSL - std140 uniform block - fields(vec, float, mat4) always 0.0 Ok,

First of all, if just use uniforms everthing works like it should. Switching to uniform blocks nothing goes, as all values look like 0.0.  I tested this with various if-then-else stuff within the vertex shader and modifying the output color.

According to CodeXL 1.3(here the data is listed as VBO, but I think this is only cosmetic), GL.BindBuffer with GL.MapBuffer, or GL.GetBufferSubData there is really the proper data within my ubo but nonetheless the uniform block in the shader contains 0.0 only.

workflow:

    //Create UBO
    BufferUBOName = new int[2];
    GL.GenBuffers(2, BufferUBOName); // Generate the buffer
    BufferIndex = 0;

    GL.BindBuffer(BufferTarget.UniformBuffer, BufferUBOName[0]); // Bind the buffer for writing
    GL.BufferData(BufferTarget.UniformBuffer, (IntPtr)uboWorldData.SizeInBytes, IntPtr.Zero, BufferUsageHint.StreamDraw);  // Request the memory to be allocated
    GL.BindBufferRange(BufferRangeTarget.UniformBuffer, BufferIndex, BufferUBOName[0], IntPtr.Zero, (IntPtr)uboWorldData.SizeInBytes); // Bind the created Uniform Buffer to the Buffer Index

Creating and linking the shaders works fine and gives the following ouput :

GL   4.3
GLSL 4.30
Shader: basic_fs ok
Shader: basic_vs ok
ShaderProgram :hexgrid [ basic_vs, basic_fs ]
    Active Uniform Block : UboWorld
      Size         : 144
      BlockBinding : 1
      BufferPoint  : 0
        Name : UboWorld.time
          Type[n] : Float [4]
          Offset  : 0
        Name : UboWorld.screenwidth
          Type[n] : Int [4]
          Offset  : 4
        Name : UboWorld.screenheight
          Type[n] : Int [4]
          Offset  : 8
        Name : UboWorld.promat
          Type[n] : FloatMat4 [64]
          Offset  : 16
          matrix stride: 16
        Name : UboWorld.mvpmat
          Type[n] : FloatMat4 [64]
          Offset  : 80
          matrix stride: 16

    // Done after successful program linking
    uniformBlockIndices["ubodata"] = GL.GetUniformBlockIndex(shaderprog.Handle, "UboWorld"); // Gets the uniform variable Location
    if (uniformBlockIndices["ubodata"] != -1)
        GL.UniformBlockBinding(shaderprog.Handle, uniformBlockIndices["ubodata"], BufferUBOName[0]);

Then VBO / VAO are created and working fine, incl. drawing elements.

On UpdateFrame the UBO data will be processed like:

    GL.BindBuffer(BufferTarget.UniformBuffer, BufferUBOName[0]);
    GL.BufferSubData(BufferTarget.UniformBuffer, IntPtr.Zero, (IntPtr)uboWorldData.SizeInBytes, ref uboWorld);

The offsets are taken from the information after program linking and reading the various values for the UniformBlockActiveUniforms. I skip the output here as the struct should reflect it properly.

    [StructLayout(LayoutKind.Explicit)]
    struct uboWorldData
    {
        [FieldOffset(0)]
        public float time;
        [FieldOffset(4)]
        public Int32 screenwidth;
        [FieldOffset(8)]
        public Int32 screenheight;
        [FieldOffset(16)]
        public Matrix4 projectionMatrix;
        [FieldOffset(80)]
        public Matrix4 modelviewMatrix;

        public static readonly int SizeInBytes = 144;
    };

Vertex shader for testing:

    #version 400
    in vec3 in_position;
    in vec3 in_normal;
    out vec3 normal;
    out vec3 colortime;
    out vec3 colortimeubo;

    // These uniforms work
    uniform mat4 mvpmat;
    uniform mat4 promat;
    uniform float time;

    // This compiles fine. But always 0.0
    layout(std140) uniform UboWorld {
        float time;
        int screenwidth;
        int screenheight;
        mat4 promat;
        mat4 mvpmat;
    } w;

    const float pi = 3.1415;

    void main()
    {
      // This uses the UNIFORM FLOAT
      colortime = vec3(abs(sin(time * 360.0 * pi / 180.0)), 0.3, 0.3);
      // Here the uniform UboWorld
      colortimeubo = vec3(abs(sin(w.time * 360.0 * pi / 180.0)), 0.3, 0.3);

      normal = (mvpmat * vec4(in_normal, 0)).xyz;
      gl_Position = promat * mvpmat * vec4(in_position, 1);
    }

Any hints why w.time and also w.mvpmat or w.promat are always zero filled ???

sentences:
Converting a multidimensional array to a distance field I've been working (as so many others before me have) on a small Voxel-type game prototype.
So far, i have a 3d array (16 by 16 by 255 elements) that contains block ids - and as of right now, 0 means "no block"/"air", and "1" means "block".
For the purposes of isosurface extraction (for use with e.g. Marching Cubes), i now want to convert this format to a distance field - but i am having a hard time understanding how to do this.
Can anyone give a short explanation or point me in the right direction?

sentences: MonoGame minimises when I click on second game window I've problem with my MonoGame project. I have one full-screen game window and one window form with some info (part of the game too). And the problem lies in when I click on the window form, the main window is minimised. So my question is, how to let the game window on full-screen.

sentences:
Problem getting in adjust the image in drawable canvas I am working on the game which i develop on android and i am just stuck on adjust the images. I want the spinning ball image in center where i targeted the red color on the given image and the both bottom left and right player images on yellow mark on the given images.

Here is the some code i used for dice and the player :-

Dice :-

dice.get(0).setPosition((gWidth + dice.get(0).getWidth()) / 300,
                    (gHeight + dice.get(0).getHeight()))

Player 1 and player 2 :-

male = BitmapFactory.decodeResource(getResources(), R.drawable.male);
    canvas.drawBitmap(male, 0, canvas.getHeight() - male.getHeight(), null);
    female = BitmapFactory.decodeResource(getResources(), R.drawable.female);
    canvas.drawBitmap(female, canvas.getWidth() - female.getWidth(), canvas.getHeight() - female.getHeight(), paint);

sentences:
Best way of implementing custom UI objects jawa.awt.Graphics What is the best way to implement custom sliders (for volume), buttons normal, with images (icons) and with text, text boxes and other stuff with java.awt.Graphics?

Thanks,
Kerdo

sentences:
Make a plane to display material from both sides I know there is a setting in Cry Engine, which allows you to be able to read materials of the plane from both sides, so I am wondering if there is such a setting in Unity5.

Thanks in advance

sentences:
Tetris: 2D Rotation Matrix? I'm creating a Tetris clone right now. I've got the tiles of tetromino stored as an std::array<tile, 4>. Each tile holds its (x,y) coordinates relative to the piece. For example, the t-block is:

(-1, 0)
( 0, 0)
( 1, 0)
( 0,-1)

I want to create a function: rotate(const bool clockwise) that applies a 2D rotation matrix to the tiles to rotate the block either 90 degrees clockwise, or 90 degrees counter-clockwise.

After doing some reading on rotation matrixes, I've found that a 2D rotation matrix looks like this:

 cos(angle), sin(angle)
-sin(angle), cos(angle)

Since I'm doing 90 degrees only, I figure it should look like this:

//clockwise
 0, 1
-1, 0

//counter-clockwise
 0,-1
 1, 0

After doing some more reading on how to multiply matrixes, multiplying the tile position by the matrix gives me this:

//(-1, 0) should end up as (0, 1) if rotated clockwise

-1                     0, 1                1,-1
 0  /*multiplied by*/ -1, 0  /*gives me*/  0, 0

My question is how do I get an (x,y) position out of that result? Am I missunderstanding how matrixes work? Is there a more trivial way to rotate coordinates around the axis by 90 degrees?

sentences: Algorithm for generating a 2d maze What algorithm have you used in the past to generate a simple 2d maze?

sentences:
How to check if a game object is inside another gameobject My idea is that there is a plane which is more of a border at top of the screen and if a game object has no more space to fall and it collides with something while it is in that border, the game ends. How can I check if a gameobject is inside that plane?

Example:

sentences:
How can I implement scrolling endless road in XNA? I am developing XNA game like following screenshot.

I created my 3D objects and camera so I have models. But how can I implement scrolling road in XNA?

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:
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:
How can I create a "fuzzy crayon" effect? I spent sometime looking at Media Molecule's Dreams. In it, the user is allowed to  fuzzy crayon strokes in the mid air (in 3D space)(at the point of the video around 43:00).

How can I implement a similar effect? Is it a polygon with texture or some complex particle system? I believe it have something to do shader but not sure how.

sentences:
What are good, simple action games/action RPGs to emulate? There is standard advice for game development to start off emulating simple games you know and build up from there. Which makes me wonder. What are good examples of action games or action RPGs that are very simple to begin with to try and emulate? What is necessary and what is superfluous?

Please link to the game's site (or Wikipedia page if it's defunct) if you can, and only one game per answer please.

sentences:
How can I draw an arrow at the edge of the screen pointing to an object that is off screen? I am wishing to do what is described in this topic:

http://www.allegro.cc/forums/print-thread/283220

I have attempted a variety of the methods mentioned here.

First I tried to use the method described by Carrus85:

  Just take the ratio of the two triangle hypontenuses (doesn't matter which triagle you use for the other, I suggest point 1 and point 2 as the distance you calculate). This will give you the aspect ratio percentage of the triangle in the corner from the larger triangle. Then you simply multiply deltax by that value to get the x-coordinate offset, and deltay by that value to get the y-coordinate offset.

But I could not find a way to calculate how far the object is away from the edge of the screen.

I then tried using ray casting (which I have never done before) suggested by 23yrold3yrold:

  Fire a ray from the center of the screen to the offscreen object. Calculate where on the rectangle the ray intersects. There's your coordinates.

I first calculated the hypotenuse of the triangle formed by the difference in x and y positions of the two points. I used this to create a unit vector along that line. I looped through that vector until either the x coordinate or the y coordinate was off the screen. The two current x and y values then form the x and y of the arrow.

Here is the code for my ray casting method (written in C++ and Allegro 5)

void renderArrows(Object* i)
{
    float x1 = i->getX() + (i->getWidth() / 2);
    float y1 = i->getY() + (i->getHeight() / 2);

    float x2 = screenCentreX;
    float y2 = ScreenCentreY;

    float dx = x2 - x1;
    float dy = y2 - y1;
    float hypotSquared = (dx * dx) + (dy * dy);
    float hypot = sqrt(hypotSquared);

    float unitX = dx / hypot;
    float unitY = dy / hypot;

    float rayX = x2 - view->getViewportX();
    float rayY = y2 - view->getViewportY();
    float arrowX = 0;
    float arrowY = 0;

    bool posFound = false;
    while(posFound == false)
    {
        rayX += unitX;
        rayY += unitY;

        if(rayX <= 0 ||
            rayX >= screenWidth ||
            rayY <= 0 ||
            rayY >= screenHeight)
        {
            arrowX = rayX;
            arrowY = rayY;
            posFound = true;
        }
    }

    al_draw_bitmap(sprite, arrowX - spriteWidth, arrowY - spriteHeight, 0);
}

This was relatively successful. Arrows are displayed in the bottom right section of the screen when objects are located above and left of the screen as if the locations of the where the arrows are drawn have been rotated 180 degrees around the center of the screen.

I assumed this was due to the fact that when I was calculating the hypotenuse of the triangle, it would always be positive regardless of whether or not the difference in x or difference in y is negative.

Thinking about it, ray casting does not seem like a good way of solving the problem (due to the fact that it involves using sqrt() and a large for loop).

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:
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:
“Play Now” via website vs. download & install I've spent some time looking over the various threads here on GDSE and also on the regular Stackoverflow site, and while I saw a lot of posts and threads regarding various engines that could be used in game development, I haven't seen very much discussion regarding the various platforms that they can be used on.

In particular, I'm talking about browser games vs. desktop games.

I want to develop a simple 3D networked multiplayer game - roughly on the graphics level of Paper Mario and gameplay with roughly the same level of interaction as a hack & slash action/adventure game - and I'm having a hard time deciding what platform I want to target with it. I have some experience with using C++/Ogre3D and Python/Panda3D (and also some synchronized/networked programming), but I'm wondering if it's worth it to spend the extra time to learn another language and another engine/toolkit just so that the game can be played in a browser window (I'm looking at jMonkeyEngine right now).

Is it worth it to go with engines that are less-mature, have less documentation, have fewer features, and smaller communities* just so that a (possibly?) larger audience can be reached? Does it make sense to even go with a web-environment for the kind of game that I want to make? Does anyone have any experiences with decisions like this?

(* With the exception of Flash-based engines it seems like most of the other approaches have downsides when compared to what is available for desktop-based environments. I'd go with Flash, but I'm worried that Flash's 3D capabilities aren't mature enough right now to do what I want easily. There's also Unity3D, but I'm not sure how I feel about that at all. It seems highly polished, but requires a plugin to be downloaded for the game to be played -- at that rate I might as well have players download my game.)

For simple & short games the Newgrounds approach (go to the site, click "play now", instant gratification) seems to work well. What about for more complex games? Is there a point where the complexity of a game is enough for people to say "OK, I'm going to download and play that"?

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:
2D Matrix Transformation (with a Player and Ground) I have a simple game that I'm trying to do for learning purposes, but Matrices are a bit hard, especially in DirectX.

I currently have a tilesystem that renders tiles at the screen and a character position at the center (on startup)

When the player move to the left, the ground should move to the right so he's always at the center of the screen. I use a Sprite to transform the Tiles and the player, but having trouble because the ground is moving and the player stands still on the ground still positioned at the center.

This is a topdown 2D game so I only need to transform Position (and perhaps rotation)

My Camera class has this method:

D3DXMatrixTransformation2D(&View, NULL, 0, &Scale, &Center, D3DXToRadian(Rotation), &Position);

I've also tried (for the Camera):

D3DXMatrixTranslation(&View, Position.x, Position.y, 0);

then when I render the ground sprite I set it to transform to the camera, but the Player has it's own Matrix that I use when he's moving.

Exactly like the one above but with his position, rotation and such...

What am I missing and what do I need?

I only have a tilesystem that fits the width/height of the screen so I should see when he's moving but he's standing still at the center and the ground and the player is moving.

Do I need to invert the matrix so that the ground moves in the opposite direction?

sentences:
Calculating the latitude & longitude of a raycast hit point on a sphere I am working on a game where you look at a sphere and get the latitude and longitude of the position.

I get the position on the globe with a raycast along the direction the user is looking. Using this I pass the position and the radius into a method to get the correct latitude and longitude.

Problem

I don't believe my math is correct on this one and I am having some trouble figuring it out.

Code

void Update () {

    if (Physics.Raycast(transform.position, direction: transform.forward, hitInfo: out hit, maxDistance: range))
    {
        Vector3 pointHit = hit.point;
        radius = earth.GetComponent<SphereCollider>().radius;
        //radius = earth.GetComponentInChildren<Renderer>().bounds.extents.magnitude;
        FromVector3(pointHit, radius);
    }
}

public void FromVector3(Vector3 position, float sphereRadius)
{
    float lat = (float)(Math.Acos(position.y / sphereRadius));
    float lon = (float)Math.Atan(position.x / position.z);

    //convert from radians to degrees
    lat *= Mathf.Rad2Deg;
    lon *= Mathf.Rad2Deg;

    Debug.Log(lat + ", " + lon);
}

Output

My Output for latitude ranges from 89 to 90 and doesn't change very much

My Output for longitude ranges from -11 to 11

sentences:
Logging of method calls for recreation Some games have the option to let you play offline and sync with a server once you have internet again. To prevent cheating and validate if it was an authentic play, usually some sort of log of all input actions is sent and validated afterwards on the server.
In my case I would be interested in a single MonoBehaviour and having all its method calls logged with the its parameters values. Giving this input, the game result output should be the same. (There is no random involved and no physics interaction)

One way would be just a writer at the start of each method that logs the timestamp, method name and paramter
Another would be maybe something like a multi delegate inbetween that calls both my method and a writer class

Is there something build-in in Unity that does this already like an annotation for the methods I want to track or something like an audit interface?

sentences:
Vertical alignment of a padded font generated by Hiero in libgdx I've generated bitmap fonts for libgdx using Hiero. I've got several distance field fonts that require a lot of padding, unfortunately they don't seem to align correctly.

Below is a font with a bounding box drawn to the values returned from getBounds().

I've just changed to distance field fonts and all my logic that handles vertical positioning is broken because of this. If I use a font without any padding above or below then fonts are drawn aligned correctly.

My padding is 10 on all sides. Playing with a couple of characters, if I increase the y by 10 and decrease the height by 10 in the .fnt file I get the image below instead, which looks far more accurate.

If someone can tell me how I can resolve this issue, or a good way to work around it then that would be appreciated.

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:
Unity Plugin DLLNotFoundException I am using a plugin DLL that I created in Visual C++ Express 2010 on windows 7 64 bit Ultimate Edition. The DLL functions properly on the machine that it was originally created on.

The problem is that the DLL is not functioning in the Unity3d Editor on another machine and giving an error that basically states that the DLL is missing some of its dependencies. The target machine is running Windows 7 Home 64 bit (if this is relevant)

Results from the error log of Dependency Walker:

Error: The Side-by-Side configuration information for "c:\users\dewayne\desktop\shared\vrpnplugin\unityplugin\build\release\OPTITRACKPLUGIN.DLL" contains errors. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail (14001). Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. Error: Modules with different CPU types were found. Warning: At least one delay-load dependency module was not found. Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

The Visual C++ Express 2010 project and solution file can be found here: https://docs.google.com/leaf?id=0B1F4pP7mRSiYMGU2YTJiNTUtOWJiMS00YTYzLThhYWQtMzNiOWJhZDU5M2M0&hl=en&authkey=CJSXhqgH The zip is 79MB and also contains its dependencies.

The DLL in question is OptiTrackPlugin.dll

sentences:
A 2D Camera Follow Script That Does Not Rotate? I am attempting to make a 2D racing game. So far I have a player car (sprite) and a main camera.

I would like to know how to make the main camera follow the player car while still showing signs of movement (I don't want the positions to match exactly in the middle of the screen).

My Player Car has a Rigidbody2D and a MoveCar script

using UnityEngine;
using System.Collections;

public class MoveCar : MonoBehaviour {

    public float speed = 10f;
    public float gravity = 0f;

    void CarMove ()
    {
        if(Input.GetKey(KeyCode.RightArrow))
        {
            transform.Translate(Vector2.right * speed * Time.deltaTime);
        }
    }

    // Update is called once per frame
    void Update ()
    {
        CarMove();
    }
}

Then there is my Main Camera, its projection is switched to Orthographic and has default settings as well as a FollowCar script:

using UnityEngine;
using System.Collections;

public class FollowCar : MonoBehaviour {

    public Transform player;

    public GameObject other;
    public Rigidbody2D rb = other.GetComponent<Rigidbody2D>;

    void Update()
    {
        transform.Translate(Vector2.right * .5f * Time.deltaTime);
        Vector2.MoveTowards( Vector2 , Vector2 player,
    }
}

I would like to know where to go next or if I'm even going in the right direction. I have no idea how to utilize the MoveTowards() function.

sentences:
Instantiation of multiple objects with varying velocities I am looking to multiple objects of the same prefab at the same time with varying velocities.

public GameObject prefab;
public float xDirection;
public float yDirection;
void Update () {
        GameObject prefab1 = Instantiate
        (prefab,transform.position,quaternarion.identity) as GameObject;
        GetComponent<RigidBody2D>().velocity = new Vector2 (xDirection,yDirection);
}

I want to create three instances at once, but have the x/y direction be different. I am looking at creating an instance at three separate velocities. I know I can do something like this using

void Update () {
if (Input.GetKey(KeyCode.space)){
    xDirection = 1f;
    yDirection = 1f;
    shootObject();
    xDirection = 2f;
    yDirection = 2f;
    shootObject();
    xDirection = 2f;
    yDirection = 2f;
    shootObject();
    }
}
void shootObject () {
    GameObject prefab1 = Instantiate
        (prefab,transform.position,quaternarion.identity) as GameObject;
        GetComponent<RigidBody2D>().velocity = new Vector2 (xDirection,yDirection);
}

but I feel like there is something else that I should be able to do to simplify this even further since this seems to be very messy code.

(I apologize if something seems a little odd. Have only been coding for around a few weeks.)

Thank you for the help!

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

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

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

sentences:
Reduce emission of sphere object with HDRP material I have a material which I have assigned to be used on a sphere game object which acts as stars.

This is what the settings are set to:

And this is what the Game View looks like:

I have also tried setting emission intensity to 0 nits and exposure weight to the minimum (0), but some stars still are far too bright, below is a screenshot of what it looks like with the altered emission intensity and exposure weight:

The bigger stars are far too emissive. I am trying to give each star a little glow. How do I reduce the emission?

sentences:
Spherical fractal noise generator in shader I have a growing sphere in space, and I thought of having a procedural generated texture over it. Since it is growing, I thought a fractal would be a great choice, because more details would be visible the larger the sphere get (and I could mess with some parameter over time to have it animated).

A quick Mandelbrot implementation in GLSL showed it would be too expensive to have it in the devices I am targeting; also, I don't know how to map a cool looking fractal over complex plane onto a sphere without distortions (I expect the players to fly around this sphere in every direction, so there should be no "glued" edges or collapsed points), neither I have the background to devise/project a fractal over the spherical surface myself (probably was done before, but I could not find).

So weighting the requisites of the procedural texture:

Fast to run, for low-end/mobile GPU;
Over a spherical surface domain;
Growing in details with growing in size;
Possible to animate (BONUS);
Cool looking (of course);

then I thought it might be impossible within the constraints. But since I am no expert in this fractal thing, I thought I could ask it here first before scraping out the idea.

Maybe it is really not a fractal I need, and there is some other kind of noise with growing details I could use. Do you know of such noise generation procedure?

Do you know of any noise generator with uniform distribution over spherical sufaces, or any fractals whose domain is a sphere?

Can you suggest any alternatives for my situation?

sentences:
translate-scroll repeated 2d texture using opengl shader I managed to implement an infinite 2d texture scrolling using the following shader. btw I'm using cocos2d-x 2.2.1.

The vertex shader:

attribute vec4 a_position;
attribute vec2 a_texCoord;

#ifdef GL_ES
varying mediump vec2 v_texCoord;
#else
varying vec2 v_texCoord;
#endif

void main()
{
    gl_Position = CC_MVPMatrix * a_position;
    v_texCoord = a_texCoord;
}

The fragment shader:

#ifdef GL_ES
precision lowp float;
#endif

uniform vec2 u_time;
uniform vec4 u_color;
varying vec2 v_texCoord;
uniform sampler2D CC_Texture0;

void main()
{
        gl_FragColor = texture2D(CC_Texture0, v_texCoord + u_time);
}

But once I try to add some uniform color the texture is no more repeated correctly (and performance decreases drastically):

/// Texture not repeated correctly and performance degradation
gl_FragColor = texture2D(CC_Texture0, v_texCoord + u_time) * u_color;

However the following repeat the texture correctly (but of course there's no scrolling)

gl_FragColor =  texture2D(CC_Texture0, v_texCoord) * u_color;

What am I doing wrong?

sentences:
Using delta time for movement I'm currently involved in a college assignment where we must create a game with our own game engine. In my game, we have an enemy moving around with paths constructed with a A* algorithm. Every frame I update his position but this is too dependent on the computer. Can you guys help to figure out how to solve this?

I tried to make him move only in even frames but, again, it's too time dependent and it's not smooth.

sentences:
Problem with moving player through a secript by a set distance I am currently trying to add a sort of "dash"-ability to my sidescroller.

What I try to do, is to let the player press a key where a simple key-press causes the player to move quickly into one direction by a predefined distance. During that dash, the character controller is disabled so the player is not able to cancle the dash itself. after the dash, the character controller is enabled again and the dash ability is disabled, so to say on cooldown.
Though the "predefined distance" is what isn't working.

The code for it I have so far is as following.
I have a script for choosing the animations and reacting to key Input, this script includes the following in it's Update method ("a" and "d" are set for the Dash). pstats is my object for the variables in the Player-script.

        float dashing = Input.GetAxis ("Dash");

    if (Input.GetKey ("a") && pstats.dashUsable)
    {
        pstats.DashLeft();
    }
    if (Input.GetKey ("d") && pstats.dashUsable)
    {
        pstats.DashRight();
    }
    if (!pstats.dashUsable)
    {
        dashing = 0.0f;
    }

My Playerscript contains:

    public bool dashUsable = true;
public bool dashUsing = false;
public bool attacking = false;

private IEnumerator WaitForNextDash() {
    yield return new WaitForSeconds(1.0f);
    dashUsable = true;
    Debug.Log("WaitForNextDash Done");
}

private IEnumerator WaitForDashToEnd() {
    yield return new WaitForSeconds(1.0f);
    Debug.Log ("dashUsable being changed");
    dashUsable = false;
    dashUsing = false;
    attacking = false;
    controller.enabled = true;
    StartCoroutine (WaitForNextDash ());
    Debug.Log("WaitForDashToEnd Done");
}

// The two lines below are to create the proper facing-direction for the player
Quaternion targetf = Quaternion.Euler(0, 270, 0);
Quaternion targetb = Quaternion.Euler(0, 90, 0);

public void DashLeft()
{
    attacking = true;
    dashUsing = true;
    controller.enabled = false;
    Debug.Log ("Dash-Left-Skill in use");
    transform.rotation = Quaternion.Slerp (transform.rotation, targetf, Time.deltaTime * 5000.0f);
    transform.position = Vector3.MoveTowards (transform.position, Vector3.right * -100f, 20 * Time.deltaTime);
    StartCoroutine (WaitForDashToEnd ());
}

public void DashRight()
{
    attacking = true;
    dashUsing = true;
    controller.enabled = false;
    Debug.Log ("Dash-Right-Skill in use");
    transform.rotation = Quaternion.Slerp(transform.rotation, targetb, Time.deltaTime * 5000.0f);
    transform.position = Vector3.MoveTowards (transform.position, Vector3.right * 100f, 20 * Time.deltaTime);
    StartCoroutine (WaitForDashToEnd ());
}

(Sorry for the large blocks of Code, but I thought to better include both)

The problem now is that instead of one button press causing a movement by a set distance... like 100 on the x-axis, the player moves as long as the key is hold. Also, the cooldown for some reason is direction dependant, meaning, if I dash to the right, the cooldown works for the right side, though I can dash to the left directily after without cooldown.

What I am trying to get is to have the WaitForDashToEnd to have a duration that fits the duration of the dash movement itself, I can fix that up as soon as I have the actual dash working. Since the dash movement doesn't work as intented yet, the "stun" during the dash isn't fully functional yet either, but that should more or less fix itself once the dash works.

So... how can I manage to have the dash work as a movement over a predefined distance, no matter how long the key is held?

edit: on a sidenote, during dash, the player is oddly lifted a bit above the ground, is there a way to fix that too? In either case, the dash itself has priority.

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:
Using single Triggers on multiple controllers in Unity After trying out a lot of stuff I finally need to surrender. Im having a project where I want to use the triggers of the Xbox Controllers seperately. To do so I added them as axis 9 and 10 in the input manager (see image). Now, when i have multiple controllers connected on project startup the triggers wont get recognized. I have to press the trigger on two controllers to get a value from it...prettty strange. If i reconnect the controllers after project launch everything works fine...

Test script looks like this.

Thanks!

sentences:
How is Unity's [Command] supposed to behave? Here's a very simple class/call hierarchy:

public class NetworkPlayer : NetworkBehaviour {
    public static NetworkPlayer localPlayer {
        get;
        private set;
    }

    [Command]
    public void CmdTurnDone() {
        Debug.Log("Turn done! isServer "+isServer+" isClient "+isClient+" isLocalPlr "+isLocalPlayer);
    }
}

public class SomeMonoBehaviour : MonoBehaviour {
    void Update() {
        NetworkPlayer.localPlayer.CmdTurnDone();
    }
}

When Update() gets executed on the host, it outputs as expected:

  Turn done! isServer True isClient True isLocalPlr True

Now, when Update() is executed on the remote client it outputs the following at the remote client's log only. However, the message does not appear at the server's logs:

  Turn done! isServer False isClient True isLocalPlr True

What puzzles me is why the message appears at the remote client's log only.

If I'm not mistaken, calling CmdTurnDone() at the remote client should execute it on the server. But why does the log message appear at the remote client's log instead of on the server's logs - where it is executed? Is it valid to call CmdTurnDone() from a MonoBehaviour?
Do you have any ideas why it's behaving like this? Is this the intended behavior? Thank you.

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:
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:
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: Normal map does not export into .dae file. Does Collada not support normal maps? Every time I try to use DAE FBX export in Autodesk Maya and export a .dae file the normal map doesn't export with it? Does Collada not support normal maps?

sentences:
Managing game state / 'what to update' within an XNA game 'screen' I'm trying to figure out how best to manage state within my game screens - please bare with me though! At the moment I'm using a heavily modified version of the fantastic game state management example on the XNA site available here. This is working perfectly for my 'Screens' - 'IntroScreen' with some shiny logos, 'TitleScreen' and a 'MenuScreen' stacked on top for the title and menu, 'PlayScreen' for the actual gameplay, etc. Each screen has the a bunch of sprites, and an 'Update' and 'Draw', managed by a 'ScreenManager'.

In addition to the above, and as suggested as an answer to my other question here, most screens have a 'GameProcessQueue' class full of 'GameProcess'es which lets me do just about anything (animations, youbetcha!), in any order, in sequence or parallel.

Why mention all this? When I talk about managing game state I'm thinking more for complex scenarios within a 'Screen'. 'TitleScreen', 'MenuScreen' and the like are all relatively simple. 'Play Screen' less so. How do people manage the different 'states' within the screen (or whatever you call it) that 'does' gameplay? (for me, the 'PlayScreen')

I've thought about the following:

Enum of different states in the Screen, 'activeState' enum-type
variable, switching on the enum in the Screen Update() loop to
determine what Screen Update 'sub'-function is called. I can see this getting hairy pretty fast though as screens get more complex and with the 'PlayScreen' becoming a behemoth mega-class.
'State' class with Update loop - a Screen can have any number of 'States', 1+ of which are 'active'. Screen update loop calls update on all active states. States themselves know which screen they belong to, and may even belong to a 'StateManager' which handles transitioning from one state to the next. Once a state is over it's removed from the ScreenState list. The Screen doesn't need a bunch of GameProcessQueues, each State has its own.
Abstract Screen further to be more flexible - I can see the similarities between what I've got (game 'Screens' handled by a ScreenManager) and what I want (states within a screen, and a mechanism to manage them). However at the moment I see 'Screens' as high level and very distinct ('PlayScreen' with baddies != 'MenuScreen' with 4 words and event handlers), where as my proposed 'States' are more intrinsically tied to a specific screen with complex requirements. I think.

This is for a turn-based board game, so it's easier to define things as a discrete series of steps (IntroAnimation -> P1Turn -> P2Turn -> P1Turn ... -> GameOver -> .... Obviously with an open-world RPG things are very different, but any advice in this scenario is appreciated.

If I'm just going OOP-crazy please say so. Similarly I'm concious there's a huge amount on this site re: state management. But as my first 'serious' game after a couple of false starts I'd like to get this right, and would rather be harassed and modded down than never ask :)

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:
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 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: Unity store data in database Is it possible to store assets used in a Unity game (2D or 3D) in the database? I think it is less efficient but want to have single source of truth and maybe have the game contact the database everytime it loads to get the new updates.

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:
XNA / MonoGame - render transparent background using stencil buffer problem (3d) I'm trying to render 3d texture quads with the following properties:

With lighting (rule out "AlphaTestEffect").
Transparent background (no opacity levels, just binary opaque or transparent).
No ordering, eg, I don't want to sort objects by camera distance.

If I just try to render the quads regularly with their transparent background, the result is that even the transparent pixels are written to the depth buffer, which cause a background bug see picture:

So I try to do it with a different way, using the stencil buffer. What I do is the following:

Render just the transparent pixels on the stencil buffer, to create a mask.
Render the texture itself, again, using the stencil buffer I created before.

Now it works with the background renderings, but the problem is that different quads with transparent background hide each other in transparent pixels, as seen here:

I'm not sure if it's because the stencil buffer is not cleared between renders or maybe in one of my steps I mistakenly write to depth?

Anyway here's my code (at least the relevant parts of it):

// set effect and settings for the stencil mask phase
_alphaMaskEffect = new AlphaTestEffect(device);
_alphaMaskEffect.World = Matrix.Identity;
_alphaMaskEffect.AlphaFunction = CompareFunction.Equal;
_alphaMaskEffect.ReferenceAlpha = 0;
_alphaMaskEffect.VertexColorEnabled = true;
_alphaMaskEffect.DiffuseColor = Color.White.ToVector3();
_alphaRenderStencilMaskSettings = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Always,
    StencilPass = StencilOperation.Replace,
    ReferenceStencil = 1,
    DepthBufferEnable = true,
    DepthBufferWriteEnable = false,
};

// set settings for the regular rendering phase
_alphaRenderTextureWithStencilSettings = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Equal,
    StencilPass = StencilOperation.Keep,
    ReferenceStencil = 0,
    DepthBufferEnable = true,
    DepthBufferWriteEnable = true,
};

And here's the draw function itself:

// set settings for the stencil buffer rendering
device.DepthStencilState = _alphaRenderStencilMaskSettings;

// render stencil buffer
foreach (EffectPass pass in _alphaMaskEffect.CurrentTechnique.Passes)
{
    // draw current pass
    pass.Apply();
    device.DrawUserIndexedPrimitives
        <VertexPositionNormalTexture>(
        PrimitiveType.TriangleList,
        Vertices, 0, 4,
        Indexes, 0, 2);
}

// now render the quad with the stencil buffer
device.DepthStencilState = _alphaRenderTextureWithStencilSettings;

// render effect itself
foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
{
    // draw current pass
    pass.Apply();
    device.DrawUserIndexedPrimitives
        <VertexPositionNormalTexture>(
        PrimitiveType.TriangleList,
        Vertices, 0, 4,
        Indexes, 0, 2);
}

tl;dr what's the right way to render 3d quads with transparent background, lighting and without sorting objects by distance from camera? And if it's the code I tried - how do I make the renderings stop hiding each other?

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:
Libgdx opacity partial error My model must support transfer textures but I can't do this using mesh + modelBuilder.part
Opacity is tested correctly on only half of the model.
BlendingAttribute blendingAttribute = new BlendingAttribute();
        blendingAttribute.opacity = 1.0f;

        modelBuilder = new ModelBuilder();
        modelBuilder.begin();
        modelBuilder.part("minecraft:loading_model", mesh, 4, new Material(TextureAttribute.createDiffuse(atlas), blendingAttribute));
        modelInstance = new ModelInstance(modelBuilder.end());

sentences:
Changing text through a cursor hover trigger In my game I have several house groups (see image below), I want to show a specific message when the mouse hovers a specific house group.

For some reason, this only works on the first switch case (house) but fails on the second switch (house2). The default case doesn't work either. I verified that the case house2 is found by the engine. By not working I mean the text does not appear.

Do you have any idea about the problem?

Code:

public class MouseIsOver : MonoBehaviour {

    private Image TipImage;
    private Text textObject;
    public string text;
    private bool displayInfo;

    void Start ()
    {
        TipImage = GameObject.Find("realtyInformation").GetComponent<Image>();
        textObject = GameObject.Find("realtyInformationText").GetComponent<Text>();
        TipImage.enabled = false;
    }
    void Update();
    {
        Display();
    }

    void Display ()
    {
        if (displayInfo)
        {
            switch (text.ToLower())
            {
                case "house":
                    textObject.text = "house text1";
                    break;
                case "house2":
                    textObject.text = "house text2";
                    break;
                default:
                    textObject.text = "Click on the building";
                    break;
            }

        }
        else
        {
            TipImage.enabled = false;
            textObject.text = "";
        }
        TipImage.enabled = true;
    }

    private void OnMouseOver()
    {
        displayInfo = true;
    }

    private void OnMouseExit()
    {
        displayInfo = false;
    }
}

sentences:
Understanding UE4 OpenGL contexts Recently, I was browsing the UE4 source code. I was especially interested in the OpenGL implementation on Windows. The OpenGL "Dynamic RHI" (as they call it) implementation can be found in the Engine\Source\Runtime\OpenGLDrv\ directory.

Contexts

After digging the code, I found out that they have multiple contexts with shared data. At the time of the RHI initialization they create two different contexts (FPlatformOpenGLDevice ctor)

SharedContext which will be the "parent" of every other context
RenderingContext that shares data with SharedContext

From now on, every time a new window is created and a context/viewport creation is requested, a new OpenGL context is created (PlatformCreateOpenGLContext function). Of course these contexts also share data with the SharedContext.

These contexts also own a VAO and a FBO (expect the viewport contexts where the VAO is not created for some reason; see PlatformCreateOpenGLContext function).

OpenGL "facts"

According to multiple sources:

A context can only be active in one thread at a given time
To issue gl* calls, you need an active context (of course)
The drivers basically run in sequential mode - so sending gl commands from multiple threads from multiple contexts will be "queued up" and will be executed in a sequence. And even worse this could cause context switches back-and-forth
So basically there is little or no gain by using multiple contexts (if we are using a single window to render into)

UE4 threading

As far as I know (and according to the source code and the documentation) they have a separate "rendering thread" that is used to execute gl commands. There are multiple functions that are interesting:

PlatformRenderingContextSetup which sets up the rendering context in the current thread (with a little "trick" on Windows)
PlatformBlitToViewport which displays the image on a specific target

My goal

I'm currently working on a basic engine (as a hobby and for educational purposes, needed by the universtiy) that must support multiple windows and "threaded loading". It is important that the resources loaded must be accessible by every window (context) so a shared context will probably be used (that's why I was interested in the UE4's approach).

Also I'd like to understand the reasons behind the UE4 devs' decisions and how their rendering works from a threading + context point of view. Currently I'm not interested in the actual render commands and technologies like deferred shading and so on.

sentences:
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:
Error: Framework 'Mono / .NET 3.5' not installed Recently I installed Ubuntu-Mate 16.10. Unity and Monodevelop works, but when I try to compile the javascript on Monodevelop, appears an error:

Error: Framework 'Mono / .NET 3.5' not installed. (Assembly-CSharp)

On 14.04 all works very well but not here....what is the way to fix this problem??

I searched on the internet and I can't find the answer.

sentences:
How can I spawn multiple monsters in my game? I made a little iPhone game in which I want to make multiple monsters spawn.

I have one UIImageView called enemy that spawns at beginning of the game. But I want it to spawn many more monsters until I say it needs to stop spawning them.

I know how to get random locations. This question is a follow up to this one.

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:
2D Physics: storing previous position vs storing velocity I saw a number of 2d game tutorials and books where previous position of an object was stored in state instead of velocity vector. Velocity is then calculated each frame as a difference between positions.

What are the advantages of that method?

sentences:
Architecture of "doodle jump" type gameplay infinite looping background I am planning make a doodle jump type game, character jumping on platforms. A scrolling or doodle jump like background which ll appear to move when character moves upward and appear moving (just like in doodle jump) so, my thoughts are for this kind of background is

to take a large image i.e of 2048x2048, make 2 planes, set this texture to them, when first image ends other ll move its position on top of first, when second ends first ll move on top of second and so on.
Other approch could be a "Instantiate" and "Destroy" of small images having textures on them according to jumping character position ( which i doubt ll b expensive )

They are my thoughts, I want to go for best approach and would like to listen the best one. Is there any more appropriae way to achieve moveable background, I ll appreciate your suggestions. Thanks.

sentences:
C++ - How to create an engine editor without frameworks like qt and wxWidgets? Basically sometimes I like to try to venture into the world of graphics computing, sometimes I have a project or another that uses opengl plus all the "blind" with opengl, I wanted to be able to create an editor like unreal editor or cry editor, basic functionality like dock widgets, buttons etc, and if it can be integrated with the engine, I've tried to create a windows program with WINAPI but God, that's a torture, a lot of code and in the end it's all blind, you end up having to to guess where each element should be, is usually quite limited having practically no legal content about it, on the other hand it was a hand in the wheel for me, very simple indeed, just the way I wanted it, but it does not give me the freedom that I wanted when it comes to computer graphics, I wanted to do something that was my own, without third-party codes (other than libraries like opengl, vulkan and directx of course).

I've been looking at the banshee code but I'm not sure how they did it to create that WINAPI editor, if companies like capcom and others can, then it should not be difficult.

sentences:
Using sprites in pygame without classes and objects Relevant information

I'm in a grade 11 computer science class that uses Python & Pygame. We're aloud to use sprites and images though we're never taught it, just drawing graphics like squares and circles. We were taught arrays, lists, functions but not classes and objects. We also relatively do things without using functions like the init main one I see a lot on line, we also don't use self or super.

If it's anything relevant, I'm making a top down (bird's eye view) 2D shooter game similar to a 2D version of dead ops arcade in Call Of Duty: Black Ops.

What I'm trying to do

I've been programming with Java & LibGDX before hand. So I want to use sprites in images in Pygame the same way I've been using it in LibGDX. Getting images, obtaining image rectangles for collision, rotating/transforming images, changing the images of the sprite.

Though every tutorial I've seen for sprites and images in Pygame that I can search up uses objects, classes and function calls that I'm not familiar with.

What I've done

I've loaded a PNG into my program and drew it to the screen. Simple and straight forward. Though the Pygame documentation doesn't give me a lot of options in terms of manipulating these images other than moving their location.

What I'm asking for

A simple run down syntax of how I would use a sprite in Pygame, without objects/classes or any weird function terminology. In terms of functions I can make a function, pass information through parameters and return values. I'm not aware of global variables, self or super.

The simplest of simple where I can resize an image, change the image of a sprite, transform/rotate it, and get a rectangle that I can use to overlap with another one.

sentences:
Unity Mechanim makes physics behave weirdly I'm developing a 2D Wrestling game in Unity 5 build 5.1.2f1. It's just the beginning so the character only has a number of animation states and a rigidbody2d.
This is the state machine

and these are the Animator and Rigidbody2D components

Note that I'm using Root motion to animate "High Knee" state since I've animated the character jumping in the air(high knee) by animating character's transform.

This is the simplest form of code to move the character

void Start ()
{
    rb = GetComponent<Rigidbody2D>();
    anim = GetComponent<Animator>();
}

void Update ()
{
    print (rb.velocity);
    if(Input.GetAxis("Horizontal") > 0)
    {
        rb.AddForce(new Vector2(0,50));
        anim.SetBool("isWalking",true);
    }

    else if(Input.GetAxis("Horizontal") < 0)
    {
        rb.AddForce(new Vector2(0,-50));
        anim.SetBool("isWalking",true);
    }

    else if(Input.GetAxis("Vertical") > 0)
    {
        rb.AddForce(new Vector2(50,0));
        anim.SetBool("isWalking",true);
    }

    else if(Input.GetAxis("Vertical") < 0)
    {
        rb.AddForce(new Vector2(-50,0));
        anim.SetBool("isWalking",true);
    }

}

The Character starts moving in x direction with a constant speed as soon as i press the horizontal keys. But for the y axis, when i press up or  down key, character starts at 0 and speeds up really really fast( like 50 milisecs) and then the speed keeps increasing and increasing until i release the key. It still keeps moving but the speed doesn't increase anymore. I'm not sure but i think the former behavior is weird and latter is fine (or vice versa). When i remove all the "anim.SetBool" lines in the above code, speed becomes constant for the y axis too, that is, it starts behaving exactly like the x axis. But when i disable the Animator component, x axis movement starts behaving like y axis, that is, speed starts at 0 and quickly increases and keeps increases as long as the key is held down. When i uncheck the "Apply Root Motion" check box, character doesn't move at all. I don't know what's happening. Any help would be appreciated.

sentences:
Game software design I have been working on a simple implementation of a card game in object oriented Python/HTML/Javascript and building on the top of Django.

At this point the game is in its final stage of development but, while spotting a big issue about how I was keeping the application state (basically using a global variable), I reached the point that I'm stuck. The thing is that ignoring the design flaw, in a single-threaded environment such as under the Django development server, the game works perfectly.

While I tried to design classes cleanly and keep methods short I now have in front of me an issue that has been keeping me busy for the last 2 days and that countless print statements and visual debugging hasn't helped me spot. The reason I think has to do with some side-effects of functions and to solve it I've been wondering if maybe refactoring the code entirely with static classes that keep no state and just passing the state around might be a good option to keep side-effects under control. Or maybe trying to program it in a functional programming style (although I'm not sure Python allows for a purely functional style).

I feel that now there's already too many layers that the software (which I plan to make incredibly more complex by adding non trivial features) has already become unmanageable.

How would you suggest I re-take control of my code-base that (despite being still only at < 1000 LOC) seems to have taken a life of its own?

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 to make variables restart when the game restarts? My game is all in one scene so when my player dies and the user clicks restart the game (when it shows the game over screen) the script below doesn't restart with it so the enemies are still going fast when the user is replaying the game. How do I make it restart when the game restarts?

if (Score % 10 == 0) {
    //Increment movespeed variable from Movement script
    Movement.movespeed += 4;
}

This is used in my score script. The Movement.movespeed is a reference to my movement script attach to my enemies making them go faster when the player collects 10 points.

sentences:
OpenGL Question about scaling 3D Object I got some scaled cubes (1, 2.5, 1) in a 3D Space with a grounded floor with position (0, 0, 0) and scale (100, 0, 100) like in the picture. But why are the cubes scaled out from the center. I want to level them on top of the ground.

This is my matrix manipulation code:

Matrix4f.scale(scale, mMatrix, mMatrix);
Matrix4f.translate(position, mMatrix, mMatrix);

So how is OpenGL scaling my cube, How can I level it?

sentences:
SceneKit flickering with Ambient and Omnidirectional lights I have a project where I have a sphere with a png texture that represents a planet (or a moon in the videos I'm attaching).

Wrapped around that sphere I have a hexasphere (implemented using the results of my question from last year: How to orient a hexagonal tile on a geodesic sphere (Goldberg polyhedron)?).

Almost everything works just fine however I've noticed that in some situations, the hexasphere flickers at some points.

From my experiments, it seems that the problem is the lighting I am using.

The hierarchy of nodes I have is as follows:

bodyContainer    OMNI
    planet         OMNI (sphere, radius:0.987 with image texture as it's only (diffuse) material)
    hexasphere   AMBIENT (hexasphere, radius: 1.0 as described in the linked question)

There are two light sources, both placed at the centre of the "sun" in my larger model.  OMNI is an Omnidirectional light source with default settings.  AMBIENT is an Ambient light source.

The reason that "body" uses OMNI is that I want the planet or moon to have a light and dark side which changes as the body orbits the sun.

The hexasphere that is co-located with the body by being a sibling of the body in the same container.  It needs to use the AMBIENT light source so that it is equally visible on the dark side of the planet or moon.

What I'm noticing, it that when I move the camera further away from the planet, the parts of the hexasphere closest to the camera seem to flicker, and I seem to be able to see through to some of the hexasphere's cells on the opposite of the sphere.

Here are some videos to show what I'm seeing.

This first shows the scene in it's full 'glory' with all nodes in play as described above:

https://youtu.be/o3hdpuLoSbQ

This next one shows the same hierarchy, however I've changed the planet body to use the AMBIENT light instead.  Note that there is no flicker, but also, I've lost the dark/light side of the planet.

https://youtu.be/O0Ca-MrYgJc

In this 3rd video, I've replaced the body texture with a simple translucent blue color, and reverted to using the OMNI light.  It looks great, but the flickering is back.

https://youtu.be/ftGWnaqoN5I

Finally, I've changed back to the AMBIENT light again, but kept the blue body texture.  Note that the flickering is gone again.

https://youtu.be/c6i5vjOEauw

I'm quite positive that this is something I can fix, but I don't understand yet how.  Is this simply a weakness in the lighting mechanisms in SceneKit?

Is there something special I should be doing to allow the outer hexasphere to render cleanly (i.e. without the flickering), with the ambient light, whilst having the inner sphere that is using an omni light?

UPDATE

I've found one solution that appears to work, however I'm not sure if this will result in a lower quality visual overall.  If I set the material property litPerPixel to NO, then the problem I've outlined goes away.  I'm just not sure that the presumed "lower quality" rendering might cause other problems elsewhere.

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:
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:
Schlick Fresnel Shader I hope you are all doing ok.  I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around.  I'm not sure what i'm doing wrong.  I'm using glsl with the Schlick Fresnel algorithm along with a Diffuse BRDF.  A picture says a thousand words, so let me show you the issue I am having.  For debugging purposes, I am only rendering the Fresnel, nothing else.

The following image shows the Fresnel working perfectly from this particular angle (i'm looking along the direction the light is facing)

However, the following image shows the Fresnel not working when I pan the camera around the object to arrive at it's back (facing more or less against the light direction.)

As you can see, the Fresnel didn't change at all when i moved the camera,  It's as if it's "Baked" into the object.

The code for the Schlick algorithm used in this application is:

vec3 Specular_Fresnel_Schlick( in vec3 SpecularColor, in vec3 PixelNormal, in vec3 LightDir )
{
    float NdotL = max( 0, dot( PixelNormal, LightDir ) );
    return SpecularColor + ( 1 - SpecularColor ) * pow( ( 1 - NdotL ), 5 );
}

All calculations are done in world space.

Any help you can provide would be a huge deal.  Thank you for your time.

sentences:
Alternative to world/terrain editing with jmonkey I have been studying Java for almost a year and have been trying to develop a game using jMonkey. I have tried Unity before but since I only know Java I decided to go with jMonkey.

My problem is that the terrain/world edit in jMonkey is buggy. When I make changes to the terrain I sometimes can not save. Many others seem to have the same problem too.

I would also prefer drag n drog exactly like Unity has, but jMonkey doesn't seem to have that.

Is there any other way I can create the terrain/world (with drag n drop like Unity) and then import into jMonkey? What are the alternatives?

sentences:
Drag event inverts in landscape mode I am developing an car game for android  with an UI steering wheel to control the car. I'm following Answer example for the wheel rotation. This is the code to rotate the wheel.

rectT.localEulerAngles = Vector3.back * wheelAngle;

This code working completely fine in unity and in the portrait mode of actual device.

But in the landscape modeof actual devices , the rotation get inverted.
Please help me to solve this problem.
Thank you

sentences:
How can I use voice commands to control my Windows Phone game? Is it possible to use simple voice commands like "run right", "run left", "jump", "stop", "attack", "defend", "finish" to control the player in a Windows Phone 8 game?

How can I implement voice recognition and some voice commands in my game?

sentences:
Select a block of tiles from tilemap by click and dragging I'm creating my first game in Godot 3.1, a top-down 2D sim game where you can build rooms on a space station. I am using a tileset I created inside a TileMap node. I placed a script inside the node that checks for the mouse position in the world, converts it into a tilemap coordinate, then loads a tile into that tilemap coordinate.

func _input(event):
if (event is InputEventMouse):
    var button = event.get_button_mask()
    if (button == 1):
        var tile_pos = world_to_map(event.position)
        var name = _tileset.tile_get_name(0)
        set_cellv(tile_pos, _tileset.find_tile_by_name(name))

Works like a champ! As long as the left mouse button is held down, any tile the mouse pointer touches is filled with the tile from the tileset.

Now I am trying to expand this function so that I can click the world and drag across several tiles to form a rectangle or square, then have all of the tiles inside the selected area filled with the selected tile.

func _input(event):
if (event is InputEventMouse):
    var button = event.get_button_mask()
    if (button == 1):
        var tile_pos = world_to_map(event.position)
        if (dragStart == Vector2(-1,-1)):
            dragStart = tile_pos
        var name = _tileset.tile_get_name(0)
        if (dragStart != Vector2(-1,-1) && dragStart != tile_pos):
            var newX = dragStart.x - tile_pos.x
            var newY = dragStart.y - tile_pos.y
            while (newX != 0 && newY != 0):
                var next = Vector2(-1,-1)
                if newX > 0:
                    next = Vector2(dragStart.x - 1,dragStart.y)
                    newX = newX - 1
                elif newX < 0:
                    next = Vector2(dragStart.x + 1,dragStart.y)
                    newX = newX + 1
                elif newX == 0:
                    if newY > 0:
                        next = Vector2(dragStart.x,dragStart.y - 1)
                        newY = newY - 1
                    elif newY < 0:
                        next = Vector2(dragStart.x,dragStart.y + 1)
                        newY = newY + 1
                print(next)
                set_cellv(next, _tileset.find_tile_by_name(name))
    else:
        dragStart = Vector2(-1,-1)

However, it seems to only load some of the tiles and functions sporadically. Am I not understanding how the system iterates through the while loop or am I missing something else?

sentences:
How to achieve animated glow I am trying to achieve something I've seen numerous times, but I don't know where to start from. I've come across numerous old effects, which I can't recreate. The said effects are the glow animations seen here: world of warcraft armor sets or for instance here Diablo glowing wings. In my desperation I even tried to contact blizzard, but with no success.

My common logic tells me these effects are not implemented with particles as that would be too expensive, especially on the hardware WoW ran on. On top of that, these looks strangely static, in a way even 2-D. I suspect something to do with images. I'm only a hobbyist graphics programmer(on top of that, not a good one) and I can't wrap my head around it. I would really appreciate any help.

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:
Fastest way to look up an entity with a set of components? I'm currently trying to implement an ECS system, but I've sort of ran into a problem trying to fetch all of my entities that have a specific set of components. I currently have a Dictionary that maps a component name to a list of Guids (entities), so I have no problem fetching a list of entities if I were to query for just one component. But if I were to query entities for more than one component (e.g. all entities that have Render and Transform component), I run into a problem where it's no longer a constant time lookup.

I could probably loop through the entities to see if they contain that set of component names (they are stored in a dictionary that maps Guid to a list of strings), but I was thinking that there could be a faster way of doing this?

sentences:
How to Prevent Entities Snapping Through Platforms I am using crafty.js to make a platformer. I assigned the main player entity the default jumping controls and movement with .twoway() and used .checkHits() against the obstacles ("obs") the player will jump on. The problem is that when the player jumps, if the top of the player entity hits the bottom of the obstacle, the player entity "snaps" to the top. How do I make it so that this movement does not happen? The intended effect is that the player entity will only land on the obstacle if the player entity lands on the top.

Here is the code:

window.onload = function() {

  Crafty.init(600, 400);
  Crafty.background('#07A6FF');

  // obstacle/platform entities
  // 'obs' means obstacle
  var obs = Crafty.e('obs, 2D, DOM, Collision, Color')
  .attr({ x: 100, y: 250, w: 400, h: 45 })
  .color('#E88D0C');

  var obs2 = Crafty.e('obs, 2D, DOM, Collision, Color')
  .attr({ x: 200, y: 150, w: 45, h: 45 })
  .color('#E88D0C');

  // player entity
  var player = Crafty.e('player, 2D, DOM, Color, Collision, Twoway, Gravity, Jumper')
  .attr({x: 50, y: 50, w: 60, h: 40 })
  .color('#0035AB')
  .twoway(200, 150)
  .checkHits('obs')
  .gravityConst(200)
  .gravity('obs');
}
<script src="https://github.com/craftyjs/Crafty/releases/download/0.7.1/crafty.js"></script>

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:
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:
Why when adding a box collider to character i can still walk through the character? Like the box collider is not active or exist.
I added a box collider on the left soldier.

I'm using firstpersoncontroller and firstpersoncharacter as player but i can move through the soldier and when the mouse cursor is over the soldier it's not detecting it as "Interactable" object.

The only object that is detecting is the door behind the soldiers. Any other objects are not detecting using the ray cast. So i added a box collider to the soldier for testing but it's not working.

Can't figure out why only the door is detecting.

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

public class CameraRaycast : MonoBehaviour
{
    Ray ray;
    RaycastHit hit;

    void Update()
    {
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit, 1000))
        {
            if (hit.transform.tag == "Interactable")
            {
                print("Hitted on: " + hit.transform.name);
            }
        }
    }
}

sentences:
Why must the transpose value of glUniformMatrix4fv in webgl/OpenGL ES be false? Why must the transpose value of glUniformMatrix4fv in webgl/OpenGL ES be false?

The OpenGL ES spec says that the transpose value must be false or an INVALID_VALUE is generated. Why then have the parameter?

sentences:
How to simulate projectile path in 3D with Physijs andThree.js? I'm new in 3D rendering with WebGL. I would like to simulate a 3D projectile path using Three.js and Physijs.

How could I achieve this?

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:
Calculating camera frustum planes using existing matrix I'm trying to get basic frustum culling against an AABB working, and I'm having a bit of trouble figuring out how to extract the frustum planes from my camera's transform matrix. All the example code I've found expects position, look, and up vectors, as you'd pass to gluLookAt. My camera matrix can be transformed by a parent and other bits of code, so those vectors never exist anywhere that I could use them.

I've looked at code for gluLookAt and tried to graft the inverse of that on top of the Lighthouse3D example for creating the Frustum planes. It's really close to correct, but I have objects flickering in and out of existence still, so something's not quite right. All of the related code is here, so I'm hoping this will be an easy find for somebody.

struct Frustum {
  enum {
    TOP,
    BOTTOM,
    LEFT,
    RIGHT,
    NEAR,
    FAR
  };

  Frustum(hsMatrix44 cam, float znear, float zfar, float angle, float aspect) {
    float nw, nh, fw, fh, tang;
    tang = (float)tan(angle * 0.5);
    nh = znear * tang;
    nw = nh * aspect;
    fh = zfar  * tang;
    fw = fh * angle;

    hsVector3 dir,nc,fc,X,Y,Z,P,U;
    hsVector3 ntl,ntr,nbl,nbr,ftl,ftr,fbl,fbr;

    Z.X = -cam(2,0);
    Z.Y = -cam(2,1);
    Z.Z = -cam(2,2);
    U.X = cam(1,0);
    U.Y = cam(1,1);
    U.Z = cam(1,2);
    X = U.crossP(Z);
    X = X * (1.f/X.magnitude());
    Y = Z.crossP(X);
    hsMatrix44 icam = cam.inverse();
    P.X = icam(0,3);
    P.Y = icam(1,3);
    P.Z = icam(2,3);
    nc = P - Z * znear;
    fc = P - Z * zfar;

    ntl = nc + Y * nh - X * nw;
    ntr = nc + Y * nh + X * nw;
    nbl = nc - Y * nh - X * nw;
    nbr = nc - Y * nh + X * nw;
    ftl = fc + Y * fh - X * fw;
    ftr = fc + Y * fh + X * fw;
    fbl = fc - Y * fh - X * fw;
    fbr = fc - Y * fh + X * fw;

    planes[TOP] = planeFromPoints(ntr, ntl, ftl);
    planes[BOTTOM] = planeFromPoints(nbl, nbr, fbr);
    planes[LEFT] = planeFromPoints(ntl, nbl, fbl);
    planes[RIGHT] = planeFromPoints(nbr, ntr, fbr);
    planes[NEAR] = planeFromPoints(ntl, ntr, nbr);
    planes[FAR] = planeFromPoints(ftr, ftl, fbl);
  }

  bool checkBox(const hsBounds3Ext& box) {
    for(int i = 0; i < 6; ++i) {
      float d0, d1;
      d0 = planes[i].W + planes[i].N.dotP(box.getMins());
      d1 = planes[i].W + planes[i].N.dotP(box.getMaxs());
      if((d0 < 0.f) && (d1 < 0.f))
        return false;
    }
    return true;
  }

  hsPlane3 planes[6];
};

hsPlane3 planeFromPoints(hsVector3 a, hsVector3 b, hsVector3 c) {
  hsPlane3 p;
  hsVector3 tmp0, tmp1;
  tmp0 = a - b;
  tmp1 = c - b;
  p.N = tmp1.crossP(tmp0);
  p.N = p.N * (1.f/p.N.magnitude());
  p.W = -(p.N.dotP(b));
  return p;
}

sentences:
Simple javascript HTML5 canvas start menu I'm currently looking for a simple and basic start screen for a game using javascript, so basically its the first function that is called and then press play which then goes into the game.

Looked online and they all seem to be advanced ones and can't seem to find any tutorials either.

sentences:
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:
For a 2D game on the iphone would I better using OpenGL or CoreGraphics? I am planning on developing my first iPhone game, and I was wanting to know whether I should use OpenGL or CoreGraphics for a 2D game.  An outline of the benefits would also be helpful.

Edit: Set this for the community wiki as the answer will be too subjective

sentences:
WP7 emulator + Microsoft.Advertising.Mobile.Xna.dll = 'System.IO.FileLoadException' occurred in mscorlib.dll I've downloaded Microsoft Advertising SDK for WP7, added reference to Windows Phone Game project, and now when I'm trying to run the game I get this in Output:

'taskhost.exe' (Managed): Loaded 'mscorlib.dll'
'taskhost.exe' (Managed): Loaded 'System.Windows.RuntimeHost.dll'
'taskhost.exe' (Managed): Loaded 'System.dll'
'taskhost.exe' (Managed): Loaded 'System.Windows.dll'
'taskhost.exe' (Managed): Loaded 'System.Xml.dll'
'taskhost.exe' (Managed): Loaded '\Applications\Install\B2719AD1-5A3C-40BE-A114-7E56C19E22D6\Install\TheGame.dll', Symbols loaded.
A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
The thread '<No Name>' (0xd4b004e) has exited with code 0 (0x0).
The program '[229048418] taskhost.exe: Managed' has exited with code 0 (0x0).

If the reference is removed, game launches normally again.

What might be the possible solution to fix this?

sentences:
Zobrist Hashing equivalent for Simple Knights Game with only 1 unique piece I looked over the Zobrist hashing function used for getting a unique hash id of the board state in a chess game. https://en.wikipedia.org/wiki/Zobrist_hashing

Martin Fierz explains it very well in his post:

  Assume you have a board with S squares and P different types of
  pieces. You allocate an array:

int zobristnumbers[S][2*P];

  and fill it with random numbers. The hash number is now calculated as
  an XOR over the occupied squares of the entire board:

key = 0;
for(i=0; i<S; i++) {    if(board[i] != EMPTY)
  key ^= zobristnumbers[i][piece[i]];
}

Now this works very well for chess because you have 6 unique pieces and 64 squares - so the probability of getting a clash in the keys is very small.

I am trying to find a variant of this hashing function or another one, which would work smoothly in a more simple zero-sum game called Knights: 49 squares, and only one kind of piece - a knight from chess - which moves exactly like a knight in chess.

I want to use it as a transposition table key, for storing best moves and game states.

Any ideas or hints of how could this be achieved?

Thanks!

sentences:
How to rotate several game objects without rotating individual objects I have a some game objects that are a unit away from the center. They are all contained in a parent object, see the image below.

When I rotate the parent object by 60°, the game objects individually rotate, as  below.

Below is the script attached to the parent object that I use to rotate the parent object.

    IEnumerator RotateSquaresParent(Vector3 byAngles, float duration)
{
    Quaternion fromAngle = gameObject.transform.rotation ;
    Quaternion toAngle = Quaternion.Euler (transform.eulerAngles);
    toAngle = Quaternion.Euler (gameObject.transform.eulerAngles - byAngles);

    for(float t = 0f ; t <= 1f ; t += Time.deltaTime/duration)
    {
        gameObject.transform.rotation = Quaternion.Lerp(fromAngle, toAngle, t) ;
        yield return null ;

    }
    gameObject.transform.rotation = Quaternion.Lerp(fromAngle, toAngle, 1);

}

How can I rotate the parent object containing these square game objects without rotating them individually?

UPDATE

The squares represent enemy objects that would be shooting projectiles (yet to work on that) in my game. Thats why they'd have to be straight. As a player approaches a given child square (enemy), I would want to rotate individual child squares based on proximity and other conditions to possibly face the player object.

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:
Unity: how intercept Mouse Click on UI and not fire "shoot"? I've a classic

void Update() {
   if(Input.GetMouseButtonDown (0))
      Fire();
}

What i want to do is that if I click on a UI button , the Fire() routine not will be called.

How to do to say Unity if InputGetMouseButtonDown(0) && !UI clicked ?

sentences:
Half of my tris are textured in streaks and blurs I have written code to import meshes from OBJs and textures from BMPs. My texture coordinates seem to be getting messed up somehow, or some other issue is occuring, because I am getting these effects with meshes and textures:

I do not know what to call these issues and I do not know what might cause them (I am new to OpenGL) so it is hard for me to figure out how to fix them. Does this look familiar to anyone? If so, what's up and how might I fix it?
Relevant code for importing mesh data:
obj.vertBufferSize = sizeof(GLfloat) * vertCount * 3;
obj.uvBufferSize = sizeof(GLfloat) * vertCount * 2;
obj.vertBuffer = vertBuffer;
obj.uvBuffer = uvBuffer;

glGenBuffers(1, &obj.vertBufferID);
glBindBuffer(GL_ARRAY_BUFFER, obj.vertBufferID);
glBufferData(GL_ARRAY_BUFFER, obj.vertBufferSize, &(obj.vertBuffer[0]), GL_STATIC_DRAW);

glGenBuffers(1, &obj.uvBufferID);
glBindBuffer(GL_ARRAY_BUFFER, obj.uvBufferID);
glBufferData(GL_ARRAY_BUFFER, obj.uvBufferSize, &(obj.uvBuffer[0]), GL_STATIC_DRAW);

Relevant code for importing texture data:
glGenTextures(1, &(bmp.ID));
glBindTexture(GL_TEXTURE_2D, bmp.ID);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bmp.width, bmp.height, 0, GL_BGR, GL_UNSIGNED_BYTE, bmp.array);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glGenerateMipmap(GL_TEXTURE_2D);

Before the main loop (for sending mesh data to shaders):
glBindBuffer(GL_ARRAY_BUFFER, mesh.vertBufferID);
glVertexAttribPointer
(
    0,
    3,
    GL_FLOAT,
    GL_FALSE,
    0,
    (void*)0
);

glBindBuffer(GL_ARRAY_BUFFER, mesh.uvBufferID);
glVertexAttribPointer
(
    1,
    2,
    GL_FLOAT,
    GL_FALSE,
    0,
    (void*)0
);

Samples from inside the main loop:
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);

glBindTexture(GL_TEXTURE_2D, texture.ID);

glDrawArrays(GL_TRIANGLES, 0, mesh.vertCount);

glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);

sentences:
The A,I can't seems to move/strafe on the left continously? void Update()
{
    ChasingPlayer();
}

void ChasingPlayer()
{
    if (chasing == true)
    {
        transform.LookAt(player.transform);  //facing player
        transform.position += transform.forward * approaching * Time.deltaTime;  //going towards player
    }

        float distance = Vector3.Distance(transform.position, player.position);
    Debug.Log(distance); //calculating the distance between player and enemy
    if(distance < 10)
    {
        chasing = false;
        transform.position += Vector3.left * 2f * Time.deltaTime;
        Debug.Log("STOP!");
    }
}

I want my A.I to approach to the player but when it reaches within 10 feet(?), I want it to stop moving towards the player and strafe/move to the left or right from there but instead it just moving in a curve movement that leads towards the player. How should i stop the AI within 10 feet(?) and move to the left/right?

sentences:
Exported FBX Blender Model not showing up in XNA I really do apologise if this question has been asked before, but I recently created a model in Blender 2.63, exported it to an FBX file, and tried to display it in XNA (using 4.0 Refresh), but all that shows up is the standard XNA blank screen. My code for drawing the model is:

    void RenderModel(Model model, Matrix world, Matrix view, Matrix projection)
    {
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect fx in mesh.Effects)
            {
                fx.World = world;
                fx.View = view;
                fx.Projection = projection;
                //fx.Texture = untagged;

                //fx.EnableDefaultLighting();
            }

            mesh.Draw();
        }
    }

where

    world = Matrix.CreateTranslation(Vector3.Zero);
    view = Matrix.CreateLookAt(new Vector3(0, 0, 10), Vector3.Zero, Vector3.UnitY);
    projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 600f, 0.1f, 100);

The above code worked for some other models I tried, so I'm pretty sure it's something wrong with the exported model. I exported the model from Blender using the XNA strict settings, and there are no animations, just a texture, which seems to be connected properly to the FBX from the text in the FBX file.

If anyone can tell me how I can create a simple model in Blender and make it usable for XNA, that would be great. Thanks a lot!

EDIT: Added program versions for Blender and XNA

sentences:
save a particular area of the scene as screenshot in unity I need to save a particular part of the scene as screenshot. I have done a sample to show the particular part of the scene.

When I click on the rectangular area the selected area will being shown on the screen on a texture (marked in red rectangle):

But when I save, the whole scene is getting saved but not the selected part:

Here is code:

Texture2D screencap;
Texture2D border;
bool shot=false;
public string path;

void Start () {
     screencap=new Texture2D(300,200,TextureFormat.RGB24,false);
     border=new Texture2D(2,2,TextureFormat.ARGB32,false);
     border.Apply();
}

// Update is called once per frame
void Update () {
    if(Input.GetKeyUp(KeyCode.Mouse0))
    {
        StartCoroutine("Capture");
    }

}
string fileName(int width, int height)
{
    return string.Format("screen_{0}x{1}_{2}.png",
                         width, height,
                         System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
}

void OnGUI()
{
    GUI.DrawTexture(new Rect(200,100,300,2),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(200,300,300,2),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(195,100,2,200),border,ScaleMode.StretchToFill);
    GUI.DrawTexture(new Rect(500,100,2,201),border,ScaleMode.StretchToFill);

    if(shot)
    {
        GUI.DrawTexture(new Rect(50,10,60,40),screencap,ScaleMode.StretchToFill);
        //Application.CaptureScreenshot(myFolderLocation+myFilename);
    }
}

IEnumerator Capture()
{
    yield return new WaitForEndOfFrame();
    screencap.ReadPixels(new Rect(198,98,298,198),0,0);
    screencap.Apply();
    shot=true;

    byte[] bytes=border.EncodeToPNG();
    string filename=fileName(Convert.ToInt32(screencap.width), Convert.ToInt32(screencap.height));
    Application.CaptureScreenshot("D:"+filename);
}

How can I save only the particular part in unity,can anybody please help me out.

sentences: How can I get the pressure of a touch in Unity? Does anyone know how to get the getPressure function from the Android API into Unity? Or is there another way I can access the pressure of a touch?

sentences: Grow first, Ads later for mobile games? Facebook's strategy has been to Grow First, include Ads Later. For mobile games, is there any evidence that ads hinder popularity, or that people are more likely to share games without ads?  Or as mentioned by angarg12, is there evidence that introducing ads part-way through a game's life cycle affects how people feel toward your game?

sentences:
What interface should be responsible for specifying the initial position of a game object? I'm making a simple Pong clone game and have been having an issue deciding on how my classes should handle the initial placement of an object.

For instance, my Ball class's constructor is:

Ball (std::string imageName, float screenWidth, float screenHeight)

The constructor then automatically centers the ball in the middle of the screen, since it knows the ball's width and height the dimensions the image it loads, and the screen width and height by the arguments it is passed.

I would rather be able to place the ball manually, and just take the exact x and y locations in the constructor:

Ball (std::string imageName, float x, float y)

But that would require the calling function to already know the ball's width and height in order to center the ball and when it creates a ball it'd have to write something like:

Ball ball("ball.png", ((SCREEN_WIDTH / 2) - (BALL_WIDTH / 2)),
((SCREEN_HEIGHT / 2) - (BALL_HEIGHT / 2)))

I know this may be personal preference, but I'm trying to figure out which way is generally accepted.

A similar issue occurs with my Paddle class. Its constructor argument list looks like this:

Paddle (std::string imageName, float screenWidth, float screenHeight, int player)

Since I set the location inside of the constructor, it's forced me to have a player flag so I know if the paddle is supposed to line up with the left or right hand side of the screen. If I took the exact x and y location in the constructor's argument list, I could figure out which player is which internally using math.

I'm thinking that if the calling function kept consts of all of their objects' widths and heights they could use those in all of their objects' constructors in order to manually set their starting position... but is this the best way to do this?

EDIT:

Now I'm thinking that it would be realistic to expect the calling function to know the center x and center y that it wants the object at, and the object itself can use those x and y coordinates to center itself using its own width and height.

I'm starting to think this may have been a silly question since it really depends on the type of game you're making and how you're using the specific classes. I appreciate any input!

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:
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 can I get Unity to tell me the battery status of my OS X laptop? How do I get battery status on an OS X laptop in Unity?

This is un-Googlable: I keep finding either mobile stuff (iOS or Android) or people complaining about laptop battery life.

sentences:
How to mitigate speed effects on moving platforms? I am implementing horizontal moving platforms in my 2D platformer.

The way it's implemented currently, when my player lands on a moving platform, he is reparented to it so that his position updates in line with the moving platform.

The player is moved perfectly in sync with the platform, which has a constant velocity. The player's acceleration and velocity are not altered in any way to achieve this movement. It's free because the player is now a child of the platform.

Because I use local position in all of my player's movement code, my player is still free to move left and right relative to the moving platform.

This works really well.

I notice, however, that when my player runs along the platform in the same direction as it's moving, there is a sense of moving fast. When he runs against the platform, there is a sense of sluggishness.

I know that relative to the platform my player is moving at the same velocity in both directions, but because he traverses more global distance than normal when moving with the platform, there is a sense of speed, and because he traverses less global distance than normal when moving against the platform, there is a sense of sluggishness.

I believe the sense of speed and sluggishness are like psychological illusions. If my player stands on my moving platforms, it takes the same amount of time for him to traverse them from left to right as right to left, so I know that local velocity with respect to the platforms is working. It's more of just a psychological effect I'm trying to mitigate, I think.

So my question is: Are there any ways of mitigating these effects? How do you deal with this problem?

I am working in Godot, but would prefer an engine-neutral explanation of ways to avoid this effect.

It may or may not be relevant, but I have a smoothly scrolling camera which lerps to my player's position, as well as parallax backgrounds.

sentences:
Additive "Sprites/Default" shader The Sprites/Default shader multiplies the color with the provided tint, while I need to add it instead.
I fixed this copying the shader (taken from here) and simply changing the line

return tex2D(_MainTex, IN.texcoord) * IN.color;

to

return tex2D(_MainTex, IN.texcoord) + IN.color;

Is this the right approach, or there was a better one? (which uses something like inheritance, as opposite to copy-pasting)

Also, is this legal? I assume they allow you to use it at will, but technically there's no licence attached to the shader, so I'm not sure. Maybe that's covered somewhere in the Unity license?

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: How do I make an extensible engine in XNA? I making a new engine for my game, based on the component system. Every game object is a set of some components, like render, physics, AI, etc. I want to make my game extensible; I now how to make a plugin system with .NET, but how do I make my game able to add new resources from plugins, at runtime? How should such the plugin that stores content look? I want to make simple system, like "Total Annihilation" has, to be able to add new units.

sentences:
Is it possible to use Windows Forms in an XNA project? Is it possible to keep a Windows Form inside a XNA project? I tried it but without success.

Below I'm showing how my main file is.

using System;

namespace JogoSuecaOnline
{
#if WINDOWS || XBOX
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            MainMenu menu = new MainMenu();
            menu.Show();
        }
    }
#endif
}

sentences:
Network Communication For Multi-Player Turn-Based Game I'm attempting to develop a multi-platform turn-based game that [I suspect] follows the general client-server pattern. For this question, let's assume I only care about communications inside of a "battle" right now.

Here are the relevant mechanics of a battle: there are some number of "soldiers" in each battle. Each soldier is under the control of a player and a player may be in control of multiple soldiers in a given battle. Each turn only 1 soldier makes an action, the server will contain logic to determine which soldier that is. There are no time limits on turns. The player in control of that soldier select an action for that soldier which is sent to the server. The server will then determine the result of that action and send that information to every client.

This diagram can hopefully show my intended flow of information:

With each communication to client I was expecting to send a json of a ClientBattle object that holds all the data a client needs. On communications to the server, I was expecting to send a json of an Action object that contains all the info the server needs to calculate the outcome and advance the battle.

Unfortunately, I'm not quite sure how I would go about implementing this.

An approach that I would know how to implement that mimics this behavior would be to have each client HTTP GET a turn number from the server at a regular interval of ~3 seconds. If the turn number matches the client's data it does nothing until asking the server again in 3 seconds. If the number doesn't match, then the client HTTP GETs new battle data from the server and uses that to update its display. On client to server communication I'd send a HTTP POST request.

How would I clean this up - or - how could I implement it as in the diagram?

sentences:
In what size should i design sprites for unity iOS? I am developing a 2D platform game in unity.I have conceptualised the game and have to design the art assets/sprites, but the problem is at what resolution or size do i design them?

If I target the sprites size to iPad pro (as its has got highest resolution of all iOS device), can the older iPhone 4S handle it?

What are the best methods of designing art assets for multiple resolution(with best performance on older devices)?

sentences:
ArmA 3 Scripting: Delete vehicle depending on present players I'm fairly new to ArmA 3 scripting, and I'd like to know how to only spawn starting vehicles depending on how many players opt in to the mission. Say, the mission has four slots, but only two people fill them. There would be four vehicles, but two would be deleted on the mission start because those players weren't present. I've tried putting this code in the initialization of each vehicle;

sleep 1; if (isNull unit1) then {deleteVehicle this} else {};

But it only gives me errors when the mission starts.

sentences: Unity shaders: best way of handling data structures I'm working on a shader in Unity that uses a Binary Tree to store some precomputed values, this binary tree should be available to the shaders and would ideally also be constructed on the graphics card (each node in this tree is based on 1 pixel) is there a good way of doing this?

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:
Does SFML render it's graphics using OpenGL internally? By that, I mean that SFML has an abstraction for OpenGL? Sort of like SDL's blit functions, but using OpenGL internally?

"Yes SFML uses OpenGL for all the graphical stuff. "

Received this comment in an earlier question, which sort of baffled me since I find nothing about it.

sentences:
Need help converting LPDIRECT3DTEXTURE9 to openGl libgdx Pixmap What i'm trying to achieve. I need to know the equivalent of LPDIRECT3DTEXTURE9 to openGL, the problem is I only know Pixmap class of libgdx which pixmap.drawPixel(x, y, color) is only available, I cannot find how to convert layer->lightMap->LockRect(0, &rectLock, 0, 0)

Below is example code of c, LPDIRECT3DTEXTURE9 lightMap is used which unknown in openGL to me.

D3DLOCKED_RECT rectLock;
D3DCOLOR* pixels;
LandLayer* layer;
int j;

for (int i = 0; i < m_layers.GetSize(); i++)
{
    layer = m_layers[i];
    layer->lightMap->LockRect(0, &rectLock, 0, 0);
    pixels = (D3DCOLOR*)rectLock.pBits;
    for (j = 0; j < MAP_SIZE * MAP_SIZE; j++)
        pixels[j] = D3DCOLOR_ARGB(layer->alphaMap[j], m_colorMap[j * 3], m_colorMap[j * 3 + 1], m_colorMap[j * 3 + 2]);
    layer->lightMap->UnlockRect(0);
}

What I have done in kotlin, using Pixmap from libgx https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/Pixmap.java

tmpColor.set( Color.toIntBits( r.toInt(),g.toInt(),b.toInt(),a.toInt()))
pixmap.drawPixel(x, y, tmpColor.toIntBits())

sentences:
Occasional lag-spikes in performance in heavily optimized game (profiler screenshots included) So I've been working on a mobile-based platformer for a few years now. I've spent more than a year optimizing the game for mobile as much as I could. Almost every single one of my meshes are using Mobile/Diffuse shader. When I test the performance of my game (on my phone) with the profiler, the frame rate stays at clean 60 fps for the most part. The CPU time fluctuates between 16 ms and 17 ms. The rendering statistics are also excellent, with draw calls fluctuating between 18 and 25, triangles fluctuating between 1.0k and 2.0k and vertices fluctuating between 2.0k and 3.1k. Below is a screenshot of the Rendering profiler when the game is running smoothly. I believe that for a mobile device, these should be very good numbers.

However, every now and then, I see a spike in the profiler window (see below):

According to the profiler, the spike is being caused by Render.OpaqueGeometry.

Under normal scenarios (when the performance is smooth), Render.OpaqueGeometry takes between 1 ms and 2 ms of CPU time. However, as you can see in the screenshot above, Render.OpaqueGeometry is taking 5.36 ms of CPU time and the total CPU time has jumped to 24.16 ms.

Based on my observations, this spike shows up once or twice per minute. Sometimes, several minutes go by without any spikes. And in very rare occasions, the spike can show up 3 times in a single minute (although I don't think that happened the last couple of times I tested it).

So why do you guys think this is happening despite the game being heavily optimized? I read in a post in Unity Answers that Render.OpaqueGeometry spikes are frequent in all games and it's nothing to worry about. But do you think 2 spikes per minute is too frequent for a simple platformer?

sentences:
How do I detect pixel-level collision using andEngine? I'm developing a game for Android using andEngine, and I need to detect collisions only when two objects visually collide (not in blank space of the image). In J2ME, I'm able to do that using helicopterSprite.collidesWith(buildingSprite, true).

However, andEngine only has helicopterSprite.collidesWith(buildingSprite). What is the equivalent method for andEngine? How do I invoke pixel-level collision?

sentences:
How to apply Time.timeScale only to certain scripts? I have a need to pause my game and the simplest and most clean way that I know of (other than completely designing my own time system) is by using Time.timeScale = 0;
However, this also makes my CameraController script stop working, because it relies on LateUpdate() and FixedUpdate() to update the camera position.
How would I change the timescale for other things that rely on it, but leave the part of it that the CameraController works with intact?
My first thought was adding a variable int isPaused; to parts of code that need to be stopped, and then instead of actually setting the timeScale to 0, I'd just change that isPaused variable to zero, and then multiply it with Time.deltaTime as usual, which would result in that object not moving, while still keeping my CameraController working. However, I'm not sure if this is the cleanest and simplest way to achieve something like this. Perhaps designing my own time system would be more beneficial in the long run?
Here's the CameraController code incase it is needed: https://hatebin.com/fqtybcuwht

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: When tracing how do I tell if I hit a wall or floor? I perform a trace and when it hits the world I get a location and the surface normal.  Does anyone have a good way to find out if I hit a wall or a floor?

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:
Handling mouse input depending on selected unit and clicked tile I am making a turn-based tactical game (think something like X-Com) and I am currently trying to figure out how to handle mouse input in a clean way without a mess of if-statements.

I have a lot of variables that come into play and that changes what happens when you click a tile in the game.

For example: if the currently selected unit is a player controlled unit and the tile you click is within that units movement range, I want to queue up a move action. If the clicked tile contains another player character I want to select that one instead, but if it contains an enemy I want to select the enemy or attack it if the player is adjacent.

So basically what happens when you click depend on selectedUnit, clickedTile, clickedTile.getUnit().getType(), and if the selected units tile is a neighbour to the clicked tile.

Is there a cleaner way to handle this than a mess of if-statments? I am using Java and Libgdx if that matters, but I am guessing this is mostly a design question.

sentences:
Drawing a missile relative to the ship I'm drawing my ship by the following code and wanted to draw a missile at the tip of the ship, so that when I click spacebar it fires that missile. I don't know if what I'm doing is correct or not. Is that the "correct" way to do the job of drawing a missile then firing it by a space bar? or there is a "better" way?
Is the transformation correct here, I mean writing hard coded values and just stick the missile at the tip of the ship by trial and error?

void Ship::Draw( )
{

    gl::pushMatrices();
    gl::translate(Vec2f(m_Pos.x,m_Pos.y));
    gl::rotate(Vec3f(0,0,m_Angle));

    gl::color(ci::Color(1,0,0));

    gl::drawLine(Vec2f(-43,-52),Vec2f(59,1));
    m_Bullet.Draw(59,-8);
    gl::drawLine(Vec2f(-14,-34),Vec2f(-14,38));
    gl::drawLine(Vec2f(59,1),Vec2f(-43,54));
    gl::popMatrices();

}
void Bullet::Draw(int x, int y)
{
    gl::pushMatrices();
    gl::translate(x,y);
    gl::drawSolidRect(Rectf(0,0,16,16));
    gl::popMatrices();
}

sentences:
How do I draw 2D sprites from a sprite sheet in DirectX 11 without ghosting/artifacts I'm new to DirectX and I am trying to get my feet wet by making a simple 2D game. I chose DirectX 11 and am using the DirectX ToolKit helper library which recommended I start with DX11 and not DX12.

The guide I am following to create an animating sprite is working great except for when attempting to draw a single sprite from the sprite sheet I am seeing "ghosting" of other sprites behind it. I created the sprite sheet and saved it as a PNG and also as a BMP and it seems to happen either way.

Here is the sprite sheet I am using:

It is 336px width, 48px height, in 48px x 48px square sprites. If I render the entire sprite sheet, or if I render the first sprite (0,0,48,48), it looks fine, but if I attempt to render the 2nd, 3rd, 4th, etc. this is how it renders:

Here is the code I am using to load the PNG file as a texture:

ComPtr<ID3D11Resource> ponyIdleResource;

DX::ThrowIfFailed(
    CreateWICTextureFromFile(_D3dDevice.Get(), L"assets/pony_idle.png",
        ponyIdleResource.GetAddressOf(),
        _Texture.ReleaseAndGetAddressOf())
);

ComPtr<ID3D11Texture2D> ponyIdleTexture;
DX::ThrowIfFailed(ponyIdleResource.As(&ponyIdleTexture));

CD3D11_TEXTURE2D_DESC ponyIdleDesc;
ponyIdleTexture->GetDesc(&ponyIdleDesc);

and here is the code I am using to draw:

_SpriteBatch->Begin();

RECT sourceRect;
sourceRect.left = 48;
sourceRect.top = 0;
sourceRect.right = 96;
sourceRect.bottom = 48;

_SpriteBatch->Draw(_Texture.Get(), _ScreenPos, &sourceRect, Colors::White, 0, _Origin);

_SpriteBatch->End();

If I pass the RECT in as 0,0,48,48, it looks fine. Is there some special way I need to format my image? I've tried it as both PNG and BMP.

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:
Game Networking: Client request or Server Sending I'm trying to implement a basic client-server setup for my game. But what confused me was how I would approach sending updates.

Would I do:

Server has a tickrate, let's say at 20ms. Each tick would sends an UDP package to EVERY connection with the current game state and it's entities.

OR

Client request an update from the server and the server respond with the update. When the client receives it, it asks for another update and so on.

Pro-cons:

Con: Sends a package every tickrate and in this case 20ms. What if a clients broadband connection has a triptime at 300ms? Wouldn't that overload that client and his broadband?
Pro: Consistent and fast?

Con: Requesting is done via TCP which is slower because the client has to wait before sending the next request.
Pro: no overload?

So my question would be, what I'm I missing and how would I approach sending updates about the current game state?

Cheers!

sentences:
How can I scale by time a canvas scaler > scaler factor float value from 0.01 to 1? The minimum is 0.01f the maximum I want it to be is 1
I want that when I start a Coroutine to be able to decide the time it will take to change the value to 1 and also the direction if from 0.01 to 1 or from 1 to 0.01
I tried this :
if (buttonType == "LoadGame")
        {
            StartCoroutine(DisplaySavedGamesWindow(5f, true));
        }

And
IEnumerator DisplaySavedGamesWindow(float time, bool direction)
    {
        float scaler = GameObject.Find("Save Slots").GetComponent<CanvasScaler>().scaleFactor;

        float currentTime = 0;
        while (currentTime < time)
        {
            scaler = currentTime / time;
            currentTime += Time.deltaTime;

            yield return null;
        }
    }

I used a break point on the line :
scaler = currentTime / time;

I see that scaler is changing up to 1 or to 0.9 ot sure why it's not getting to 1
And also it's not changing the value to 0.9 or to 1 in the editor in the scale factor it's still 0.01
Also how to use the bool flag ? true should be from 0.01 to 1 and false from 1 to 0.01
Ok I managed to make it working to be changed up from 0.01 to 1 :
IEnumerator DisplaySavedGamesWindow(float time, bool direction)
    {
        float currentTime = 0;
        while (currentTime < time)
        {
            var scaler = currentTime / time;
            GameObject.Find("Save Slots").GetComponent<CanvasScaler>().scaleFactor = scaler;
            currentTime += Time.deltaTime;

            yield return null;
        }
    }

The problem now is that when it's changing the value from the script the result is gray.
This is how it looks like when I'm changing it to 1 in the editor :
You can see the blue scroll view on the left :

but when it's changing the value from the script the result is gray scroll view and not blue like before :

sentences:
3D Collision Detection with XNA So I'm trying to implement some collision detection in XNA. I'm aware of the Bounding Spheres, but I worry with the accuracy, most items in my game are cubic in nature, so it seems very square-peg in a round hole, so it seems to me bounding boxes would be the best solution.

I looked at having libraries(JigLibX, Henge3D) to do it for me, but most have heavy physics systems attached and that's really not what I'm wanting
I've also tried to implement solutions utilizing the Vertex buffers for Bounding Boxes after XNA's importers and processors pack the .fbx model into the Content Pipeline to no avail.

So the two things I feel I'm left with are:

Using Primitives as collisions "skins" for my objects.

Same problem here as using XNA's default bounding box, after Importation, I have no clue how to get it's size or even the vertices.

Creating a Custom Content Processor to determine the vertices at Load, and then apply transformations to the Bounding Box along with the Model itself at run-time.

problem Here is that this is a very daunting task. I'm finding it hard to locate thorough documentation on XNA's default importer, so it's highly difficult to just create a custom Processor.
I wouldn't even know how to begin to write my own importer.

TL;DR- I've hit a brick wall with 3D Collision using Bounding Boxes, Halp?

sentences:
How can I accurately lerp Colors over seconds? I have some code to lerp between two colors over a set number of seconds, and the lerp works fine:

private Color lerpingColor;

private IEnumerator LerpColorsOverTime(Color startingColor, Color endingColor, float time)
{
    float step = 0.0f;
    while (step < 1.0f)
    {
        step += Time.deltaTime / time;
        yield return new WaitForSecondsRealtime(Time.deltaTime);
        lerpingColor = Color.Lerp(startingColor, endingColor, step);
    }
}

The problem is, the lerp time takes longer than the time I provide in my parameter.  For example, LerpColorsOverTime(Color.white, Color.black, 5.0f); takes over 8 seconds to lerp.

My best guess is that I am being very inefficient in the way I am lerping.  I tried accounting for the calculation time, but it does not seem to work.  In the particular case shown, it is because calculationTime is always 0, since the code to update the time is never run between my Time.time checks.  I tried various approaches, with this being my best:

private Color lerpingColor;

private IEnumerator LerpColorsOverTime(Color startingColor, Color endingColor, float time)
{
    float calculationTime = Time.time;
    float step = 0.0f;
    while (step < 1.0f)
    {
        step += Time.deltaTime / time;
        calculationTime = Time.time - calculationTime;
        yield return new WaitForSecondsRealtime(Time.deltaTime - calculationTime);
        calculationTime = Time.time;
        lerpingColor = Color.Lerp(startingColor, endingColor, step);
    }
}

I also tried other variations of Time.time, such as DateTime.Now.Miliseconds / 1000.0f and Time.realtimeSinceStartup, but they failed as well.

How can I make this code efficient enough to run in the expected time, or make some sort of change with the seemingly same effect?

sentences:
Has Silverlight got a future in the online Game world? We have spent several months planning, testing and developing a new game. We have been trialing a host of Platforms (Java Applet, Desktop Via XNA, Flash etc) and Silverlight was pretty much our prefered choice.

However, the more we get into the game the more problems we face, mainly down to the communication with a server. HTTP Polling is slow and in-efficent yet the socket functionality that is now available in SL4 is only really useful for a Intranet enviroment - Unless we are missing something.

Anyone have any opinions or experiance with this and the future of SL for Online Browser based games.

sentences:
2D vector to Quaternion I have a 2D vector (with only X and Y), and my engine only supports orientation through Quaternions.

How do I translate a 2D vector to a quaternion?

The X and Y represent the direction (so X = 0 and Y=1 means going forward, X=0.707 and Y=0.707 means rotate 45 degree, etc).

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:
Why am I getting an access violation when assigning to a 2D array member? c++ Beginner here, coming from Java background, and I'm getting the feeling this is a c++ specific error I'm running into. I am trying to procedurally generate a 2D map, which is of type Tile[y][x]. As seen in code below I loop through all the indeces in the 2D array and I generate a colorvalue, which lets it decide what color the tile is, and a position, which defines the position the tile should be drawn to. However, I get a read access violation when I try to add Tiles to the 2D array. What am I doing wrong here?

Also whenever I have an array that is a bit bigger than this one, I get a stack overflow error. Now I read that arrays are kept in stack memory, and the stack is only very small, so what would be a solution to this? Thanks in advance

Map.cpp:

    #include "Map.h"
    #include <memory>

    Map::Map(int size)
    {
        this->size = 10;
        noiseGenerator.SetNoiseType(FastNoise::NoiseType::Perlin);
        std::cout << "Setting noise" << std::endl;
        for (int x = 0; x < size; x++) {
            for (int y = 0; y < size; y++) {
                tileMap[x][y] = Tile{ sf::Vector2f{x * 8.0f, y * 8.0f }, noiseGenerator.GetValue(x, y) //This is where the read access violation happens
            };
            }
        }
    }
void Map::draw(sf::RenderWindow *window)
{
    for (int x = 0; x < size; x++) {
        for (int y = 0; y < size; y++) {
            window->draw(tileMap[x][y]);
        }
    }
}

Map.h: Tile is inheriting from base class sf::RectangleShape

#pragma once
#include <iostream>
#include <string>
#include "FastNoise.h"
#include <SFML\Graphics.hpp>
#include "Drawable.h"
#include <memory>
#include "Tile.h"

class Map : public Drawable
{
public:
    Map();
    Map(int size);
    ~Map();
    void draw(sf::RenderWindow *window);

public:
    int size;
    sf::RectangleShape tileMap[5][5];
    FastNoise noiseGenerator;
};

Game.cpp with the main function:

std::list<Drawable*> drawableList;
    int main()
    {

        sf::RenderWindow window(sf::VideoMode(800, 800), "Zieke game");

        Map map{100};
        drawableList.push_front(&map);

        sf::Clock clock;

        while (window.isOpen())
        {
            deltaTime = clock.restart().asSeconds();
            sf::Event event;
            while (window.pollEvent(event))
            {
                if (event.type == sf::Event::Closed)
                    window.close();
            }

            for (auto x : updateableList) {
                x->update(deltaTime);
            }

            window.clear();

            for (auto x : drawableList) {
                x->draw(&window);
            }
            window.display();
        }

        return 0;
    }

sentences:
OpenGL ES multiple indices I need suggestions for the best method of acheiving what I am trying to do:

-Using either OpenGL ES 1.x or 2.x

I need to pass a bunch of vertices to the GPU. Each one has 3 attributes: Position, Color, and Texture coords.

The vertices form quads, which share vertices. The shared vertices have both position and color attributes in common, but texcoords are not shared because each quad is textured with a 'tile' from a texture atlas.

I already know that it is not possible to use separate indices for a glDrawElements() call, so does that mean I can only use indexing for individual quads(specify 4 unique vertices per quad)? .. or is there any better solution?

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

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

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

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

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

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

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

public static void onCreate(Bundle savedInstanceState)
{

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

    //super.onCreate(savedInstanceState);

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

sentences:
Gldraw call asynchronous or not When i call gldrawarrays with a large set of data will the function return only after drawing all the vertices or will it happen asynchronously b/w cpu and gpu?

Also how does vsync work. Aren't they related?

sentences:
How are 3D images drawn? When A computer is to draw a 3d model, does it use maths similar to vector projection? Like when a 3d model is drawn and rotated, does it use vectors/and maybe some other math to know where to draw each of the edges?

If so, is this calculation made everytime the screen is refreshed?

Just want to see if I can create a basic square that looks like its spinning in 3D space. Just for the challenge, not anything practical.

Sorry if I wasn't clear, it is one of those questions where it's difficult to explain.

sentences:
How to prevent a sprite to move in an angle that will lead to collision I have two sprites that can move in any angle. The sprites are rectangular.

I created bounding boxes for both the sprites. These boxes rotate whenever the sprite rotates. They always surround the sprite and only the sprite. (Exact fit).

I have succesfully implemented collision detection for the two bounding boxes. I did this by checking wether box1 contains any of the vertices of the box2, and the opposite. (I know this way is not perfect, since it is possible for two rectangles to intersect without having each other's vertices inside themselves, but for my needs it's good enough).
So now I know when the two sprites collide.

But I have a problem with reacting when the two sprites collide.

When these sprites collide, I want to prevent them from overlapping each other (any more than a few pixels). In other words, upon collision, I want to allow the sprite to move only in a direction where it won't go deeper into the other sprite.

As I said, each sprite can move freely in any angle (the game is for two players, each controls a sprite).

EDIT:
To word it differently - Upon collision of two sprites, I need to find out the range of angles a sprite can move, that will allow it to to move out of the collision - this is so I can prevent the user from moving the sprite in any other angle, upon collision.

How can I do that? Thank you for your help

sentences:
2D graphic over 3D perspective projection To draw a 2D HUD (just a simple trianlge, for now) over 3D graphics in OpenGL I :

draw all 3D objects, then
call glDisable(GL_DEPTH_TEST) before drawing 2D HUD
draw 2D triangle
call glEnable(GL_DEPTH_TEST);

however it seems I am missing something and the triangle is only rendered when I set Model-View-Projection matrix to Identity :

DrawFrame() {
.
.. // Draw 3D objects
.
/*
*  Coordinates of 2D triangle
vert[0] = 0.0f; vert[1] = 0.5f; vert[2] = 0.0f;   // TOP
vert[3] = -0.5f; vert[4] = -0.5f; vert[5] = 0.0f;  // LEFT
vert[6] = 0.5f; vert[7] = -0.5f; vert[8] = 0.0f;   // RIGHT
*/

glDisable(GL_DEPTH_TEST);

glm::mat4 guiMVP = glm::mat4(1.0f);
//glm::mat4 guiMVP = Ortho * View * glm::mat4(1.0f);   // This does not render triangle
//glm::mat4 guiMVP = Projection * View * glm::mat4(1.0f);   // This DOES render triangle at its place but in 3D world
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &guiMVP[0][0]);
...
.. // render2D triangle
glEnable(GL_DEPTH_TEST);
}

OnSurfaceChanged(int width, int height) {

    glViewport(0, 0, width, height);

    aspect = (float) width / height;

    // Projection Matrix
    Projection = glm::perspective(45.0f, aspect, 0.1f, 10000.0f);
    // Orthographic Matrix for 2D HUD
    Ortho = glm::ortho(0.0f, (float)width, (float)height, 0.0f);
}

setCamera(float cameraX, float cameraY, float cameraZ, float cameraLX, float cameraLY, float cameraLZ) {
    // Camera/View matrix
    View = glm::lookAt(
        glm::vec3(cameraX, cameraY, cameraZ),     // Camera position
        glm::vec3(cameraLX, cameraLY, cameraLZ),     // pointing at
        glm::vec3(0, 1, 0)      // Angle
     );
}

here's my Vertex shader :

attribute vec3 in_Position;

uniform mat4 MVP;

void main(void) {
    vec4 v = vec4(in_Position, 1.0);

    gl_Position = MVP * v;

}

This is screenshot of what I want :

I DO get this output by using an Identity MVP matrix for 2D graphics. I know this is an ugly hack that works for now.

How to do this properly using Orthographic matrix ?

sentences:
Increasing resolution of a texture? I'm doing some experiments on my own to improve my general skills with HLSL and so forth. In other words, I'm not doing any serious game development, but only looking to expand my knowledge within the field.
I'm trying to figure out how I can increase the resolution of a texture, and multiply it X amount of times.
Consider the following low-resolution picture:

A typical scenario for me would be to scale up this picture 3 times in the shader without interpolation, and draw the new result:

I've been experimenting with a shader that transfers the small picture on to a texture as a variable on the shader. I got that far. Now I just need it to take that texture using tex2D or something else, and scale it up.
How would I do that?

sentences:
Ogre Render Lines completely wrong I'm trying to render line list using indices of triangles as follow

float *vertices = static_cast<float *>(vertexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));

for (int i = 0; i < out.numberofpoints; i++)
{
    vertices[(i*3)] = out.pointlist[(i*3)];
    vertices[(i*3)+1] = out.pointlist[(3*i)+1];
    vertices[(i*3) + 2] = out.pointlist[(3*i)+2];

}

vertexBuffer->unlock();

uint16_t *indices = static_cast<uint16_t *>(indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));

int  l, t;
int numTriangles = out.numberoftrifaces*3*sizeof(uint16_t);
for (l = 0, t = 0; t<numTriangles; t += 3) {
    // Each vertex has to be listed twice
    indices[l] = out.trifacelist[t];      l++;
    indices[l] = out.trifacelist[t + 1];    l++;
    indices[l] = out.trifacelist[t + 2];    l++;
    indices[l] = out.trifacelist[t + 2];    l++;
    indices[l] = out.trifacelist[t + 1];    l++;
    indices[l] = out.trifacelist[t];      l++;
}

indexBuffer->unlock();

The problem that ogre renders broken triangles and it's completely wrong. I'm not doing anything wrong regarding rendering the lines that the triangles are composed

I'm using ogre 1.9

sentences:
I can't clear the paint image in my Canvas I'm trying to make the Mario move, but somehow it leaves traces behind, can anybody help???

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(){

    drawMarioSprite();
    drawTiles();
    window.requestAnimationFrame(draw);
}

window.requestAnimationFrame(draw);

thank you

sentences:
UDK : UTWeap_RocketLauncher gift CreateInventory: Any idea why this does not work properly? I am giving the player an instanced class of UTWeap_RocketLauncher in an instance of UTGame.

PlayerPawn.CreateInventory(class'FobikRocketLauncher',false); // Does not work
PlayerPawn.CreateInventory(class'FobikLinkGun',false); // Works

Even if I give the original class (eg. UTWeap_RocketLauncher) it does not actually show up. However if I do a "GiveWeapons" cheat, I get it just fine. It also works if I had code it into the map. - But UTWeap_LinkGun works fine either way.

Any ideas? It shows the default ammo amount, and the icon on the HUD.

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:
How can I determine the pixels covered by a transformed triangle (without drawing it)? I have three points that form a triangle in a 3D scene. I want to apply an arbitrary rotation/translation transformation to this polygon and later check in which pixels of an image they would be rendered (if any), taking occlusion into account. I want to do this without having any window, so that no actual drawing is done (I know the camera parameters and the "virtual" rendering image size).

How can I accomplish this? I thought about OpenGL and the glReadPixels function, but I am not sure that I can query for a 3D point to get its rendered 2D pixel.

For reference, I am working on a computer vision application where I have an image taken by a camera and a 3D model of a virtual object. The virtual object is a mesh of a lot of triangles. What I actually want is to project the virtual object on the image and get the positions in the image of the non-occluded triangles, so that I can manipulate the image in those positions. As I said, I don't really need to draw, just the calculations. Now, I am doing it manually and I can get rid of those points that are occluded by other points, but I do not know how to take occlusion into account when instead of single points, they are planar triangles.

sentences:
Rotating a child shape relative to its parent's orientation When rotating a shape using a quaternion value I also wish rotate its child shape.

The parent and child shapes both start with different orientations but their relative orientations should always be the same.

How can I use the difference between the previous and current quaternions of the parent shape in order to transform the child segment and rotate it relative to its parent shape?

    public Quaternion Orientation
    {
        get { return entity.Orientation; }
        set
        {
            Quaternion previousValue = entity.Orientation;
            entity.Orientation = value;

            // Use the difference between the quaternion values to update child orientation
        }
    }

EDIT:

If I have understood teodron correctly then this is what I must do

// Qc' = Qp' * Inv(Qp) * Qc
//
// Where:
// Qp   = Parent orientation last frame
// Qp'  = Parent orientation this frame
// Qc   = Child orientation last frame
// Qc'  = Child orientation this frame

set
{
    Quaternion previousValue = entity.Orientation;

    entity.Orientation = value;

    Quaternion childOrienation = value * Quaternion.Inverse(previousValue) * childOrientationPrev;
    //Quaternion childOrienation = childOrientationPrev * Quaternion.Inverse(previousValue) * value;
}

I have tried both multiplication orders but neither method rotates the child object correctly and instead it spins very quickly.

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:
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:
Question regarding irradiance I know that the formula for irradiance at surface point p with normal n given a point light source at position l is:

H = I(cos x) / ||l - p||^2

Where:

x = angle between n and l-p
I() = Intensity of light

But if I have an area light source defined by a polygon P, what is the formula for irradiance?

sentences:
Complex Game AI for Turn-based Strategy Games I'm doing some research for a turn-based Strategy game project and looking for good resources on this topic. The game is a typical war game where countries can fight each other, deploy units and have these units move around on a hexagonal tilemap, attack each other, etc.

I'm particularly interested in how the AI of Civilization V is organized! According to Wikipedia the game uses four different AI systems for different layers of the game's AI:

tactical AI controls individual units
the operational AI oversees the entire war front
the strategic AI manages the entire empire
the grand strategic AI sets long-term goals and determines how to win the game

Conceptually this looks like it makes a lot of sense to achieve a complex AI and it makes me curious to find out about how these different AI systems work (and work together). The tactical AI is probably the most easy to understand since it handles the decision-making for a single unit (move, attack, repair, retreat, etc.) but I think the other AI systems are where it really gets interesting. For example what does the operational AI do and how does it do that? I'm sure these are best-kept secrets by Firaxis Games but it would be cool to get some discussion started on this to find out more about it.

Also if anyone knows any good books that handle turn-based strategy game AI it would be great to know. Obviously this is a sparsely seeded topic on the web. I got "Programming Game AI by Example" but that book is more about single agent behavior AI than high-level goal-oriented AI.

sentences:
Populating NPC's Outside Of Loop This was my original question:
Populating Sprites
I used the following code to spawn Enemy Sprites in my game. I have 2 types that I was using and it would display one then remove it and display the other. It did this repeatedly(Imagine someone playing with a light switch and you have what is happening with the NPCs. EnemyType1 is Off and EnemyType2 is On.).Also It does not apply the current level number meaning, it does not spawn the number of enemies for the level. The number of enemies I want to spawn is the exact number of the level.  I used other types of random methods( nextBoolean(), nextInt(), nextFloat() ). I showed the code to my friend and he told me that I would need to spawn them outside of my loop, but he did not know how to. So now I am trying to see if anyone on stack could help me. What I am trying to do is this:

NPC's = Enemies

I have 2 types of NPC's that I want to use. The number of Enemies that are spawned are equal to the the current level number. I want to be able to spawn how ever many is needed for that level and have it to where which Enemy that will spawn is random, so you don't know if you will get EnemyType1 or EnemyType2 or a Mix. Ex: Level 1, only 1 Enemy spawns, the type is random. Level 2, only 2 Enemies spawn, the type is random. Level 3, only 3 enemies spawn, the type is random. etc.

Thanks In Advance.

sentences:
Managing complicated RPG character data For a detailed survival RPG, the data that needs to be managed can easily become overwhelming if approached in an ad hoc manner.

First, you may want to do away with HP and instead have a system of wounds, where various body parts can be specifically injured and each injury requires individual attention. Attacks can be targeted and the effect of an injury depends on its location and how well it is treated.

The next obvious step is to manage clothing so that each piece of clothing covers particular body parts and provides particular armor values to each part. We also need to keep track of clothing conflicts, where two pieces of clothing try to cover the same area and so they can't be worn together, except when they are designed to be worn under or over other clothing.

In addition, there could be magical effects on certain body parts, or perhaps claws or spikes could be added. Perhaps various limbs could be replaced by cyborg parts, or magical parts. Even worse, perhaps there are creatures alternate body plans with more or fewer than the usual limbs.

Each limb can be divided into parts, so for example a leg consists of a thigh, a knee, a lower leg, and a foot. We want to manage those parts individually, but we also want to remember that together they represent a leg. We might need this so that targeted attacks aren't forced to be overly specific and we can provide players with notifications that doesn't give excessive detail.

For example, in the game "Slaves to Armok" you can sometimes get messages about some particular toe, finger, or ear being hit. This is clearly too much detail for the middle of battle. We wouldn't want be forced to give that sort of detail because we're not storing the fact that these detailed parts add up to a greater whole. At the same time, a strict hierarchy of parts wouldn't be right, because two arms together make up "the arms" of a character, yet each arm individually is part of either the "the left side" or "the right side" of the character, and we'd want to keep track of these relationships so we can provide appropriate messages to the player.

We'd also want all this data to be stored sparsely. For example, if you're facing twenty goblins, there's no point in individually storing every limb and detail for each goblin when they are all identical. We want to store a prototypical goblin in one place, then each individual goblin can be represented only by how it differs from the prototype. Further, the prototype goblin could be represented by how it differs from the prototype human. This is not just to save memory, but also to allow the game to know what makes each character special so it can give the player relevant messages. The game could mention "the goblin with the head wound" or "the goblin with the spiked glove" because that's exactly how those goblins are represented in memory.

Obviously one shouldn't jump blindly into designing such a game, solving each problem as it arises. This level of complicated data needs a database-style system to keep all the details organized, yet a simple relational database doesn't provide an obvious solution. Could something like an Entity System be the right approach?

Is there a known strategy for managing this sort of data that experienced game developers would always use for making this sort of game?

sentences:
How can I properly display the distance with the unit in a string on the UI? I wrote a script for distance of car and I don`t know how to make distance like this Distance: 156Km. I wrote this code:

distanceText.text = ((int)distance).ToString() + "Km";

It works only from 1 to 9; when it goes to 10 Km, it disappears but if I write it like this:

distanceText.text = ((int)distance).ToString() + " Km";

It show like this: from 1 to 9 -> "5 Km" and from 10 to 99 -> "99Km" but when it goes to 100 Km and above, it disappears. What code should I write for this to show always Km after the distance.

And I have one more question. I have a gameover canvas and I'd like in gameover canvas to show the final distance I make with PlayerPrefs but it doesn't work.

Here it shows how it does not work:

sentences: How to edit colliders in Unity2D I can edit colliders by holding down the shift key. But when i add a second collider, the shift key always selects the first one. And there is no "Edit Collider" button in the editor (Win/4.5.4f1). I'm testing it with two EdgeColliders2D.

sentences:
How to map absolute Joystick position to object rotation? In my (Ogre) 3d scene I have an object that should be rotated locally based on Joystick input. I have a Joystick with min/max values of [-32767, 32767] on both X and Y axes. When the Joystick is in its origin position, the object should not be rotated. When the user moves the Joystick, the object in the 3d scene should follow this movement (or better: orientation) up to a max. of +/- 45 degrees on both axes.

Or in other words: when the user moves the Joystick e.g. fully to the left, the object's orientation in the 3d scene should be set to 45 degrees on the according axis.

Being new to 3d programming I searched on the Internet on how to achieve this. I think to understand that I want to use Quaternions for this task. I found some examples and tutorials on how to use Quaternions for rotating objects. What I don't understand though is how I can map from the Joystick's current absolute axes positions to the absolute, local rotation of an object.

I see that I could use the rotate() method of the object's node to set its rotation, but I understand that this rotates the object relatively to it's current position. But instead I want to map from the Joystick's absolute position to the absolute orientation/rotation of the object in the scene.

Any advice how I should approach this?

sentences:
Algorithm for constructing the corners of a regular, n-sided polygon I've googled this using a lot of keyword combinations, but to my great surprise I could not find an algorithm for constructing a regular, n-sided polygon into a given circle, i.e., finding the coordinates for the n corner points. All I could find were instructions how to do it by physical compass and straightedge, or interactive browser plug-ins without source.

So where could I find such an algorithm?

sentences:
How to allow free download of a paid game to specific users if I am a game developer, how can I allow some selected users to download it for free? The options I am aware of are the following:

Use the built-in functionalities of play store and iTunes connect. This is not an option for me because they restricts the number of coupons I can create
Use some deep linking framework to unlock paid features for users coming from some specific link. This could be an options, but it can means the need of too many changes to my codebase

Are there any other options than these?

Thank you

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:
Is it viable to wrap D3D to change its API style? I have an interest in developing games professionally and have started learning DirectX 11 to that end.

I come from a Java background, but with the recent changes introduced with C++11, I've come to like C++ a lot. Coming from Java, I find that the DirectX API reliance on output arguments and a lot of descriptor structs a little disconcerting.

I'm trying to build a framework around the API that returns values instead of using output arguments. The framework also rolls descriptors into the class (e.g. DXGI_SWAP_CHAIN_DESC into a SwapChain class) and internally handles the updating that would be required for any changes. I also plan to use exceptions rather than return codes to handle error conditions.

Is such a framework viable or it just a Java programmer carrying over his coding style into C++?

EDIT: The goals I'm trying to achieve with the framework are that, I want it to rely on returning values, throwing exceptions, handling memory using C++11 and ATL smart pointers. An early iteration of the framework can be found at:
https://github.com/Dolvic/DirectX-Classes

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:
How to inherit of a scene tree structure in a way that a change in the ancestor is updated in the descendant? Consider this structure:
* KinematicBody2D (Actor)
|_ AnimationPlayer (able to make a rotation of 360)

Now I want to make a Player and an Enemy that inherits of that structure in a way that when I change the animation on the Actor Scene, Enemy and Player are updated.
Is there a pattern that allows that?

sentences:
XNA HLSL Exclude texture? I'm going through HLSL tutorials and I have lighting and texturing setup. Right now in my shader I take a texture, but if I leave that variable blank it gives me an error. Half of my models have textures and the other half don't, is there a way to "skip" the texturing part for the models that don't have them and set it for the models that do without having to make a completely seperate shader that only deals with lighting?

Also, whilst I'm asking this, is saturate and normalize the same thing?

Thanks

sentences:
using delta timing is causing shake I am using delta timing to account for potential drop in frame rate. Only trouble being when I do this, I can notice an ever so slight wobble. I checked out the following JSFiddle coming from a tutorial on the subject and I can even see the wobble there, specifically on the 30fps example. http://jsfiddle.net/straker/bLBjn/

my code is:

var delta = {
    now: 0,
    last: 0,
    difference:0,
    time: 1000/60
}

var d = function(val){
    return val/delta.time * delta.difference;
}

Then further down at the game loop

delta.last = Date.now();
animate();
function animate(){
    delta.now = Date.now();
    delta.difference = delta.now - delta.last;
    delta.last = delta.now;

    //update a sprite
    platform.x -= d(10);

    requestAnimationFrame( animate );
}

How can I keep the animation smooth?

sentences:
Disabling, overriding or hooking a VS warning to Unity's Vector's ToString()? I've just spent 2 hours debugging a misbehaviour because ToString() truncates to 1 digit by default.

I want to disable the parameterless version so I won't use it by accident and I will always have to define how much truncation I want.

Or if this isn't possible I want to redefine it, so it will truncate to 3 digits for example.

Or somehow hook a custom warning to it, so Visual Studio will tell me that I'm using it?

Is this possible?

sentences: In Unity, my mesh is not rendering when huge (scale of 1400000) Any help/tips? This is for a space game and I really want realistic measures. The user WILL get really close to the sun. Any tips with dealing this? I can see the whole "Corona" but not the big sphere at the center

sentences:
Infinite scroll with tweens in Phaser Let's say you have a bunch of tweens running like this:

http://holbrook.no/tests/featherfall.html

Now you want to scroll them horizontally while they fall. By updating camera x, they start moving, but in the end, the camera x value will overflow. And besides, one might want to wrap some background graphics before then.

Therefore we need to periodically snap the camera back to the original position. But then the tweens will snap back too.

So the individual sprites need a transform value on top of the current tween position to correct for the camera repositioning.

I haven't found any setting in Phaser for this. Any ideas?

EDIT:

It's possible to work around it with keeping a global variable to keep track of the camera yanking, and adding it manually to the onUpdateCallback of the tween, and consolidating the difference with the next tween change. But the hack seems to be glitching sometimes, and I suspect it's slower than if an internal transform variable could be used. Anyway, here's the result:

http://holbrook.no/tests/featherfallscrolled.html

sentences:
Perspective division by zero yields unexpected results Usually, this is how a shape in clip space is defined:

[0.25, 0.25, 0.0, 1.0]
[0.25, 0.75, 0.0, 1.0]
[0.75, 0.75, 0.0, 1.0]
[0.75, 0.25, 0.0, 1.0]

After perspective division to NDC space the result looks following:

However, when setting the w-component of the 2 rightmost vertices to 0:

[0.25, 0.25, 0.0, 1.0]
[0.25, 0.75, 0.0, 1.0]
[0.75, 0.75, 0.0, 0.0] // <-- Note that w=0 here
[0.75, 0.25, 0.0, 0.0] // <--

After perspective division (division of xyz components by w component), I'd expect both vertices to be "projected" to [+infinity,+infinity], since this is how it's described on MSDN:

  Divide by 0 produces +/- INF, except 0/0 which results in NaN.

However, the result doesn't indicate that. In fact, the vertices seem to be "projected" to completely different positions:

Any ideas of what's happening there? How would I get a hold of vertex data after perspective divide (stepping through the HLSL disassembly only gets me to the values in clip space)?

The reason I'm asking this is because I have actually seen this method of setting w-component to 0 used for projecting vertices away.

sentences:
Issue with Texture2D memory leak in Unity I have a simple method that converts RenderTexture data into Texture2D
public static Texture2D RenderTextureToTexture2D(RenderTexture renderTexture, int width, int height,
    TextureFormat textureFormat = TextureFormat.RGB24, bool mipChain = false) {

    Texture2D tex = new Texture2D(width, height, textureFormat, mipChain);
    RenderTexture.active = renderTexture;

    tex.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
    tex.Apply();

    RenderTexture.active = null;
    // Here I want some way to release memory occupied by tex
    // I want to release tex here because i believe everytime this method executes tex is not getting garbage collected and stays in memory
    // Only problem is I cannot release it before, and after returning, it is obvious I cannot do that.
    return tex;
}

The above mentioned method is working exactly as intended. However, if I call this method multiple times, or in update it starts using so much memory

How can I avoid this problem?
Edit
I cannot share the entire code but this is minimal code to reproduce the issue
[SerializeField] private RenderTexture renderTexture;
private Texture2D mTexture;

private void Start() {
    mTexture = new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.BGRA32, false);
}

private void Update() {
    mTexture = TextureUtils.RenderTextureToTexture2D(renderTexture, renderTexture.width, renderTexture.height, TextureFormat.BGRA32);

    // Some agora sdk stuff to share the mTexture over the network for screen sharing
}

sentences:
Json Libgdx serialize / de-serialize a Object Map of Object Maps Any one have any ideas on how I can serialize / de-serialize an

ObjectMap<Enum, ObjectMap<String, Object>>();

(Object is usually a String Integer or Vector2 ) using libgdx's built in json classes?. On de-serialize the inner ObjectMap, is always null even though the values are written to the json file.

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:
Change texture settings for each object So I'm kinda new to Unity, but I've used it a couple of times before. Here's my issue:

I have two cubes with a random texture applied to them (drag'n'dropped something from the Asset Store). These cubes have different sizes, where one is a square and one is a rectangle. I want to set the tiling size to be different on them (because they are obviously stretched on the rectangle), but when I click on one and change it, the settings changes for both of them.

This is how it looks right now: http://i.imgur.com/JtubBle.png

Is it possible to make these settings unique for each object somehow?

sentences:
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:
1:1 mapping of texels to pixels with DX11 and multisampling and linear interpolation Is it possible to get a 1:1 mapping of texels to pixels on a multisampled target in DX 11 with interpolation? It seems to me that the texture coordinate used in the shader is always one of the sub-pixels, not the center of the post-MS-processed pixel on my NVIDIA driver. With the reference renderer, however, the texture is correctly read from the center of the texels, which leads me to assume that my texture and point coordinates are correct.

This is, of course, only a problem when I enable some form of continuous interpolation. Point sampling easily circumvents the problem, so this is more out of curiosity.

I was just wondering if this is implementation-defined or possibly a hardware/driver bug? The issue makes it somewhat harder to implement correct GUI rendering, because you can no longer turn off multisampling via the rasterizer state in DX11 feature levels, and this small offset leads to bleeding-in of the neighboring elements in my texture atlas.

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: Why Epic don't release a pre-compiled binary tarball for Linux? On linux, the 'recommanded' way of installing ue4 on linux is building the engine from github source.  It is very time comsuming.  For each new version, I need serveral hours to rebuild it.  Why don't they just release a pre-compiled tarball so that we can use it right way?

sentences:
What are "free vertex indices" in WebGL 2 and how do they relate to geometry shaders? In January Notch tweeted about WebGL 2:

WebGL 2 is happening. Bye, compatibility! Hello, 3d textures and pixel buffers!
oh god it's got free vertex indices in the shader. That is basically a geometry shader.
.. which is great considering I'm rendering like five triangles..

What are these "free vertex indices" and how do they relate to geometry shaders? I'm new to all this and my google-fu is failing me on this occasion.

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:
Special Pathfinding Algorithm I need help with following pathfinding Task:

I have a grid (7x7 squares) and the starting square is always on the far left side (column 0) and its target is to reach the far right side (column 6).
Between col 1-5 are some walls where the path should "walk" around.

The special thing about the task is, the path can only walk straight,diagonal up, diagonal down, so its column increases += 1 for each movement.

For Example: (row/col)
Start:(1/0)
Path:(1/1) straight
    :(2/2) daigonal down
    :(3/3) diagonal down
    :(3/4) straight
    :(4/5) diagonal down
    :(4/6) straight (reached col 6 , finish)

I'm not sure about A*, maybe its also working for my task?
can anyone help me to find a good algorithm for this task?
I would prefer C++ as code.

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:
Ways to improve endless racing traffic I am looking for ways to improve my traffic AI for endless racing game.

Currently, I have hard coded situations where randomly cars will be spawned ahead of user bike depending on position of player.

The thing most bothering me is how to provide user challenging situations where he will feel fun to play. Good example of such AI can be found here,
https://www.youtube.com/watch?v=CJozc6PA9lI

What are the ways you guys would go on implementing Traffic AI for endless racing? What's your suggestion on same.

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:
How can I stop the ball from bouncing forever without changing the gravity? I am using Monogame in Visual Studio 2019 and I need to find a method to make the ball that I fired with the cannon stop after bouncing from the ground, and while doing this, I have to not change the gravity.

gravity = 10;
yFriction = 0.2;

    public override void Update(GameTime gameTime)
    {
        position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;

        velocity.Y += gravity;

    }
    public void CheckBounce(SpriteGameObject other)
    {
        if (!this.CollidesWith(other)) return;

        CollisionResult side = this.CollisionSide(other);
        Bounce(side);

        // Relocating the ball if it's in the wall
        switch (side)
        {
            case CollisionResult.LEFT:
                position.X = other.Position.X + other.Width + this.Center.X;
                break;
            case CollisionResult.RIGHT:
                position.X = other.Position.X - this.Center.X;
                break;
            case CollisionResult.TOP:
                position.Y = other.Position.Y + other.Height + this.Center.Y;
                break;
            case CollisionResult.BOTTOM:
                position.Y = other.Position.Y - this.Center.Y;
                break;
        }
    }

    public void Bounce(CollisionResult side)
    {
        switch (side)
        {
            case CollisionResult.BOTTOM:
                velocity.Y *= yFriction;
                Stop();
                velocity.Y *= -1;
                break;
            case CollisionResult.TOP:
                velocity.Y = Math.Abs(velocity.Y) * yFriction;
                break;
            case CollisionResult.LEFT:
                velocity.X = Math.Abs(velocity.X) * xFriction;
                break;
            case CollisionResult.RIGHT:
                velocity.X = Math.Abs(velocity.X) * -xFriction;
                break;
        }
    }
    public void Stop()
    {
        if (velocity.Y <= gravity)
        {
            velocity.Y -= velocity.Y;
        }
    }

At this moment it puts it's velocity.Y to 0. But the problem is the gravity. After bouncing because it doesn't collides, it keeps adding velocity to the ball. As a result I printed out this variables:
After gravity adding
39.01105
After gravity adding
49.01105
After Friction
9.80221
After Stop
0
After bounce
0
After gravity adding
10
After gravity adding
20
After gravity adding
30
After gravity adding
40
After Friction
8
After Stop
0
After bounce
0
After gravity adding
10
After gravity adding
20
After gravity adding
30
After gravity adding
40
After Friction
8
After Stop
0

And keeps so on.
Thank you all in advance.

sentences:
how to place object relative to parent at x distance specified - Unity First of all sorry if the question is incomplete or irrelevant, I'm new to Unity so all informations are messed up in my head, I'll provide any additional informations if necessary. Second of all sorry for the long post, I tried to provide everyting in order to be a clear question. ^^

My application in two words:

Place furnitures or construction objects (doors/windows) in scene. Everything is fine utill i touch the construction objects subject, since the application is mobile, it will be hard for user to place the door at the exact place so I decided to help and put a little menu where he can specify where to put it:

and the scene (room in this case ) looks like this:

Some implementation details:

The walls are a prefab instantiated 4 times:

 GameObject wall_N = Instantiate(wallPrefab);
 wall_N.gameObject.name = "Wall_N";
 wall_N.GetComponent<Transform>().position = new Vector3(center_W, 50, center_H + z / 2);
 wall_N.transform.SetParent(room.transform, false);
 wall_N.GetComponent<Renderer>().material.color = myColor;
 wall_N.gameObject.transform.localScale = new Vector3(x, y, 0);

and so on for each wall.  x, y, z are the values introduced by user and transformed into int

int x = Int32.Parse(xInput); // width
 int z = Int32.Parse(zInput); // length
 int y = Int32.Parse(yInput); // height

and Center_W and Center_H are screen points:

private int center_W = Screen.width / 2;  // 960
 private int center_H = Screen.height / 2; // 540

In the above image i've introduced  x, y, z as 200, 200, 200

Question:

In what coordinates I must work in order to place the door at A dimension specified?  I'm not even sure if this approach is correct, the main idea is to put the door at the correct position in room.

What I've tried

The first idea that came in my mind was to find the bottom-left coordinates from Wall_N and place the door at point + A but then I realised that the bottom-left is represented in different coordination sistem then A. I've search about it and I tried to see the values from screenPoint in different coordinates:

var screenPoint = new Vector3(center_W, 50, center_H + z / 2);

 var worldPos = Camera.main.ScreenToWorldPoint(screenPoint);
 var screenToViewport = Camera.main.ScreenToViewportPoint(screenPoint);
 var viewpointToWold = Camera.main.ViewportToWorldPoint(screenPoint);
 var worldToViewport = Camera.main.WorldToViewportPoint(screenPoint);

 Debug.Log("wallN - screen point " + screenPoint + " to worldPos " + worldPos);
 Debug.Log("wallN - screen point " + screenPoint + " to viewPortPos " + screenToViewport);
 Debug.Log("wallN - viewPort " + screenPoint + " to worldPoint " + viewpointToWold);
 Debug.Log("wallN - world " + screenPoint + " to viewport " + worldToViewport);

but unfortunalelly they didn't tell me anything, I just don't know how to solve this. If my logic is incorrect and/or you have another idea how to implement this, please help me. If the information is not enough, feel free to ask, I'll try to explain as much as I can. If the question title is incorrect or do not represent my question, I'll change it.

Thanks in advance,
Maria

sentences:
How to make a bitmap font having only a PNG file? Is there a way to "convert" an existing PNG file with the characters' images into a bitmap font? Basically, I want to create a FNT file using an image like this...

(source: opengameart.org)
...without the access to a TTF file of the image's characters or any other typical font formats.

sentences:
Mobs living in the physics engine So, yeah. Mobs (including, and indeed especially, the player), physics engine running (cannon.js), first-person perspective, fairly low-poly-count world because I'm targeting WebGL. I'm trying to represent my mobs within the physics engine, moving them by applying forces or impulses, and I'm having some problems:

1) Ramps! The FPS Way seems to be that critters run uphill and downhill and on the flat, all at the same speed. But of course even-slightly-realistic physics really wants you to go slower uphill, especially if you add friction to prevent "standing" mobs from sliding downhill. I've tried compensating for this by calculating how fast the mob "wants" to go, and applying force proportionate to the difference between its actual velocity and desired velocity, but it just Ain't Right. Also, the mobs have a tendency to jump up off the top of staircases.

2) Falling over! To make the mobs collide with things, they have to be represented by some appropriate shape. I've tried a few different ones. Particles are an obvious lose, and fall into every possible crack in the geometry. A box the approximate shape of the bounding box for a standing person falls over constantly, especially on slopes. Putting the center of mass for the object at the bottom of the box helps, but only somewhat. Using a lower, flatter shape-- think "coin with beveled edges"-- prevents the falling down, but fails at detecting collisions. The last thing I tried was a sort of egg shape, which stays up but staggers like a drunken sailor.

Obviously, I'm missing something. What? Do people just have to have Special Physics Of Their Own? Should I toss the whole thing and write that car game instead?

sentences:
Move Camera When Player Move C# i developing side Scrolling endless Game. i want to Change X Axis of camera as player moving to Right. and i almost Done That. but the problem is when move Camera to the Right then its look so stiff in Android Device not Move Smooth.
That's the code I Write in  my Script to move Camera when player move.

public static float offsetX;

void Update () {

    if (BirdScript.instance != null) {

        if (BirdScript.instance.isAlive) {
            MoveTheCamera ();
        }
    }

}

void MoveTheCamera() {
    Vector3 temp = transform.position;
    temp.x = BirdScript.instance.GetPositionX () + offsetX;
    transform.position = temp;

}

and in my Player Script(BirdScript.cs) i also set my player Position and also Get in CameraScript

void Awake() {

   setCameraX();

}

void setCameraX() {

    CameraScript.offsetX = (Camera.main.transform.position.x - transform.position.x) - 1f;

}

public float GetPositionX(){

    return transform.position.x;
}

what should i do to move my camera smoothly in device? thanks.....

sentences:
XNA: Networking, what is a good bytes per second sent/received number I am working with XNA networking, on the XBOX.

I was wondering what is a safe number to stay under in the bytes sent and received when it comes to the xbox. Obviously various factors will effect the number, and you want as little packet data as possible to keep things smooth, but what is a good number for that?

(Using : networksession.bytespersecondsent and networksession.bytespersecondreceived to measure the number.)

A answer is found in the comment of the accepted post. Thanks!

sentences:
generating random block-based worlds with 3D noise I want to create a 3D block-based infinite world.

For any block, I want to be able to compute its block type.

3D perlin noise is the usual building block of such a world.  If you ask the 3D noise function the value for a 3D point, it'll give you a value between -1 and 1.

How do you turn this number into a block type?

I want blocks on the surface to be turf, and different minerals to have different probabilities based on depth.  I want sprawling caves and caverns and lava flows but not small ones.  And so on.

So how do you turn noise into block types into a coherent subterranean world?  Particularly how do you make things like coal appear in seams and crystals only appear in caves and any other rules that can be invented that make the type of a block dependent upon its neighbours?

And how to do this efficiently, in an oracle function rather than by having to create large 3D arrays to store the decided outcomes of some terraforming?

sentences:
Drawing game app: How to use vector graphics instead of bitmap in Android? I have a problem concerning the concept of using vector graphics instead of bitmaps in order to draw on canvas. Usually to draw on canvas we set a bitmap to that canvas and we start drawing pixels on it by simply moving our finger on the screen. However, this method will result very pixelated - relatively low-quality drawings.

It is noteworthy that there are some drawing apps that result in very smooth curves when you want to draw via them. After doing some googling and researching, I knew that there is the new concept of use vector graphics that is being used in order to draw smooth edged drawings on the screen.

Look guys, the thing is when I developed my drawing app, I used bitmap **(which was already there as an object given by Android)**in order to draw cubic Bezier curves. No matter how much I tried to smooth my drawings out, I always get stair-like edges.

If you are interested in how I developed the curve, please read this. If not, just ignore this bold paragraph:

In order to draw the cubic bezier curves I simply took the sampled touch points and for every 4 points in these sampled points I calculated the 2 intermediate control points (the ones that the curve never touch) to create a bezier through the sampled points. For the curve to appear, I used bitmap and paint objects given by android.

After getting the undesired result (low-quality curve), I decided that I want to use vector graphics in order to do the same thing but with a higher quality. The thing is that I am very new to Vector Graphics, that I don't know where to start.

My question is simple as is:
Is there a platform given to me by Android in order to use vector drawable like in the case of bitmap? If not, am I supposed to start this from scratch? I am clueless and any tip or hint from you will be greatly appreciated.

sentences:
Why do GPUs have limited amount of allocations? I've been learning Vulkan lately and I read that you can allocate VRAM memory only set amount of times and it doesn't matter if it's 2gb or 2kb, why is it?

I'm specifically referring to VkPhysicalDeviceLimits structure which has a field maxMemoryAllocationCount.

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:
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:
Javascript game to Phonegap for android game? me and a friend of mine are in the process of building a javascrip/HTML5 game and I'm running into a few questions about the process of using converting it to an android game. I plan on using Phone gap as it appears to be fairly simple and does what I'm looking for it to do. I've done a little research, but there is still a few questions I have about the whole process.

Can I run the app offline? I want to be able to post the app to app store and allow people to download and play offline. Given the fact there will be no server requests can I make the game function offline?
As I make the game for the computer I'm relying on the keyboard as input to move around. Obviously, once I port it to mobile this won't be practical. What is the easiest way to go about doing this? I'm considering simply changing the game to have a click on screen which moves the character to that location or even a simple movement pad in the corner of the screen. Would these on screen clicks change correctly over to mobile.
Lastly, what is the easiest way to handle save data. On the computer side I plan to use HTML5 local storage to store game data. Does this convert to mobile or is there a better way?

I appreciate any help in this matter.

sentences:
Unity 2019.3 - Player getting stuck on wall Problem
I have a wall made with a Tilemap and a Tilemap Collider 2D. Sometimes, when the player jumps against the walls, it seems to get stuck. You do not need to be pressing the directional button, when pressing jump, for this to happen. Just being pressed against the wall, and then pressing the jump button alone, reproduces the error.
Demo

What I have tried
I applied a Physics collider to the Walls with friction set to 0. It didnt solve the issue.

Info that might be relevant to solve this
This is the player controller for the movement. Notice the FixedUpdate method, to see how I control the velocity of the Rigidbody2D.
using UnityEngine;
using UnityEngine.InputSystem;

namespace Notan
{
    public enum Direction3 { Left, Right, Still }

    [RequireComponent(typeof(Rigidbody2D))]
    public class PlayerMovement : MonoBehaviour
    {
        [SerializeField, Range(0f, 100f)] float speed = 10f;
        [SerializeField, Range(1f, 20f)] float jumpForce = 3f;

        Rigidbody2D body;
        Direction3 direction;
        bool jumpScheduled;

        void Awake()
        {
            body = GetComponent<Rigidbody2D>();
        }

        void Update()
        {
            UpdateDirection();
            UpdateJump();
        }

        void FixedUpdate()
        {
            UpdateVelocity();
        }

        bool LeftPressed() => Keyboard.current.leftArrowKey.isPressed;

        bool RightPressed() => Keyboard.current.rightArrowKey.isPressed;

        bool SpacePressed() => Keyboard.current.spaceKey.wasPressedThisFrame;

        void UpdateDirection()
        {
            direction = LeftPressed() ? Direction3.Left : RightPressed() ? Direction3.Right : Direction3.Still;
        }

        void UpdateJump()
        {
            if (SpacePressed()) jumpScheduled = true;
        }

        // Left is -1
        // Right is 1
        // Still is 0
        int GetHorizontalDirection() => direction == Direction3.Left ? -1 : direction == Direction3.Right ? 1 : 0;

        void UpdateVelocity()
        {
            var velocity = body.velocity;
            velocity.x = GetHorizontalDirection() * speed;
            if (jumpScheduled)
            {
                velocity.y = jumpForce;
                jumpScheduled = false;
            }

            body.velocity = velocity;
        }
    }
}

This is the configuration of the players Rigidbody2D

Unity version
I am using Unity 2019.3.9f1.

sentences:
Flash animation or Sprite sheet animation good for Unity mobile games I would like to develop dress-up and cooking kind of games. So it needs lots of animations. Our designers done the animations in the lash. I found the plugins callued GAF and UniSWF to convert flash animation to Unity or We can convert animations into sprite-sheets and animate them in Unity, But i don't know which one is the best way to do animations for mobiles with better performance and lower game size.

Any kind of suggestion is good. Thank you!

sentences:
Using multiple indexes with buffer objects in OpenTK I've got multiple buffers in OpenGL holding data on position, normals and texcoords.

I also have an equal number of buffers holding distinct index data for each of those buffers.

I quite like this format (indvidual indexes for each buffer) utilised by COLLADA since it strikes me as optimally efficient at accessing each buffer.

I've set up pointers to the relevant data arrays using VertexPointer, NormalPointer, etc however I have no way to assign pointers to the index buffers since DrawElements appear to only look at one ElementArrayBuffer.

Can I utilise multiple indices some way or will I be better off using a different technique which can support this? I'd prefer to keep the distinct indices if at all possible.

sentences:
Connecting clients with UDP and WebSocket connections I'm in the process of making a physics intensive multiplayer game. Naturally I use a UDP to transfer packets regarding rigidbodies between client and an authoritative  server.

However non-essential packets I'd prefer to use a more reliable connection like WebSockets. This would be for things like voice chat, text chat, scoreboard, etc. It also seems the be a nice approach to checking if the client is still connected and if not, stop sending it UDP packets.

I'm actually unable to find use cases of this dual connection approach online and I was wondering how this is typically handled in similar games. Is it very far fetched or unconventional?

Another question would be how far do I take relying on the WebSocket connection? Lets say for managing remaining bullets in a guns magazine, would it be better over UDP or WebSocket?

I feel like WebSockets would be best in this case because if the bullet was successfully spawned and the server needs to remove a bullet from the client's gun's magazine, if that packet doesn't arrive at the client, then they shot a free bullet...

The UDP equivalent for this scenario would be to always send the client's magazine state as packets and the client just updates it's magazine whenever the packets get to them. My concern here is overloading the network traffic data that might not have even changed...

sentences: LibGDX search for file types in local file system I'm building a system that allows users to upload files to LibGDX's local directory to play them in the game. How can I search recursively through the local file system for a specific file type and return all returned files?

sentences:
How to clip game objects to a rectangular area I'm trying to figure out how to do this but am coming up short. I'm making a slot machine in unity 2d and would like to clip the tile prefabs when they leave a given rectangular area.

I can't seem to figure out how to do this. All of the references I've found say to use a clipping shader with a mask texture, but it seems like massive overkill to use a masking texture when I just need an easy pre-defined rectangular area.

sentences:
Possible to test a game on multiple machines without owning multiple machines? I'm working on a small PC game (Uses custom engine written in C++) that I would like to test. Not as much the gameplay but the engine itself. See if there are any crashes, errors, glitches or missing library files. I'm using OpenGL for graphics and that always does unexpected things with a different driver / GPU.

At the same time I don't yet want to give out the half-finished game for public testing. Is there such online service that allows you to upload a program to run and gives you back the result of the run. A log file or a screencap or what not. Or is it possible to do such testing with VirtualBox?

sentences:
GLSL: Vertex attribute to int I'm trying to write a shader which renders a multitextured geometry wihout rerendering the geometry with each texture.

In my test I'm not using textures, I just convert the texture index to a color (0: red, 1: blue, 2: green). I'm rendering 3 planes with 3 different "texture index" attributes. The vertex shader just passes that float to the fragment shader where I convert it to an integer (and use this interger as an array indexer in the main shader).

So a vertex consists 4 floats (0-2: position, 3: texture index).
Everything is fine until I'm trying to use that "texture index".

Here's the VertexShader:

#version 130
uniform mat4 proj;
uniform mat4 view;
uniform mat4 world;

in vec3 in_position;
in float in_fl;

smooth out float FL;

void main(void)
{
    FL = in_fl;

    gl_Position = proj * view * world * vec4(in_position, 1);
}

FragmentShader:

#version 130

out vec4 out_frag_color;
smooth in float FL;

void main(void)
{
    int i = int(FL);

    if(i == 0)
        out_frag_color = vec4(1,0,0,1);
    else if(i == 1)
        out_frag_color = vec4(0,0,1,1);
    else if(i == 2)
        out_frag_color = vec4(0,1,0,1);
    else
        out_frag_color = vec4(1,1,1,1);
}

And the result (the numbers are the "texture index" of the plane):

Tested on an Intel HD 4000 GPU and an nVidia GTS 250, same result.
As you can see 0 is OK, but 2.0 is sometimes 2 (green), sometimes 1 (blue), why?
If I pass that "i" to a sampler2D array, nothing shows up on the screen, because "i" is out of the array bounds.

The rendering is done using OpenGL 3.0, with a VAO, an ArrayBuffer and an ElementArrayBuffer.

This is how I setup the attrib pointers:

GL.EnableVertexAttribArray(0); //pos
GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, true, sizeof(float) * 4, 0);

GL.EnableVertexAttribArray(1); //tetxure index
GL.VertexAttribPointer(1, 1, VertexAttribPointerType.Float, true, sizeof(float) * 4, sizeof(float) * 3);

I've tried using VertexAttribPointerType.Int and int attributes,
Also I've tried setting the "FL" varaible in the vertex shader, with 0, the result is red which is good, but if I use 1 or 2 the result is again a mess.

So what do you think? It's a rounding problem?
Or how should I render the geometry with multiple textures wihout rerendering the geometry with each texture?

sentences:
How can I convert a rigidbody velocity value to some normal reading speed value? void Update()
    {
        var vel = rigidbody.velocity;
        movementSpeedUiText.text = vel.ToString();

The result is :

what I understand from this ? what is the speed ? I don't want to know only if the player is moving or not but what is the speed.  what I see is some vector3.
This is the complete script :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerSpeedDistanceController : MonoBehaviour
{
    public GameObject target;
    public GameObject speedArea;
    public float speed;
    public Animator animator;
    public Text movementSpeedUiText;
    public Text distanceFormTargetUiText;
    public Text playerDirectionUiText;

    private float distance;
    private Rigidbody rigidbody;
    private Vector3 lastPosition;
    private bool isMoving;

    // Start is called before the first frame update
    void Start()
    {
        lastPosition = transform.position;
        isMoving = false;

        rigidbody = GetComponent<Rigidbody>();

        movementSpeedUiText.text = animator.GetFloat("Forward").ToString();
        distanceFormTargetUiText.text = Vector3.Distance(transform.position, target.transform.position).ToString();
        playerDirectionUiText.text = transform.forward.ToString();
    }

    // Update is called once per frame
    void Update()
    {
        if (isMoving == false)
        {
            movementSpeedUiText.text = "0";
        }
        else
        {
            movementSpeedUiText.text = animator.GetFloat("Forward").ToString();
        }
        distanceFormTargetUiText.text = Vector3.Distance(transform.position, target.transform.position).ToString();
        playerDirectionUiText.text = transform.forward.ToString();

        if (transform.position != lastPosition)
            isMoving = true;
        else
            isMoving = false;

        lastPosition = transform.position;
    }
}

because the player have animator and also some more animators on the childs the movement speed is affected by this animators. even if the player is not moving he is still looks like moving when calculating the speed.
"Forward" is parameter of the HumanoidWalk speed so when I press the W key and the player is moving it's showing the value of the "Forward" parameter.
and because when the player is not moving I don't press on W or any other key it's showing in the movementSpeedUiText text some E long number.
That's why I added the part that detect if the player is moving or not and if not I assign "0" to the text.
The problem now is when I press on the W key and move the player the text is stuttering flickering.

sentences:
Screenshot preview freezes a game for a few seconds I have a screenshot preview at the end of the level, but when I show it my game freezes for a bit(low fps for a few seconds). This is code I use to load screenshot and crop it(for a little preview sample). Please, help me to solve this lag issue

private IEnumerator ShowScreeshotPreview()
{
    yield return 0;

    screenshotTexture = new Texture2D(2, 2);
    byte[] fileData = File.ReadAllBytes(destination);
    yield return 0;

    screenshotTexture.LoadImage(fileData);
    yield return 0;

    Rect croppedSpriteRect = new Rect();
    croppedSpriteRect.height = screenshotTexture.height;
    croppedSpriteRect.width = screenshotTexture.height;
    croppedSpriteRect.y = 0;
    croppedSpriteRect.x = 0;

    croppedTexture = new Texture2D((int)croppedSpriteRect.width, (int)croppedSpriteRect.height);
    yield return 0;

    croppedTexture.SetPixels(screenshotTexture.GetPixels((int)croppedSpriteRect.x, (int)croppedSpriteRect.y, (int)croppedSpriteRect.width, (int)croppedSpriteRect.height));
    yield return 0;

    croppedTexture.Apply(); // Memory leak occurs here
    yield return 0;

    screenshotPrview.mainTexture = croppedTexture;
    yield return 0;

    ScreenshotPreviewAnimator.SetBool("visible", true);
    screenshotLoaded = true;
}

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: Interfacing with bill/note acceptors in unity What ways are there to interface a unity game with a bill acceptor/validator? Usually this type of devices are connecting to a computer using a serial port and communicate over ccTalk protocol. But what ways exist of incorporating this type of devices in Unity?

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

here is my code :

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

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

    transform.Rotate(Vector3.forward, rotX);

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

this is the effect :

sentences:
Accessing soft keyboard on Android via Monogame I have a game built in Monogame targeting the Android and iOS platforms. I need to develop a login form for the game. I've begun to roll out my own UI components (text inputs, buttons, so forth), as I've read that there are no commonly used libraries for this purpose.

Now, I'm looking to access on the soft keyboard (for Android at the moment) but can't seem to get it working.

I've looked into the GamerServices module, but I'm pretty sure this only applies to Windows OSes.

I'm trying to implement what looks like the C# wrapper to the Android API. While debugging this code in Visual Studio 2015, the ShowKeyboard function executes without error, but the onscreen keyboard in the emulator doesn't appear.

I've added the following functions to my Android Activity class generated by Monogame, then access these functions when appropriate in-game. The code executes, but alas no keyboard.

    public static void ShowKeyboard()
    {
        var pView = KeyboardConfig.game.Services.GetService<View>();
        var inputMethodManager = KeyboardConfig.Application.GetSystemService(Context.InputMethodService) as InputMethodManager;
        inputMethodManager.ShowSoftInput(pView, ShowFlags.Forced);
        inputMethodManager.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);
    }

    public static void HideKeyboard()
    {
        InputMethodManager inputMethodManager = KeyboardConfig.Application.GetSystemService(Context.InputMethodService) as InputMethodManager;
        inputMethodManager.HideSoftInputFromWindow(KeyboardConfig.pView.WindowToken, HideSoftInputFlags.None);
    }

sentences:
Can Google Translate's audio files be used in a game? For my game, I need text-to-speech. Since it's Android, I decided to settle for MP3s, since the range of words spoken is few.

For my prototype, I'm using Google Translate to generate the audio since it has awesome pronounciation across multiple languages.

But can I use it in production? What if I sell my game for $1 on the app store?

All I can find on SE is that the API may be LGPL, and that the licensing page mentions the API is only available for academic research -- nothing more. My usage is a bit different; I'm actually capturing the audio bits and using those instead.

I'm curious to know the license for this; I can't find anything with my Google-fu.

sentences:
Explaining Asteroids Movement code I'm writing an Asteroids Atari clone, and I want to figure out how the AI for the asteroids is done.

I have came across that piece of code, but I can't get what it does 100%

if ((float)rand()/(float)RAND_MAX < 0.5) {
        m_Pos.x = -app::getWindowWidth() / 2;
        if ((float)rand()/(float)RAND_MAX < 0.5)
            m_Pos.x = app::getWindowWidth() / 2;
        m_Pos.y = (int) ((float)rand()/(float)RAND_MAX * app::getWindowWidth());
    } else {
        m_Pos.x = (int) ((float)rand()/(float)RAND_MAX * app::getWindowWidth());
        m_Pos.y = -app::getWindowHeight() / 2;
        if (rand() < 0.5)
            m_Pos.y = app::getWindowHeight() / 2;
    }

    m_Vel.x = (float)rand()/(float)RAND_MAX * 2;
    if ((float)rand()/(float)RAND_MAX < 0.5)
    {
        m_Vel.x = -m_Vel.x;
        }

    m_Vel.y =(float)rand()/(float)RAND_MAX * 2;

    if ((float)rand()/(float)RAND_MAX < 0.5)
        m_Vel.y = -m_Vel.y;

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:
Draw a line/curve for the path an object has taken Hello I am making a game in libgdx. I want to draw a line/curve of the path a object have taken.

First a thought I could save all positions of the objects each iteration and draw line between them using the Shaperenderer. This is however inefficient because the number of saved positions for a object becomes really large, and I have alot of objects.

My second thought was to draw a line between only the previous position and the current position on to a pixmap, and then draw the pixmap to the screen. This way I only need to save the old position because I don't clear the pixmap. The problem is that the world is infinitely big, and the pixmap cant cover the entire world (and it is bad to make a really big pixmap?). Also when I zoom out of the world the lines becomes really small and I cant see them. When I use the shaperenderer, the lines are always one pixel wide independent of the zoom.

So is there a smart way where I can draw the path my objects have taken without saving all previous positions, and where the line stays constant width?

sentences:
How could I achieve an iOS high detailed level design for a platformer? I'm seeing a lot of games that use a predefined and repeating set of tiles for their level (like FlappyBird or the Super Mario game series).

I'm a graphics designer so I would like to create levels with a much higher level of details for the game levels. I'm thinking about games such as Limbo (screenshot at the end of the post) or BadLand.

I thought about designing the whole level in one big  high detailed image which could reach to 30k pixels in width, but I'm not sure if that's the way to go.

How should I structure my game to achieve that level of detail?

I'm using sprite-kit.

sentences:
Make object follow another object while keeping the same distance from it I want an object to follow another object just like the way it follows it when it's parented to it, but smoothly and only in the x and z axis.

Here's my code so far:

distanceX = player.position.x - transform.position.x;
distanceZ = player.position.z - transform.position.z;
transform.position = Vector3.Lerp(new Vector3(transform.position.x, transform.position.y, transform.position.z), new Vector3(transform.position.x + distanceX, transform.position.y, transform.position.z + distanceZ), Time.deltaTime);

Now the problem is that it goes way too close to the player and ignores the current distance.

If you got any questions please don't hesitate to ask.

Thank you for your time!

Edit:

I'm not looking to make the object go to the target's position, just to follow it and keep the distance, just like it does when it's parented to that object, but smoother movements.

Edit 2:

Looks like I have made a mistake when I said that I wanted to keep the same distance between the two objects. What I actually meant was that I want the offset to be the same. I apologize to anyone who I confused or wasted their time! P.S. I'm still looking forward to finding a fix for my issue.

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:
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:
Line at edge of transparent texture on XNA mesh I have a mesh that is computer generated with a texture on top of it with transparancy on one side. The SamplerState is set to LinearWrap because I would like the texture to wrap. The problem I have is that this transparent edge has some weird aliasing. This does not occur when I set the SamplerState to LinearClamp.

I found that when letting the U coordinate go from 0.1 to 0.9 this does not happen. Probably on the transparent side it interpolates U coordinate 1 with U coordinate 0.

What could be the solution to prevent aside from not letting the U coordinate go all the way to 1?

sentences:
Do I need real socket connections to create AI Bot players in a multiplayer web game? I have built a realtime multiplayer web game using WebSocket protocol.

In my game I create about 100 AI bot players to simulate playing the game with the real players. Every time a bot is dead the server will create a new one. I wonder if I need to simulate the Websocket connection and implement Websocket listeners like what I am doing at the moment.

I understand that creating new Websocket connections will use a lot of resources and maintaining the connections eat up resources on the server too. As I don't need to send anything to bot players I probably don't need to create real connections on the server.

The game is working fine. But I am looking for ways to improve. Let me know what you think.

sentences:
Place hexagons together Just made it with some more investigation thanks to this site: Hexagonal grid math, but the hexagons have a little bit spacing horizontally.

Here is the code:

include('class/hexagon.php');

$hexagon = new hexagon(16);

$png_image = imagecreate(500, 500);
imagecolorallocate($png_image, 255, 255, 255);
$black = imagecolorallocate($png_image, 0, 0, 0);

for($i=1;$i<12;$i++) {
    for($j=1;$j<10;$j++) {
        $x = $i * $hexagon->ver;
        $y = $j * $hexagon->height + ( ($i%2) * ( $hexagon->height / 2 ) );
        $points = $hexagon->drawHex($x,$y);
        $last_line = array($points[0][0],$points[0][1]);
        imagettftext ($png_image , 5 , 0 , $x , $y , $black , "C:/Windows/Fonts/Arial.ttf" , "{$i},{$j}" );
        foreach($points as $c):
            imageline($png_image, $last_line[0], $last_line[1], $c[0], $c[1], $black);
            $last_line = $c;
        endforeach;
    }
}
header('Content-type: image/png');
imagepng($png_image);
imagedestroy($png_image);

class hexagon {
    public $size;
    public $width;
    public $height;
    public $hor;
    public $ver;
    public $angle;
    public $rad_angle;
    public $side;
    public function __construct($xsize = 32) {
        $this->angle = 60;
        $this->rad_angle = $this->angle * (pi() / 180);
        $this->side = $this->size * cos($this->rad_angle);
        $this->size = $xsize;
        $this->width = $this->size * 2;
        $this->height = $this->width * sin($this->angle * (pi()/180));
        $this->hor = $this->width * ( 3/4 );
        $this->ver = $this->height;
    }

    public function drawHex($x, $y) {
        $points = array();
        for($i=0;$i<7;$i++) {
            $angle_deg = $this->angle * $i;
            $angle_rad = pi() / 180 * $angle_deg;
            $points[$i] = array($x + $this->size * cos($angle_rad),$y + $this->size * sin($angle_rad));
        }
        return $points;
    }
}

Result:

Any advice?

sentences:
Improving performance of a particle system (OpenGL ES) I'm in the process of implementing a simple particle system for a 2D mobile game (using OpenGL ES 2.0).  It's working, but it's pretty slow.  I start getting frame rate battering after about 400 particles, which I think is pretty low.

Here's a summary of my approach:

I start with point sprites (GL_POINTS) rendered in a batch just using a native float buffer (I'm in Java-land on Android, so that translates as a java.nio.FloatBuffer).

On GL context init, the following are set:

GLES20.glViewport(0, 0, width, height);
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);

Each draw frame sets the following:

GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

And I bind a single texture:

GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle);
GLES20.glUniform1i(mUniformTextureHandle, 0);

Which is just a simple circle with some blur (and hence some transparency)

http://cl.ly/image/0K2V2p2L1H2x

Then there are a bunch of glVertexAttribPointer calls:

mBuffer.position(position);
mGlEs20.glVertexAttribPointer(mAttributeRGBHandle, valsPerRGB, GLES20.GL_FLOAT, false, stride, mBuffer);

...4 more of these

Then I'm drawing:

GLES20.glUniformMatrix4fv(mUniformProjectionMatrixHandle, 1, false, Camera.mProjectionMatrix, 0);
GLES20.glDrawArrays(GLES20.GL_POINTS, 0, drawCalls);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);

My vertex shader does have some computation in it, but given that they're point sprites (with only 2 coordinate values) I'm not sure this is the problem:

#ifdef GL_ES
// Set the default precision to low.
    precision lowp float;
#endif

uniform mat4 u_ProjectionMatrix;

attribute vec4 a_Position;
attribute float a_PointSize;
attribute vec3 a_RGB;
attribute float a_Alpha;
attribute float a_Burn;

varying vec4 v_Color;

void main()
{
vec3 v_FGC = a_RGB * a_Alpha;
v_Color = vec4(v_FGC.x, v_FGC.y, v_FGC.z, a_Alpha * (1.0 - a_Burn));
    gl_PointSize = a_PointSize;
    gl_Position = u_ProjectionMatrix * a_Position;
}

My fragment shader couldn't really be simpler:

#ifdef GL_ES
    // Set the default precision to low.
    precision lowp float;
#endif

uniform sampler2D u_Texture;
varying vec4 v_Color;

void main() {
    gl_FragColor = texture2D(u_Texture, gl_PointCoord) * v_Color;
}

That's about it.  I had read that transparent pixels in point sprites can cause issues, but surely not at only 400 points?

I'm running on a fairly new device (12 month old Galaxy Nexus).

My question is less about my approach (although I'm open to suggestion) but more about whether there are any specific OpenGL "no no's" that have leaked into my code.

I'm sure there's GL master out there facepalming right now... I'd love to hear any critique.

sentences:
MCS character mouth open - is this mo cap animation problem? I have MCS Female Character where I can assigned Mocap to my character. I have downloaded mixamo animation and assigned this to the character but the problem is, the character mouth remains open. I am not 3d artist or animation guy, so here are my question.

How can I solve mouth open problem in unity?
What is the reason that mouth is open? Either mocap data has open the mouth or what else problem?

sentences:
Does gimbal lock occur only when a combination of local and world rotation axis are used? In all the explanations I've seen of gimbal lock, they always refer to the fact that when performing a series of rotations on all axes, it is possible that one rotation might end up aligning an axis with another which causes us to lose a degree of freedom. This never made sense to me since a rotation around e.g. the LOCAL_RIGHT axis will rotation the whole LOCAL_BASIS, no alignment happens. The only explanation I've seen that made sense was this one by DMGregory where it clearly explains that gimbal lock occurs when we e.g. change the yaw using the local basis and the pitch using a world basis.
My question is: Is that the only scenario where gimbal lock occurs or am I missing something? I also thought that quaternions help avoid gimbal lock but again, I'm missing something here because it seems to occur regardless of the rotation representation method (euler/quaternion).

sentences:
How to calculate normal vector of a Bézier curve? How I can calculate the normal vector for two dimensional Bézier curve?

(I have the control points of the curve in the x y plane)

sentences:
Unity - FBX Materials Import as Gray I'm attempting to import an FBX model from Blender into Unity, but the materials' textures aren't coming with it. I've made sure to name all my materials the same as the associated texture files and I've tried having the texture files in all sorts of locations, such as in the same folder as the .fbx or in a "Textures" folder.
I've tried importing the textures separately, the body texture goes onto the material correctly but with no transparency and the eye texture doesn't show up at all.
I've seen that some people's solution was the "Extract Textures..." button under Materials, but it's grayed out for me.

sentences:
How to integrate PS3 & Xbox 360 games to Facebook? After some research online, I am unable to find any concrete references for how to go about implementing Facebook functionality from either Xbox 360 or PS3 games.  There is apparently some degree of integration, but how does one go about hooking into Facebook's API from within a console title?

Is there any How To documentation online?  Or alternatively, is anyone aware of a developer that specializes in incorporating this type of functionality in an existing codebase?

For an answer unaffected by NDA, does anyone know of a company that specializes in integrating PS3 or Xbox games with Facebook?

sentences:
Using Sorting Layers with 3-d meshes I have 3 layers of objects in a game that I am working on. The layers are the "map" layer (Background), "UI" layer (Labels, etc), and the "Object" layer (Movable objects). I am working on a 2-D game, although I'm using 3-d meshes to give shadow effects. I've used sorting layers, but I can't get the objects to render in the correct order. Any ideas what I could be doing wrong?

The UI objects are placed on a world space canvas.

What I'm seeing now:

This is a Scene View, rendered in 3-d

The "Ship" is the only object in the sorting layer "Object" (Object hiding underneath "Guadeloupe" text".

Sorting Layers

Any thoughts how to make this work? I would like to keep the objects where they are, due to shadow reasons, if at all possible. Thanks!

sentences:
OpenGL: How to render a "shadow" for an object that's behind another? First off, an image from Fez that depicts the effect I'm after:

I'm trying to achieve a similar effect in my project. I'm quite certain this is done with a stencil buffer, but the resources on such effect are scarce. How should I approach this? I'm guessing I'm after a sort of "AND" stencil where I'd render a semi-transparent black rectangle over the player where only the pixels that had both the player and a map object.

I'm not sure if it has any effect on it (besides maybe inverting the stencil operations..?), but for other reasons, my pipeline first renders the world and the player is rendered last.

sentences:
Are virtual calls worth it for game entity management? I have seen a lot of game programming tutorials doing this:

//our base class
class entity
{
   /*virtual methods and data common to all entities
   and a 4 Byte virtual pointer*/
};

//Some other class inheriting those calls and data
class Player : public entity
{
   //extra methods and calls specific to class a 4 Byte virtual pointer
};

and thousands of Gameobject classes doing the same thing. What it does that it allows us to make a list of all objects and update and render (and some other things) it in a single loop.

But I have problems with this approach when I want to do something with a single object. suppose we have a list of all entities...

list<entities*> entities = {
new Player0(its properties),
new Enemy0(its properties),
new Player1(its properties),
new Stone0(its properties),
.... and so on
};

and now I want to stop updating Player1 for some reason. Now Either I can assign an ID to each object so that I can use "if" condition to stop updating it or I can have a reference to that object before pushing it to the list which is messy because I cannot have refrences to all of objects. Also lets consider that 4 byte additional size for those objects because of virtual calls.

An Alternative can be to have only references to objects...but again its thousands of objects we are talking about here so It will be hard to manage.

How to handle this problem?

sentences: Best place for learning how to write games in Unity3d What's the best place for tutorials & other learning resources for unity3d?

sentences:
Problem with InverseTransformDirection and non-uniform scale I made the plane to work with mesh vertices
var plane = new Plane(
    hit.transform.InverseTransformDirection(normal),
    hit.transform.InverseTransformPoint(position)
);

If the object has the uniform scale then all looks good

but otherwise the plane normal has weird angle and I don't understand why.

with InverseTransformVector even worser. The angle goes 2 times bigger

Blue line - my plane
Green spheres - plane intersections
white sphere - plane center
Maybe it can be calculated directly with worldToLocalMatrix?
UPDATE:
Okay It is so weird for me. After InverseTransform plane prints in console right normal but has wrong real angle.
There is code to reproduce
Place component to default cube in zero position, rotate it with Y != 0, scale ONE horizontal dimesion. You will see onesided plane.
using UnityEngine;

public class PlaceOnCube : MonoBehaviour
{
    public Vector3 PlaneOrigin = new Vector3(0, 0, 0);
    public Vector3 PlaneNormal = new Vector3(1, 0, 0);

    private void OnDrawGizmos()
    {
        Gizmos.DrawSphere(PlaneOrigin, .03f);

        var plane = new Plane(
               transform.InverseTransformDirection(PlaneNormal),
               transform.InverseTransformPoint(PlaneOrigin)
               );

        ReGeneratePlane(plane);
    }

    private void ReGeneratePlane(Plane plane)
    {
        var meshfilter = transform.GetComponent<MeshFilter>();
        var mesh = meshfilter.mesh;
        var tris = mesh.triangles;
        var verts = mesh.vertices;
        var newTris = new int[36 + 6];
        var newVerts = new Vector3[24 + 4];

        for (int j = 0; j < verts.Length; j++)
            newVerts[j] = verts[j];

        newVerts[24] = plane.ClosestPointOnPlane(new Vector3(-2, -1, 0));
        newVerts[25] = plane.ClosestPointOnPlane(new Vector3(2, -1, 0));
        newVerts[26] = plane.ClosestPointOnPlane(new Vector3(-2, 1, 0));
        newVerts[27] = plane.ClosestPointOnPlane(new Vector3(2, 1, 0));

        for (int j = 0; j < tris.Length; j++)
            newTris[j] = tris[j];

        newTris[36] = 24;
        newTris[37] = 26;
        newTris[38] = 25;
        newTris[39] = 26;
        newTris[40] = 27;
        newTris[41] = 25;

        mesh.vertices = newVerts;
        mesh.triangles = newTris;

        meshfilter.mesh = mesh;
    }
}

sentences: Box2D Lights - Simulate water I have a libGDX project, in which I have a Box2D world, which is currently filled with some boxes as a terrain. I also added a DirectionalLight to the scene for simulating the Sun. I almost have the effect I'd like to achieve, but is there any way to let the light shine through the water more deeply than it does on the surface?

sentences:
Allowing a unit to equip only certain types of weapons I'm making a FireEmblem style game, and I am working on items at the moment. I have a Weapon class from which Sword, Axe, etc. are derived. I also have character classes like Swordsman, Mage, etc. I would like to have a way to allow classes to only equip certain weapons (Swordsman can equip Sword but not Axe). One way I thought of was to have a global enum for WeaponType, and each weapon has a const weapon_type value. Then, each character class has a list of allowed WeaponTypes and you would check if a weapon's weapon_type is in the allowed list.

Is there a better way to implement this without using any casting?

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: 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:
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:
How do I change the speed of an object without changing path travelled? I have a ball which is being thrown from one side of a 2D space to the other. The formula I am using for calculating the ball's position at any one point in time is:

x = x0 + vx0*t
y = y0 + vy0*t - 0.5*g*t*t

where g is gravity, t is time, x0 is the initial x position, vx0 is the initial x velocity.

What I would like to do is change the speed of this ball, without changing how far it travels. Let's say the ball starts in the lower left corner, moves upwards and rightwards in an arc, and finishes in the lower right corner, and this takes 5s. What I would like to do is change it so the ball still follows the same curve and finishes in the same position, but takes 10s or 20s to do so.

How can I achieve this? All I can think of is manipulating t but I don't think that's a good idea. I'm sure it's something simple, but my maths are pretty shaky.

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 can I set the attribute index location? I am trying to set up a shader which takes three input parameters. I have the following code:

GLuint vert = glCreateShader(GL_VERTEX_SHADER);
GLuint frag = glCreateShader(GL_FRAGMENT_SHADER);
const GLchar* vertsrc = src.vertex.c_str();
const GLchar* fragsrc = src.fragment.c_str();
glShaderSource(vert, 1, &vertsrc, NULL);
glShaderSource(frag, 1, &fragsrc, NULL);
glCompileShader(vert);
glCompileShader(frag);
GLuint program = glCreateProgram();
glAttachShader(program, vert);
glAttachShader(program, frag);

glBindAttribLocation(program, 0, "position");
if (glGetError() != GL_NO_ERROR) ...
glBindAttribLocation(program, 1, "normal");
if (glGetError() != GL_NO_ERROR) ...
glBindAttribLocation(program, 2, "texcoord");
if (glGetError() != GL_NO_ERROR) ...

glLinkProgram(program);
//...check linking errors

auto p = glGetAttribLocation(program, "position");
auto n = glGetAttribLocation(program, "normal");
auto t = glGetAttribLocation(program, "texcoord");

GL_MAX_VERTEX_ATTRIBS is 16. I don't understand why, after this code executes, the values I get from glGetAttribLocation are as follows:

p = 0
n = -1
t = -1

Needless to say, I am unable to pass anything beyond vertex attrib array no. 0 to my shader. What am I doing wrong?

sentences:
Transform GameObject on Instantiate So, I'm having a bit of an issue with transforming a GO after instantiation in the way that I want.

I have a main GO.  On death, it spawns secondary GOs.  All GOs involved are kinematic (because the AI controller moves them).  So I use lerps to move the secondary GOs on instantiation in a sort of fountain pattern.  However, because of the static movement, they get pushed through walls and other surfaces.

I thought I'd try using physics for this with a ForceMode.Impulse push, but to do that I have to make it non-kinematic.  To do that, I also have to set it's mesh to be non-convex.  Making the mesh convex causes a ~1000ms delay on instantiation while the PhysX engine parses the mesh.

So...  what other options do I have?  Is there any other way to use the basic transform lerps and still have it not pass through walls?  I'm assuming that the direct transform is causing collision to not happen.  Or maybe because I'm disabling the CharacterController until it reaches it's end position (otherwise it tries to move right away using AI).

sentences:
How can I make a character smoothly traverse a list of waypoints? I want to set up paths for enemy characters in my game to patrol. I'd like to be able to define a list of waypoints and have the enemy follow the path from one point to another, but in a smooth curve.

How can I do this?

sentences:
Changing default folder structure of New Project in Unreal Engine? I wonder is there a config option to change the default folder structure of a new project.

So for example when I create a new project there is already a folder for 'Blueprints', 'Maps', 'Audio' and 'FBX' sitting in my Content folder.

The reason I ask is it's usually the first thing i do after i create a new project.

sentences:
Movement of an object based on thrust and gravity force in 2d scrolling game, need help I want to make a box "fly" so while user press D it's add thrust then on A it decrese untill 0, W and S control the direction of my box.

I have problems after I add the gravity to update correctly my X and Y position.
My actual code is like this: (I'm using gamemaker but it's same as other languages, came execute 60 frames per second)

frametime = delta_time / 1000000;
spd = sqrt(power(velx ,2)+power(vely ,2));
tempgy = g * frametime ;
//tempay = ((thrust / m) * 32) * frametime; // or my box procede diagonally offcurse
tempax = ((thrust / m) * 32) * frametime;
y -= (vely + tempgy/2   + tempay/2 ) * frametime ;
x += (velx + tempax/2  ) * frametime ;
vely += tempgy + tempay;
velx += tempax  ;

m is mass of object = 500

g = 9.81

32 it's pixel per meter

So, basically I calculate the acceleration on gravity, and need to apply acceleration to x and y based on direction if I not understand wrong. So for the X component of thrust I have to multiply sin(degtorad(dir)) and for the Y must multiply cos(degtorad(dir)), but I have to apply the sin and cos only on acceleration?

I think I am doing it wrong because if I use g=0 and just using thrust my box act not as intended (ex: If I try to do a loop and stop accelerating my box will not follow the loop direction but continue on straight line)

Sorry for the stupid question but I really not know how to fix it. I see lot of tutorials with vectors but it's not supported here so can't use them. Thank you and best regards.

sentences:
How can I reduce draw calls when using glBufferSubData and DYNAMIC_DRAW? At first I had the problem where I had about 150 rectangles rendered every tick. I only used STATIC_DRAW and glBufferData. I added support for DYNAMIC_DRAW and glBufferSubData and now I have a very good result... but the number of draw calls (glDrawArrays) is the same. Best practices from Mozilla Dev website said it should be reduced, but how?

Every rectangle has a method render() in which I do following (shortend):

_gl.bindBuffer(WebGL.ARRAY_BUFFER, vertexBuffer);
_gl.enableVertexAttribArray(a_position);
_gl.vertexAttribPointer(a_position, 2, WebGL.FLOAT, false, 0, 0);
_gl.bufferSubData(WebGL.ARRAY_BUFFER, 0, vertices);

_gl.bindBuffer(WebGL.ARRAY_BUFFER, texCoordBuffer);
_gl.enableVertexAttribArray(a_texCoordLocation);
_gl.vertexAttribPointer(a_texCoordLocation, 2, WebGL.FLOAT, false, 0, 0);
_gl.bufferSubData(WebGL.ARRAY_BUFFER, 0, texVertices);

_gl.uniform2fv(_utranslation, _translation);
_gl.uniform2fv(_urotation, _rotation);
_gl.uniform2f(_location, Dart2D.WIDTH, Dart2D.HEIGHT);

_gl.drawArrays(WebGL.TRIANGLES, 0, 6);

So every rectangle calls drawArrays in every frame...

sentences:
XNA Diffuse Shader Issue. Edge lighting problem. Image Attached As you can see in this image the diffuse shading is working correctly in some places but in other places such as the the bottom of the sphere you can see the squares/triangles of
the mesh.

Any idea what would be causing this? Let me know if you need anymore information related to
code. I can upload my normals calculations and shader effect if required.

EDIT:
Here's a link to the shader I'm using http://pastebin.com/gymVc7CP

Link to normals calculations: http://pastebin.com/KnMGdzHP

Seems to be an issue with edge lighting. Can't seem to see where I'm going wrong with the normals calculations though.

sentences:
Error rendering map android I'm trying to read this text file and render the corresponding tiles on the screen.

The code for reading the map is as follows:

private void loadMap(InputStream is) throws IOException {
    ArrayList<String> lines = new ArrayList<String>();
    int width = 0;
    int height = 0;

    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    while (true) {
        String line = reader.readLine();
        if (line == null) {
            reader.close();
            break;
        }

        if (!line.startsWith("!")) {
            lines.add(line);
            width = Math.max(width, line.length());
        }
    }
    height = lines.size();

    for (int j=0; j < 18; j++) {
        String line = (String) lines.get(j);
        for (int i=0; i < width; i++) {

            if (i < line.length()) {
                char ch = line.charAt(i);
                Tile t = new Tile(i, j, Character.getNumericValue(ch));
                tiles.add(t);
            }
        }
    }

}

The first problem I have is with Character.getNumericValue(ch) as this does not seem to be doing anything, resulting in a NullPointerException. When I remove it and replace it with either a 1 or a 2 I'm able to render the tiles onto the screen but somehow the spaces in between the digits are interpreted as tiles, resulting in a continuous block of tiles eg in the second line with 1s results in tiles beginning from the left margin up until the last 1. How can I fix this?

sentences:
How to fix a crowbar mesh deformation problem I am having a problem exporting my model to Garry's Mod.
Every time i compile the model in crowbar it comes out deformed like this

when the model is really suppose to look like this

how do I fix this is there something wrong with the collision?
I am also ready to provide whatever files/information are needed to solve this problem.
I should also mention that the mesh has multiple objects from each sphere that are joined but not connected.
I went to the arqade for this at first but they said it was offtopic and that I should come here instead.

sentences:
MonoGame/Xna gamepad inputs and joystick I've been around xna game development since very recently, and I'm actually developing a sort of Library for my games. But then I want to make an enemy with default Player settings for keys layouts and stuff. I've managed to create one for Qwerty and Azerty but I also want to create one for gamepad Controllers. Here comes the problem. The default XNA Input Framework is very limited (I think) because, from what I saw, it only manages few buttons that do not include Dpad or Joysticks.

So, is there a way to manage them in xna? or do I need an external Library?

Thanks for your help;

sentences:
Creating a Custom Map Editor using XNA and Windows Forms I'm looking to create my own level editor for a game I'm making, and I came across the following post:

Tutorial or Example of creating custom sprite tool/map editor for XNA?

In the example posted by Blau, I am unsure what needs to be replaced in this line, and with what:

XnaControlGame.CreateAndShow<MainDialog, VoxelEditorGame>( );

If anyone could help at all, that would be great!

sentences:
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:
My bullet changes the velocity depending on where I click I want to build a little 2D-Sidescrolling shooter and I'm now at the shooting script.

I already figured out how to shoot a bullet towards my mouse pointer. I got something like this :

Vector3 shootDirection;
        shootDirection = Input.mousePosition;
        shootDirection.z = 0.0f;
        shootDirection = Camera.main.ScreenToWorldPoint (shootDirection);
        shootDirection = shootDirection - transform.position;

        shootDirection.Normalize ();

        Rigidbody2D bulletInstance = Instantiate (rocket, transform.position, Quaternion.identity) as Rigidbody2D;
        bulletInstance.velocity = new Vector2 (shootDirection.x * speed, shootDirection.y * speed);

Now obviously the bullet goes faster if my Direction coordinates are big and slower if they are smaller. Have you some better code for me or how can I fix that issue?

I added now some loop like this, which brings a horrible performance, but kinda works out for the problem, but I'm still looking for a better solution.

while (((shootDirection.x * speed) + (shootDirection.y * speed)) < 20) {
            speed += 0.1f;
        }

So the loop makes sure that the overall speed is always almost the same, but this solution ends in an infinity loop if the values get too small.

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:
How to import animation from MotionBuilder to Unity? I have an animation (https://i.imgur.com/VZcdgHs.mp4) working in MotionBuilder.
I have tried exporting the whole thing as an FBX, and also have tried exporting as a Motion File.
Either way, when I import it into Unity and set up the Mecanim and Animation Controller and set the animation as the "Entry State" animation... My character moves to one pose and then stays frozen.
Does anyone know how to correctly get an animation from MotionBuilder to animate a character in Unity?

sentences:
Why are most windowed games not resizeable? I find it incredibly rare to find a game where the window can be resized, even if permitting it is a single click away in their game engine. For what reason is this done?

Thoughts that come to mind are...

Performance, is it possible that certain resolutions still perform better in windowed mode?
Easy switching to fullscreen, as fullscreen usually requires supported resolutions. However, I find even borderless fullscreen games still prevent resizing.
Management of aspect ratios? I don't think this would be a big issue to overcome however.

There's so many games that I want to be able to resize so I can fit them where I want on my screen, but alas, it's rare.

sentences:
Setting Texture to material slowly Have an idea to set the texture to 3D material slowly. It would be like some animation, that change previous texture to new sloowly from bottom to top.
I need it to my game... Can't find the solution...
Can you help me with this problem?

sentences:
How to compute matrix transform local/world on OpenGL I'm developing an OpenGL program where each object / entity contains m_WorldPosition, m_WorldOrientation, m_WorldScale and m_WorldTransform (Vector3, Quaternion, Vector3 and Matrix4f).

The problem is that these transformations are global. So I move, rotate and scale an object / entity I need to use a function that I did.

// C++
void HEntity::translate(const HVec3f& pos, const bool local)
{
    if(local) {
        m_WorldPosition += m_WorldOrientation.toMatrix3() * pos;
    } else {
        m_WorldPosition += pos;
    }

    m_NeedTransformUpdate = true;
}

I wanted to do the same as other software such as Blender or Unity3D 3D where each object / entity contains the variables position, localPosition, rotation, localRotation...

I want a similar system. Where I have the variables position, localPosition, orientation, localOrientation, scale, localScale. But I do not know how to apply it to matrix Each object / entity.

Below is the function to compute the matrix.

// C++
void HEntity::updateTransform()
{
    m_WorldTransform.identity();
    m_WorldTransform.setRotationAxis(m_WorldOrientation.getAngle(), m_WorldOrientation.getAxis());
    m_WorldTransform.scale(m_WorldScaling);
    m_WorldTransform.translate(m_WorldPosition);

    if(m_pParent) {
        m_WorldTransform =  m_pParent->m_WorldTransform * m_WorldTransform;
    }
}

And the game loop

// C++ - Game loop

HGameObject* object = NULL;
int index = 0;

for(; m_ObjectCount; index++)
{
    object = m_pObjectList[index];

    glMultMatrixf(object->m_WorldTransform.getTranspose());

    // Draw current object

    glPopMatrix();
}

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 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:
What's the most efficient way to find the intersection point of a missile and a bitmap terrain? Following up on my earlier question about finding the slope of a 2D bitmap terrain I now need to know the best way of finding the point on the 2D terrain that the missile hit. Obviously, I can see if any pixels under the missile intersect terrain, but say it has moved quite deep into the terrain.

What is the best way to step back to find where it initially collided? I could move back X pixels at a time towards the missile's previous position, but what would be a good value of X? And is there a smarter way? Maybe moving half the distance, then a quarter etc?

sentences:
Could use some help figuring out bouncy physics material in this PhotonEngine game So I'm trying to prototype a primitive 1v1 fighting game where the goal is to push the opponent off of the platform rather than actually fight. This is working great in a local multiplayer setup using a physics material on the "belly" of the Rigidbody2d players (the circle collider gameobject nested inside of the square gameobject has the bouncy material).

But I'm toying with the idea of making it a network game and it seems the physics material doesn't get communicated too well over the Photon Realtime connections?

Here is a video showing how it seems like sometimes the position is updated but sometimes a player runs into another player and its like a brick wall:

https://imgur.com/QYWH178

Any ideas of what to try or if this is even possible?

A bit about how things are currently setup:
Each player object has the nested collider with a high bounciness material on it. Each player moves via the Rigidbody2D component via

.AddForce(direction * Speed);

I have a Photon View component on the player prefab and a Photon Rigibody 2D View component that is checked to Synchronize Velocity and Angular Velocity, as well as a Photon Transform View component synchronizing Position. Both the transform view and Rigidbody2dView are Observed Components in the Photon View.

I also found a script someone posted where they were manually sending the position/velocity data via OnPhotonSerializeView() I've tried adding that script and making that observable as well, but no luck, but it looks something like this:

 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
        {
            if (stream.IsWriting)
            {
                //We own this player: send the others our data
                stream.SendNext(transform.position);
                stream.SendNext(transform.rotation);
                stream.SendNext(r.velocity);
                stream.SendNext(r.angularVelocity);
            }
            else
            {
                //Network player, receive data
                latestPos = (Vector3)stream.ReceiveNext();
                latestRot = (Quaternion)stream.ReceiveNext();
                velocity = (Vector2)stream.ReceiveNext();
                angularVelocity = (float)stream.ReceiveNext();

                valuesReceived = true;
            }
        }

        // Update is called once per frame
        void Update()
        {
            if (!photonView.IsMine && valuesReceived)
            {
                //Update Object position and Rigidbody parameters
                transform.position = Vector3.Lerp(transform.position, latestPos, Time.deltaTime * 5);
                transform.rotation = Quaternion.Lerp(transform.rotation, latestRot, Time.deltaTime * 5);
                r.velocity = velocity;
                r.angularVelocity = angularVelocity;
            }
        }

sentences:
Should I use dependency injection in Unity? As learned about dependency injection on the internet, I found that it's something that can be done simply by the Singleton Pattern.

But there are 2 completely different views on this issue:

Some people say it just adds complications to project
Others say it is a great tool to decouple classes and code

In particular there is Zenject that is made specifically for doing dependency injection in Unity.

With this in mind, should I use dependency injection in my Unity game?

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:
Is 3d game development advantageous/possible in SDL2? I think this is not appropriate, but as the given video in the link, the youtuber name Bisqwit creates his own 3d engine from scratch in C and SDL2. How much is this advantageous is real 3d game development and following his idea can a first practice project? (rather than just starting with OpenGL)?

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

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:
how to make AI do jump on navigation mesh system? hi :D i'm currently using unreal for make a sand-box game for learning purpose.

and due to the unique attribute of sand-box game, i am looking for how AI move naturally on map (which changes so often).

i find a way to place Nav-links on map dynamically and working on that way. but i think if i can make AI do Jump or fall off,climb low height wall like thing, it would be more performance-friendly than placing bunch of Nav-links.

so i searched about that, and i find 'how to get navigation-mesh in unreal', 'how to override path following' kind of stuff. but i really can't find and don't get about 'How to make AI decide to jump when it need'

i put an image for detailed question. Stick man is the AI and while the flag on right top is the goal( target move location ), there is also 2 obstacles(A and B) for reach the goal.

so here is my question :

while the navigation mesh isn't linked between the platform and above the obstacle A. How path-finder knows it can use 'A' when it can do Jump?
i think obstacle B is more difficult situation. unlike situation A, 'navigation mesh B'has the same or inner positions of 'navigation mesh platform'. while the only noticeable difference is height, how AI or path-finder know it is valid path and needs do jump?
quite same question about B i think. i forgot to draw on image though. so, if AI figure out the path and try to do jump for reach to goal but there is some obstacle just placed which block the jump. how it know and fix the path?

i know it is very difficult question, and very hard to explain. especially the question 2 and 3. so i understand even only answer for question 1. and even so, i feel so appreciate about it.

since English is not my first language, please excuse my poor English skill. and hope you don't bother about it :).

thanks for reading, and hope you have a wonderful day and stay happy :)

sentences:
How to choose a SKSpriteNode randomly? I want to choose from 4 enemies using random and present it on scene. For that purpose I've made this:

func enemyPicker() -> SKSpriteNode {
var enemyArray = [mouse, robot, drone, block, bird]
var countArray = UInt32(enemyArray.count)
var pickOneEneny = arc4random_uniform(countArray)
var randomElement = Int(pickOneEnemy)

return enemyArray.randomElement
}

But Xcode says to me that SKSpriteNode does not have a member named randomElement. And it surely doesn't, but how would I say to my function that I need it to pick and assign that random Int to an actual enemy from array?

My SpriteNodes are declared like this. Example:

var mouse = SKSpriteNode()
let mouseAtlas = SKTextureAtlas(named: "mouse")
var mouseArray = [SKTexture]()
mouseArray.append(mouseAtlas.textureNamed("mouse_0"));
mouseArray.append(mouseAtlas.textureNamed("mouse_1"));
mouseArray.append(mouseAtlas.textureNamed("mouse_2"));

mouse = SKSpriteNode(texture: mouseArray[0]);
self.mouse.position = CGPointMake(CGRectGetMaxX(self.frame), CGRectGetMidY(self.frame) - 138)
self.mouse.size = CGSizeMake(self.mouse.size.width, self.mouse.size.height + mouse.size.height / 2)

self.mouse.name = "mouse"
self.addChild(mouse)

I also tried to change -> SKSpriteNode to SKTexture, String and "< T >" and had not any luck with it.

sentences:
How to send multiple MVP matrices to a vertex shader in OpenGL ES 2.0 I'm working my way through optimizing the rendering of sprites in a 2D game using OpenGL ES and I've hit the limit of my knowledge when it comes to GLSL and vertex shaders.

I have two large float buffers containing my vertex coordinates and texture coordinates (eventually this will be one buffer) for multiple sprites in order to perform a single glDrawArrays call.  This works but I've hit a snag when it comes to passing the transformation matrix into the vertex shader.

My shader code is:

uniform mat4 u_MVPMatrix;
attribute vec4 a_Position;
attribute vec2 a_TexCoordinate;
varying vec2 v_TexCoordinate;

void main()
{
    v_TexCoordinate = a_TexCoordinate;
    gl_Position = u_MVPMatrix * a_Position;
}

In Java (Android) I am using a FloatBuffer to store the vertex/texture data and this is provided to the shader like so:

mGlEs20.glVertexAttribPointer(mVertexHandle, Globals.GL_POSITION_VERTEX_COUNT, GLES20.GL_FLOAT, false, 0, mVertexCoordinates);
mGlEs20.glVertexAttribPointer(mTextureCoordinateHandle, Globals.GL_TEXTURE_VERTEX_COUNT, GLES20.GL_FLOAT, false, 0, mTextureCoordinates);

(The Globals.GL_POSITION_VERTEX_COUNT etc are just integers with the value of 2 right now)

And I'm passing the MVP (Model/View/Projection) matrix buffer like this:

GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mModelCoordinates);

(mModelCoordinates is a FloatBuffer containing 16-float sequences representing the MVP matrix for each sprite)

This renders my scene but all the sprites share the same transformation, so it's obviously only picking the first 16 elements from the buffer which makes sense since I am passing in "1" as the second parameter.  The documentation for this method says:

  "This should be 1 if the targeted uniform variable is not an array of matrices, and 1 or more if it is an array of matrices."

So I tried modifying the shader with a fixed size array large enough to accomodate most of my scenarios:

uniform mat4 u_MVPMatrix[1000];

But this lead to an error in the shader:

  cannot convert from 'uniform array of 4X4 matrix of float' to 'Position 4-component vector of float'

This just seems wrong anyway as it's not clear to me how the shader would know when to transition to the next matrix anyway.

Anyone have an idea how I can get my shader to pick up a different MVP matrix (i.e. the NEXT 16 floats) from my MVP buffer for every 4 vertices it encounters?  (I am using GL_TRIANGLE_STRIP so each sprite has 4 vertices).

Thanks!

sentences: Linux Game Development Resources Do you have any Linux-specific game development resources?

sentences:
pathfinding with obstacles in a Warcraft 3 like game Consider A* searching on a tile based map. A straight forward code would be: If there is an unit inside that cell, then it is unreachable, this is ok.

But there is map resolution issue. When I look into Warcraft 3, there monsters and structures does have different radius, and you can walk very close, which is more like vector based, how this was implemented?

Also, what is the standard solution to incorporate moving obstacles collision detection with path finding algorithm, like Warcraft 3?

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:
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:
As a indie, how to protect your game? As a indie, you might not work in a company. And you may have a great game idea and you feel it gonna be a big success. When you released your game. How do you protect it as your own creation? So that someone also can't steal the title and publish a "sequel" e.g. Your-Game-Name 2,3,4. Or even produce by-products like Angry Birds but without your permission.

So how we can prevent these from happening by legal methods. Like copyrights, trademarks? If a professional can fill us those info, it will be great.

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 can I create a mirror with Unity? Can anyone explain how I can create a mirror effect like the one in this YouTube video using Unity Pro?

I know that I need to use render textures to do it, but I am not sure how.

sentences:
Unity: OnCollisionEnter not called I created a sphere object, added a rigidbody component (no kinematics) and attached a script to it like this:

function Update () {
}

function OnCollisionEnter(collision : Collision) {
    Debug.Log("OnCollisionEnter");
}

I then created a cube under the ball, added a box collider component with no trigger of course.

Then, when I run the game, the ball falls down onto the cube, but nothing happens. The OnCollisionEnter function isn't called.

What should I do?

sentences:
Libgdx: setting windows's icon When I export my game as runnable .jar file with custom window's icon - it doesn't run. It runs only in debug mode and when I try to launch .jar with the console it says that it cannot load icon file.

Picture of my problem:

sentences:
Spawn network objects in generated map In my game, the server generates a procedural map, after send generation seed to generate it on the client. The client generates exactly the same map. In the map, I need to synchronize objects with NetworkIdentity. Therefore, after the map is generated on clients, the server will spawn all map's objects with NetworkIdentity on the client using NetworkServer.Spawn on server. In theory, it sounds normal, but in practice, objects on the server that have a NetworkIdentity component can not be obtained with GetChild from the object of the generated map. Unity do not see them. This probably means that they are not active on the server. How to fix it? And if it will fix, will the objects with NetworkIdentity be spawned on the client as children of the map? If this is not possible, is it possible to use something other than the UNET?

That's what I did:

On start server:

public static short index = 0;
public const int getGenIndex = 99; // OnGetGen
public const int spawnGenIndex = 100; // OnSpawnGeneration
public const int spawnObjIndex = 101; // OnSpawnNetworkObjects

private void Start() {
    if (isServer)
        NetworkServer.SpawnObjects();
    if (isServer) {
        GenerationInfo generation = InitScane.instance.GetGeneration(InitScane.rnd.Next()); // generate map
        InitScane.instance.seedToSpawn = InitScane.rnd.Next();
        GenerationManager.SpawnGeneration(RoomLoader.loadedRooms, generation, InitScane.instance.seedToSpawn, true); // spawn map on server with objects
        NetworkServer.SendToAll(spawnGenIndex,new StringMessage(GenerationManager.currentGeneration.Seed + "," + InitScane.instance.seedToSpawn)); // send message for spawn on client
    }
    else
        NetworkManager.singleton.client.Send(getGenIndex, new EmptyMessage()); // the client requests the seed to generate the map
}

public void OnGetGen(NetworkMessage msg){
    msg.conn.Send(spawnGenIndex,new StringMessage(GenerationManager.currentGeneration.Seed + "," + InitScane.instance.seedToSpawn));
}

public void OnSpawnGeneration(NetworkMessage msg) {
    string[] data = msg.ReadMessage<StringMessage>().value.Split(',');
    GenerationInfo generation = InitScane.instance.GetGeneration(int.Parse(data[0])); // generate map
    GenerationManager.SpawnGeneration(RoomLoader.loadedRooms, generation, int.Parse(data[1]), false); // spawn map without objects with NetworkIdentity
    msg.conn.Send(spawnObjIndex, new EmptyMessage()); // send request for spawn objects with NetworkIdentity and spawn player
}

public void OnSpawnNetworkObjects(NetworkMessage msg) {
    GenerationManager.SendAllObjectsToClients();
    GameObject player = Instantiate(InitScane.instance.LocalPlayer);
    GenerationManager.TeleportPlayerToStart(player);
    NetworkServer.AddPlayerForConnection(msg.conn, player, index);
    index++;
}

All network message I register in Awake on client and server. This is how I spawn objects for clients:

public static GenerationInfo currentGeneration;
    private static GameObject[,] spawnedRooms; // the map consists of many rooms that are separate GameObjects

    public static void SendAllObjectsToClients() {
        for(int x = 0; x < currentGeneration.size.x; x++)
            for(int y = 0; y < currentGeneration.size.y; y++)
                SendObjects(spawnedRooms[x, y]);
    }

    public static void SendObjects(GameObject roomObject) {
        Transform objectParent = roomObject.transform.Find("Objects"); // all room objects are stored in the parent "Objects"
        for (int i = 0; i < objectParent.childCount; i++)
            if (objectParent.GetChild(i).GetComponent<NetworkIdentity>() != null)
                NetworkServer.Spawn(objectParent.GetChild(i).gameObject);
    }

The latter method does not find objects with NetworkIdentity, although they are spawned in the editor. If you put them to the array when spawning, they will turn into null

sentences:
Converting Mouse Coords to 3d coords with Camera position So I've looked at all the answers I can possibly find, and nothing seems to fit what I need exactly (because im bad at math).

I'll explain what I have thus far:

A camera with x,y,z, Pitch and Yaw float variables.

Scene is rendered like so:

glTranslatef(0.0, 0.0, -(player->cam->getCamY())); // Distance from the ground
glRotatef(player->cam->getPitch(), 1.0, 0.0, 0.0);
glRotatef(-(player->cam->getYaw()), 0.0, 1.0, 0.0);
glTranslatef(-(player->cam->getCamX()), 0.0, -(player->cam->getCamZ()));

(Pitch looks up and down, Yaw looks left and right - the getCam's just return value of x, y or z of the camera)

A ray function already implemented - It shoots a ray straight out of the camera into whatever direction the camera is facing, and intersects with whatever tile is in the center of the screen.
and this function that I copied from the internet:

vector3d GetMousePos3D(int x, int y)
{
GLint viewport[4];
GLdouble modelview[16];
GLdouble projection[16];

GLfloat winX, winY, winZ;
GLdouble posX, posY, posZ;

glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
glGetDoublev( GL_PROJECTION_MATRIX, projection );
glGetIntegerv( GL_VIEWPORT, viewport );

winX = (float)x;
winY = (float)viewport[3] - (float)y;
glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ );

gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);

return vector3d(posX, posY, posZ);

which, as you can probably tell, does not return the desired results because it doesn't interact with the camera. I have no idea how to do this.

Basically, if I can work out the mouse coordinates relative to the camera coordinates, then everything should work fine.

If you need any other information, just ask. This problem is causing me a lot of distress, and the math feels beyond me.

sentences:
Easy way to project point onto triangle (or plane) I have a mesh of triangles (navigation mesh), and a point in 3d space. This point should be "over" one of the triangles all the times. I'm trying to determine which triangle is the one the point is "over", but I can't quite figure it out.

I have found a way to tell if the point is in the triangle using one of the techniques described here, but I can't quite figure out how to project the point on the triangle (or the plane the triangle is in, for that matter). I've been looking online but I can't find anything helpful.

Does anyone know how to project a point onto a triangle (or plane)?

Also, if someone knows of a better way to test which triangle is the one the point is over, it would be appreciated.

sentences:
Draw calls in Unity 3d I have only 20 materials in my game (19 are made with textures atlas). But the Setpass call is 72. I don't understand why. I want to know how to decrease the number of SetPass call.
This is a brief summary about the game:
Houses vertex attributes : from 43 to 270. They are low poly houses. Props too.  No normal maps. Only diffuse and ambient occlusion maps. Only the Playable character has his own texture. There 45 houses models. I have 19 textures atlas.  In the game, some houses are assembled to formed another house (modular houses). And I assembled 10 to 18 houses to form a BLOC (a piece of town). For all the gameObects, SHADER is Universal Render Pipeline. I didn't edit anything, I use the default properties. In the game, Bloc of houses are put together 3 by 3 and randomly to form town like (SUBWAY SURFER)
In Unity playmode : Tris : 54.9k  Verts: 80k Batches : 466 Saved by batching : 0 Shadow caster: 0 Visible Skinned meshes: 1

sentences:
C# XNA4 2D Collision Detection I am working on a 2D engine in Xna and am running in a bit of trouble with Collision implementation.
What I want to do is have an interface ICollidable that I can add to GameObjects that are collidable.
I am trying to get it to work by using this awnser: https://gamedev.stackexchange.com/a/40432/33751

My question is how do I add the objects that use ICollidable to the List in the CollisionManager dynamically?

By case would be that the manager 'sees' what objects use the ICollidable interface and automatically add it to the list.

Second question is, how can I get the properties and stuff from the objects that contain the interface to actually preform the collision detection in CollisionManager? would a simple cast suffice?

ICollidable:

interface ICollidable
{
    void onCollision(ICollidable other);
}

CollisionManager:

class CollisionManager : GameObject
{

    private List<ICollidable> collidables = new List<ICollidable>();

    public CollisionManager(Game game)
        : base(game)
    {
        game.Components.Add(this);
    }

    void addCollidable(ICollidable obj){
        // This function needs to be called when ICollidable is inherited dynamically
        collidables.Add(obj);
    }

    public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
    {
        base.Update(gameTime);

        for (int i = 0; i < collidables.Count; i++)
        {
            for (int a = i + 1; a < collidables.Count; i++)
            {
                if(collision(collidables[i], collidables[a])){
                    collidables[i].onCollision(collidables[a]);
                }
            }
        }

    }

    private bool collision(ICollidable obj)
    {
        // How can i get obj's properties etc for checking collision.

        return false;
    }
}

PS. Never worked with interfaces in c# before, if I am doing it completely wrong, please let me know

Thanks in advance.
Yme-Jan

sentences:
Solution for Shipping Optimized and Minified GLSL? I've tried to find a reputable optimizing compiler for GLSL that takes source shaders, performs what optimizations it can statically assume, and outputs a minified GLSL file with optimizations, stripped local variable names, and unnecessary content like comments/extra whitespace.

The goal is to transpile GLSL into a portable, obfuscated source file that has been optimized enough so that local device compilers can optimize the shaders at game startup while still maintaining simple and readable GLSL for development.

I'm searching for a solution in my development pipeline in lieu of HLSL's precompiled intermediate representation or Vulkan's SPIR-V intermediate representation. Am I wrong in my assumptions about shipping shaders for OpenGL, is there a best practice for optimizing and shipping shaders with a release build?

sentences:
How to create custom inspector to display generic Stack class I have a member that I would like to expose:

[Serializable]
private sealed class InputGameObjectStack: Stack<GameObject> {
    public InputGameObjectStack(): base(_InputGameObjectStackSize) {
    }
}

Inside the MonoBehaviour, I have:

[SerializeField]
private InputGameObjectStack _inputGameObjectStack;

Inside the editor script, I'm able to fetch the property from the MonoBehaviour object (as SerializedProperty), but there is nothing usable that allows me to traverse through the elements.

Is there any way of showing the constents of the stack in the inspector as immutable (no functionality to push/pop)?

sentences:
DirectXTK: SpriteBatch::Begin and Draw methods give LNK2019: unresolved external Right now, im using DirectXTK (version 2020.2.24.4) and Visual Studio 2019.

My declarations look like this:

    std::unique_ptr<SpriteFont> m_font;
    std::unique_ptr<SpriteBatch> m_spriteBatch;

and my code look like this:

    m_font = std::make_unique<SpriteFont>(m_device.Get(), L"myfile.spritefont");
    m_spriteBatch = std::make_unique<SpriteBatch>(m_deviceContext.Get());

    m_fontPos.x = 1080 / 2.f;
    m_fontPos.y = 720 / 2.f;

    const wchar_t* output = L"Hello World";
    DirectX::SimpleMath::Vector2 origin = m_font->MeasureString(output) / 2.f;

    m_spriteBatch.get()->Begin();
    m_font.get()->DrawString(m_spriteBatch.get(), output, m_fontPos);
    m_spriteBatch.get()->End();

The functions SpriteBatch::Begin(), SpriteBatch::Draw() and SpriteFont::MeasureString() give me a LNK2019 error.

I found this thread DirectXTK: Only SpriteBatch::Begin and Draw methods give LNK2019: unresolved external. But the answer didnt solve my errors

Thanks in advance!

sentences:
What is a good linear algebra book for game programmers? I was told that I should start learning Linear Algebra in order to create good games with good physics.

I'm reading Linear Algebra book and it's completely foreign to me. The author starts out with solving linear equations (two equations, two variables) and I remember learning about that in school, but almost immediately he jumps into other things that seem to be taken directly from the Necronomicon.

What book can I read to learn some good math, but starting from the fundamentals?

Thanks a lot for the help.

sentences:
How to test if a level is passable? I am making an classic 2D arcade ball game. There will be 100 levels in this game. And after the 80th level passing the level by doing some arcade stuff will be very difficult.

For example level 100 will be the most difficult level and if I can't pass this level with manual testing (I am not very skillful), how can I know without manual testing if the 100th level can be passed?

(I don't want to make an impossible level. I just want to make a very difficult level.)

sentences:
(Three.js) - What object3D properties are required to make rayCaster.intersectObjects() work? FYI, i am trying to do something almost identical to the following:
Merging geometry/mesh without losing benefits

I essentially have a list of Three.object3D's. These objects are "merged" together into a single BufferGeometry (so that i can draw thousands of these objects with a single draw call).

After merging these objects I still do have references to all of the original objects (via a class which simply "has a" object3D object reference).

* Question *

I am calling raycaster.intersectObjects(myObjects) on this list of original Object3D's. Im wondering what properties are required for this intersectObjects method to work? In other words, the ray caster must be checking against each objects position and geometry. What properties (position, geometry?) are required and where do these properties exist (within the Object3D reference)?

Whew. I hope this all makes sense.

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:
Minecraft Modding Errors (.java to .class compression errors) Recently I started making a personal modpack. I ran into a block ID conflict and decided to fix it. I figured out how, and managed to change a .class file to .java so I was able to edit it. Now comes the issue.

When I try converting my files from .java to .class using the command prompt javac command, I get the following errors:

E:\Users\Jeff\Desktop\bettertools_164.s... error: '.' expected /* 3: */ import akc;

E:\Users\Jeff\Desktop\bettertools_164.s... error: ';' expected /* 3: */ import akc;

E:\Users\Jeff\Desktop\bettertools_164.s... error: class, interface, or enum expected /* 4: */ import aqz;

E:\Users\Jeff\Desktop\bettertools_164.s... error: '.' expected /* 5: */ import ard;

E\Users\Jeff\Desktop\bettertools_164.sr... error ';' expected /* 5: */ import ard;

E:\Users\Jeff\Desktop\bettertools_164\b... error: class, interface, or enum expected /* 6: */ import cpw.mods.fml.common.registry.GameRegistr...

I'm not sure if that is enough information to solve my problem, but thanks in advance to anyone able to answer it!

sentences:
About HLSL array packing policy This is not a question but a confirmation if I'm correct about the behavior of HLSL arrays.

I'm working with a standard lighting vertex shader, HLSL plus C++, DirectX11.1 API. For storing my lights data I've setup a simple declaration, padded accordingly to match the packing requeriments of constant buffers:

  // C++ side
struct LightBase {
            DirectX::XMFLOAT3   pos, color;
            DirectX::XMFLOAT3   color;
            float               intensity;
            float               isOn;
    };
    struct CBUFFER_LIGHT {
        LightBase   light[MAX_LIGHTS];
        float       numActiveLights;
        float       _padding[3];
    };

The shader declares a "matching" cbuffer as:

// HLSL vertex shader
    struct LightBase {
        float3 pos;
        float3 color;
        float  intensity;
        float  isOn;
    };
    cbuffer lights : register (b3) {
        LightBase light[MAX_LIGHTS];
        float numActiveLights;
    }

Now, as I expected, it didnt work due to the HLSL memory organization policy regarding arrays. e.g; if I set the buffer from C++ with the following data:

I get the following data when accessing struct members of light[0] from shader:

See how light[0].color and other struct members  got messed up?  Seems that HLSL will organize your arrays in Vector4 elements regardless of the real type of the array element.

So the array data passed from C++ which is { -7, -1, -100, 0.44, 0.66, 0.88, 1.0, 1.0 } will be organized by HLSL as follows:

A[0] = { -7, -1, -100, 0.44 }
A[1] = { 0.66, 0.88, 1.0, 1.0 }
A[2] = { ...}

So A[0] contains .xyz for position and .x for color struct member. A[1] contains .gb for color member, intensity and isOn data.

But calling light[0].color from the shader will still try to address &light + sizeof(float3)+sizeof(float3) as defined in the cbuffer, but you will get incorrect results due to array organization policy of HLSL.

If HLSL and DirectX are so fond of FLOAT4 values, it's not better to use all float4 variables and access members (.xyzw)  as needed?
Thanks.

sentences:
How can I deploy a JavaScript game into the iOS app store? Unfortunately, I don't have a Mac, so I can't develop for iOS.

I understand that HTML5 apps run in the browser, but is there a way to make an HTML5 app (e.g. a JavaScript game) and get it deployed onto the app store through Apple? How should I package and submit it?

sentences:
Cost of Unity Local Multiplayer VS Unity Online Multiplayer I know that making multiplayer games in Unity costs money because of the servers that are used in connecting the players. So basically its free upto 20 CCU and then it increases as per the CCU. Its true for the online multiplayer games.

But for local multiplayer games(LAN), should it cost the money for using it? Because we converted one of the devices in the local as the server and we don't need their servers. So am I thinking right ?? Or I am going wrong somewhere?

Just wanted to be clear about how to make a local multiplayer and not an online multiplayer.

Also wanted to ask if Photon supports local multiplayer?

Basically I am confused about how to make offline local multiplayer game.

sentences: Simple way to post score from my game to Facebook and Twitter? What's the best and simple way to post score from my game to Facebook and Twitter with store link in cocos2d-x?

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:
Ipad - actionsheet not showing all buttons in landscape mode when keyboard is present I am developing an Ipad application. It supports both landscape and portrait mode. The app has keyboard.It also shows an action sheet with 4 buttons when required. In portrait mode it works perfectly. But in landscape mode action sheet only show 2 buttons when keyboard is there .Without keyboard it show all 4 buttons.
Any solution?

sentences:
Is there a way to convert a shader code to shader graph? I would like to ask if there is a way to convert a Coded shader into the new Shader graph, beacause i want to edit my shaders in more efficient way.

Any help is appreciated.

sentences:
Model texturing not seamless at certain zooms? (C# XNA) I found a very odd glitch with my game this morning. XNA doesn't render certain textured models properly, while other models are completely unaffected. And it's not even like my models are made incorrectly - even one of my spheres doesn't render properly at certain zoom levels. Agh, it's hard to explain, here's a picture:

The arrow on the left is in blender. The right two pictures are from within my game. At first, I thought that this was some sort of bleeding / collision issue of the arrow and the space-y background. But when I removed the background, the issue was still there.

So what are all those weird pink dots and seams? This is what my texture looks like:

Oddly enough, all of the other models in my game render correctly, except for the space sphere you see behind the arrow. (It only looks incorrect at other zoom levels, although no pink dots, just more black seams)

So I tried to find a similarity between the two malfunctioning objects, the arrow and the sphere. It occurred to me that they were the only objects whose textures did not cover the entire model, but instead were tiled. So like the UV unwrapping was not totally contained in the texture... here's a picture of what the UV looks like in blender:

Based off of this, I concluded that somehow XNA is not tiling the texture properly when it maps it to the objects. Since blender renders the model correctly and XNA doesn't, I'm assuming the problem is with XNA. (although correct me if I'm wrong)

So finally, my question is: I'm totally lost - does anybody know how to fix this?

Thanks!

EDIT: As requested in comments, here is my drawing code. It's nothing special, just your basic model draw code.

class OrderedDrawModel
{
    Model M;
    Matrix Transform;
    float Transparency;
    Vector3 Ambience;
    public float Distance;
    float Reflect;
    public OrderedDrawModel(Model M, float Transparency, Vector3 Ambience, Matrix Transform, float Distance, float Reflectivity)
    {
        this.M = M;
        this.Transparency = Transparency;
        this.Ambience = Ambience;
        this.Distance = Distance;
        this.Transform = Transform;
        Reflect = Reflectivity;
    }
    public void Draw(GraphicsDeviceManager graphics, Camera_Edit C)
    {
        Matrix[] T = new Matrix[M.Bones.Count];
        M.CopyAbsoluteBoneTransformsTo(T);
        foreach (ModelMesh mesh in M.Meshes)
        {
            foreach (BasicEffect basicEffect in mesh.Effects)
            {
                basicEffect.World = T[mesh.ParentBone.Index] * Transform;
                basicEffect.View = C.view;
                basicEffect.Projection = C.projection;
                basicEffect.LightingEnabled = true;

                basicEffect.AmbientLightColor = Ambience;
                basicEffect.DirectionalLight0.DiffuseColor = Color.White.ToVector3();
                basicEffect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(-3, -3, 1));
                basicEffect.DirectionalLight0.SpecularColor = new Vector3(Reflect, Reflect, Reflect);

                graphics.GraphicsDevice.BlendState = BlendState.AlphaBlend;
                basicEffect.Alpha = Transparency;
            }
            mesh.Draw();
        }
    }
}

I create the object with this line:

DrawModel(Arrow, 1.0f, Matrix.CreateScale(5f), new Vector3(0, 0, 0), 0.4f);
        //Model  alpha transform_matrix        ambience            specular

Which adds it to a list of back-to-front ordered models that get drawn by calling their draw method.

sentences:
How can I achieve area fill in the video? I am trying to clone a game while learning Unity but I am stuck. How can I achieve area fill like shown in this Area Fill Example Video?
When I searched for it I found the "Flood Fill" algorithm but I am also not sure is it the right solution for this or not. Because in flood fill we have to select a point and check neighbors with same value and convert them, however here how can I decide which point to select and fill?
For example at 00:03 in video I close an area and game fills the area with cubes. With flood fill, if I select a starting point above that line, algorithm can travel through all outer tiles and very well can fill them with cubes also but game fills lesser area there. Why does the game pick a smaller area here? How do they decide which portion of the game field they should fill?
And in 00.11 when cube hit white wall they completely fill the remaining area because I guess they assume it is fully closed. But again my question is how can you decide that? Which methods provide area fills like this?
If someone has an idea or experience about this can points me to the right direction I'd really appreciate. Thanks in advance.

sentences:
GameMaker project works fine when targeting Windows but not when targeting HTML5 As mentionned in the title, my GameMaker project works fine when targeting Windows.

However, when I build it for HTML5, I got those errors in the Chrome developer console:

Destructive Dark.js?VYNZB=1666826811:7 Uncaught TypeError: Cannot read property '_42' of undefined
    at _Qw1._M [as _L] (Destructive Dark.js?VYNZB=1666826811:7)
    at _Qw1._a4 (Destructive Dark.js?VYNZB=1666826811:1490)
    at _a72._a4 (Destructive Dark.js?VYNZB=1666826811:1380)
    at _lK1 (Destructive Dark.js?VYNZB=1666826811:1155)
    at _9v2 (Destructive Dark.js?VYNZB=1666826811:1742)
    at _Mu2 (Destructive Dark.js?VYNZB=1666826811:1748)
    at _Ju2 (Destructive Dark.js?VYNZB=1666826811:1733)

I suppose this error is not really useful since it seems to come from the obfuscated Javascript... However, I noticed that this error appears on the "Left mouse button released" event on one of my object. The code associated with this event is the following:

/// Select the square or switch its place with the current selected square

game_manager = instance_find(obj_game_manager, 1);

if (game_manager.lock_timer == 0) {
    if (game_manager.selected_square == noone) {
        game_manager.selected_square = self;
        inst = instance_create(x, y, obj_selection);
        inst.depth = -100;
        inst.image_alpha = 0.6;
    }
    else if (game_manager.selected_square == self) {
        game_manager.selected_square = noone;

        with (obj_selection) {
            instance_destroy();
        }
    }
    else {
        // Lock interactions
        game_manager.lock_timer = 2;

        // Switch the array cells
        var x_temp = game_manager.selected_square.x_grid;
        var y_temp = game_manager.selected_square.y_grid;
        var color_temp = game_manager.selected_square.color;

        game_manager.grid_array[x_temp, y_temp] = color;
        game_manager.grid_array[x_grid, y_grid] = color_temp;

        game_manager.selected_square = noone;

        with (obj_selection) {
            instance_destroy();
        }

        with (game_manager) {
            event_perform(ev_alarm, 0);
        }
    }
}

Not much info sorry, but I have no ideas where this error came from.

sentences: lwjgl request display close when undecorated I want to create a custom titlebar/border for my display/window so I set the corresponding system property to "true" but how do I send a close request to the window manually to react to the Display.isCloseRequested()?

sentences:
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:
Sequencing / triggering messages based on conditions in an adventure game I've been struggling conceptualizing the best way to make a level flow with dialog and help hints changing as you play etc.

Imagine your goal is to make this one screen 'adventure' game, where you leave your house for work, but along the way, you realize you cannot find your keys to leave the house (and drive to work), also the door handle has fallen out of your door again!

Here is the structure of the story as I see it and how I'd break it down for a game. But what data types would you use, and how would you send messages to the dialog classes telling them to display the lines of text in the correct timing and order?

items:
metal bar - floor
door handle - floor
keys - down sofa

bools:
hasFoundKeys
hasFoundDoorHandle
hasFoundBar

dialog flow:
1. "Well I better get to work now."
2. "Oh damn, I can't find my keys." [when trying door]
3. "Ooh whats this" [said when keys found / other items found]
4. "Oh great, the door handle fell out again" [when trying door, but now have keys]
5. "You need that little metal bar thing before the handle works" [trying door before using metal bar on door]
6. "I cant turn that with my bare hands" [trying door without handle but with metal bar in door]

The text at the bottom would be the exact string I'd want to pop up, the timing for each one is described in the [] brackets.

sentences:
Unity Animator not properly following animation transitions I have an Animator that has 3 different states. Walking, Climbing, and End of Climb.
The diagram is shown below:

I have 2 bools, isClimbing and isWalking. When isClimbing is set to false it transitions to End of Climb. Then when I set isWalking to true, it transitions to Walking. However, when I do this, for some reason the animator starts back at Climbing then moves to End of Climb then moves to Walking.
It seems everytime I change a parameter, it completely  restarts the state machine back to the default Climbing state and then moves forward.
I do not have code, and have been triggering this through the UI.
What am I doing wrong?

sentences:
Cube map or 2D texture map I'm trying to map quadsphere with COBE spherical cube (CSC) projection in OpenGL (wanna map planets). I managed to create a 2D texture and it works well except seams at edges.

Then I learned that there is a cubemap in OpenGL. It has some advantages: It automatically generates seamless mipmap and it requires less memory (I was using 4*size width 3*size height texture where a half is just wasted like this: https://camo.githubusercontent.com/b017f71b03e6180dc75ff34f017d45f32e9db817/68747470733a2f2f7261772e6769746875622e636f6d2f6369782f517561645370686572652f6d61737465722f6578616d706c65732f677269642e706e67)

The problem with using cubemap is that CSC is not gnomonic projection. So I can't just use vertex point as 3D texture coordinates. I have to calculate 3D texture coordinates from uv coordinates and the face. Then OpenGL recalculate it to uv coordinate and the face. I guess that slows down the rendering compared to simple 2D texture.

The problem with using 2D texture is that it is not easy to make texture seamless. And it takes more memory if I use one image file for whole texture. I think I could pre-generate mipmaps sampling adjacent faces and add 1px padding and modify uv coordinates slightly (like this? https://gamedev.stackexchange.com/a/49585/74052). But it sounds complicated and I have to pre-generate all mipmaps, and textures might no be in size of power of 2 and I might have another problem with that.

I have no idea which way to go.

When using cubemap, is there a way to specify uv coordinates and face directly, and not specify 3D texture coordinates (direction)?
Is there a way to set 2D texture wrap mode to something like CLAMP_TO_EDGE_OF_OTHER_TEXTURE to make it seamless at edges?
Is there other way to make a 2D cube texture seamless?
Any other suggestion to deal with this problem?

Thanks in advance!

sentences: Control Entity Moving Speed Without Using a Delay Function In a Tetris game I'm trying to make (using C++/SDL), I need to control the falling speed of, say, one block. I have successfully done this by incramenting its y value then setting SDL_Delay(200). So every 200 ms, the block moves down one unit. However, using SDL_Delay lags the whole game, and using the controls to move the block around gets delayed as well. I need to control the falling speed in a way that nothing gets delayed except the falling of the block. How can I achieve this? Thanks.

sentences:
Camera not staying behind model while moving in circle I have a camera behind a model (3rd Person) and I'm having problems KEEPING it behind the model. When I first start my game, you see the back of the model. If the model moves forward, backward or strafe left or right, the camera moves along accordingly. When the model rotates (stationary), the camera rotates accordingly with the model still pointing at the model's back. So far, so good.

The problem comes when the player is BOTH moving and rotating at the same time. Take for example a model moving in a circular pattern like running around a track. As the model moves in this motion, the model rotates slightly more with each complete rotation. Eventually, instead of looking at the model's back, eventually you will see the model in a profile view and before you know it, the model's front is facing the camera. And when you stop moving the model, the model stays in that position.

So, as long as my model is stationary and rotating in one place, the camera rotates correctly. But as soon as there is any sort movement while rotating, the model is offset by a mysterious increasing amount. How can I keep the camera maintaining the same view no matter how I move AND rotate at the same time?

 // Rotates model and pitches camera on its own axis
    public void modelRotMovement(GamePadState pController)
    {
        /* For rotating the model left or right.
         * Camera maintains distance from model
         * throughout rotation and if model moves
         * to a new position.
         */

        Yaw = pController.ThumbSticks.Right.X * MathHelper.ToRadians(speedAngleMAX);
        AddRotation = Quaternion.CreateFromAxisAngle(Vector3.Up, yaw);
        //AddRotation = Quaternion.CreateFromYawPitchRoll(Yaw, 0, 0);
        ModelLoad.MRotation *= AddRotation;
        MOrientation = Matrix.CreateFromQuaternion(ModelLoad.MRotation);

        Pitch = pController.ThumbSticks.Right.Y * MathHelper.ToRadians(speedAngleMAX);
        AddPitch = Quaternion.CreateFromAxisAngle(Vector3.Up, pitch);
        ModelLoad.CRotation *= AddPitch;
        COrientation = Matrix.CreateFromQuaternion(ModelLoad.CRotation);
    }

// Orbit (yaw) Camera around model
    public void cameraYaw(float yaw)
    {
        Vector3 yawAngle = ModelLoad.CameraPos - ModelLoad.camTarget;
        Vector3 axisYaw = Vector3.Up;

        ModelLoad.CameraPos = Vector3.Transform(yawAngle,
            Matrix.CreateFromAxisAngle(axisYaw, yaw)) + ModelLoad.camTarget;
    }

    public void updateCamera()
    {
        cameraYaw(Yaw);
        cameraPitch(Pitch);
    }

sentences:
Unity custom camera projection only working in scene editor I've found this article on Gamasutra on a custom camera projection to make 3D look more 2D and decided to implement it to make some gameplay tests.
I had to make some changes to make it work on URP(on unity 2019.3.6f1) but it "worked" with the following code:
using UnityEngine;
using System.Collections;
using UnityEngine.Rendering;

// This script is meant to be attached to your main camera.
// If you want to use it on more than one camera at a time, it will require
// modifcations due to the Camera.on* delegates in OnEnable()/OnDisable().

[ExecuteInEditMode]
public class CustomProjectionTest : MonoBehaviour {
    private void OnEnable(){
        RenderPipelineManager.beginFrameRendering += ScenePreCull;
        RenderPipelineManager.endFrameRendering += ScenePostRender;
        //Camera.onPreCull += ScenePreCull;
    }

    private void OnDisable(){
        RenderPipelineManager.beginFrameRendering -= ScenePreCull;
        RenderPipelineManager.endFrameRendering -= ScenePostRender;

        GetComponent<Camera>().ResetWorldToCameraMatrix();
    }

    private void ScenePreCull(ScriptableRenderContext context, Camera[] cam){
        // If the camera is the scene view camera, call our OnPreCull() event method for it.
        OnPreCull();
    }

    private void ScenePostRender(ScriptableRenderContext context, Camera[] cam){
        // Unity's gizmos don't like it when you change the worldToCameraMatrix.
        // The workaround is to reset it after rendering.

        foreach(var camm in cam)
            camm.ResetWorldToCameraMatrix();
    }

    private Camera _cam;
    private void Start(){
        _cam = GetComponent<Camera>();

        // Set the camera this script is attached to to use orthographic sorting order.
        // Instead of using the euclidean distance from the camera, objects will be sorted based on their depth into the scene.
        _cam.transparencySortMode = TransparencySortMode.Orthographic;
    }

    public Vector4 up = new Vector4(0, 1, 0, 0);

    // This is a Unity callback and is the ideal place to set the worldToCameraMatrix.
    private void OnPreCull(){
        var cam = !Application.isPlaying? Camera.current : _cam;

        // First calculate the regular worldToCameraMatrix.
        // Start with transform.worldToLocalMatrix.
        var m = cam.transform.worldToLocalMatrix;

        // Then, since Unity uses OpenGL's view matrix conventions we have to flip the output z-value.
        m.SetRow(2, -m.GetRow(2));

        // Now for the custom projection.
        // Set the world's up vector to always align with the camera's up vector.
        // Add a small amount of the original up vector to ensure the matrix will be invertible.
        m.SetColumn(2, 1e-3f*m.GetColumn(2) - up);

        cam.worldToCameraMatrix = m;
    }

    public static Matrix4x4 ScreenToWorldMatrix(Camera cam){
        // Make a matrix that converts from screen coordinates to clip coordinates.
        var rect = cam.pixelRect;
        var viewportMatrix = Matrix4x4.Ortho(rect.xMin, rect.xMax, rect.yMin, rect.yMax, -1, 1);

        // The camera's view-projection matrix converts from world coordinates to clip coordinates.
        var vpMatrix = cam.projectionMatrix*cam.worldToCameraMatrix;

        // Setting column 2 (z-axis) to identity makes the matrix ignore the z-axis.
        // Instead you get the value on the xy plane.
        vpMatrix.SetColumn(2, new Vector4(0, 0, 1, 0));

        // Going from right to left:
        // convert screen coords to clip coords, then clip coords to world coords.
        return vpMatrix.inverse*viewportMatrix;
    }

    public Vector2 ScreenToWorldPoint(Vector2 point){
        return ScreenToWorldMatrix(_cam).MultiplyPoint(point);
    }

    private void Update(){
        if(Input.GetMouseButtonUp(0)){
            Debug.Log(ScreenToWorldPoint(Input.mousePosition));
        }
    }
}

Well, kinda. For some reason, it only works in the scene editor, but not in the game. I just have no clue why
With Scene Editor:

In Game

sentences: How does one accurately design a UI? I'm currently wishing to draw up my UI for a 2d game, however I'm not so sure what the normal strategy is for creating the images for a UI. Are there any programmes which are specifically accurate for UI Design or is something like Photoshop perfectly fine?

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:
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:
Why the MoveTowards make the transform moving nonstop? In the Update in the else part, I'm trying to move the transform up from its current position on the exit more up by offset.
When the flag bool exit is true I want the transform to move up more by the offset for example if the offset is 7 then move up on the Y more 7. but it's moving up non-stop.
I tried to like this with exitPosition variable for storing at exit: but still, it's moving up non-stop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Testing : MonoBehaviour
{
    public float speed;
    public float offset;

    private bool exited = false;
    private Vector3 exitPosition;

    private void Start()
    {
        Debug.Log("Position : " + transform.position);
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.name == "Cube")
        {
            Debug.Log("Exited !");
        }

        exitPosition = new Vector3(transform.position.x,
                transform.position.y + offset, transform.position.z);

        exited = true;
    }

    private void Update()
    {
        if (!exited)
        {
            transform.position += Vector3.up * speed * Time.deltaTime;
        }
        else
        {
            transform.position = Vector3.MoveTowards(transform.position, exitPosition, speed * Time.deltaTime);
        }
    }
}

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:
Predicted trajectory becomes less accurate in a side-on collision In my 2D billiards game, I have it so that when the user clicks and drags with their mouse, a Physics2D.CircleCast is projected from the cueball to wherever the mouse is. If the circle happens to hit the red ball, a line is rendered from the red ball's position to the direction of the normal of the collision. So it's supposed to predict where the red ball will go when it gets hit by the cueball.

If you look at the first gif below, you'll see that it works if the red ball gets hit at its center (or close to it). The red ball ends up moving more or less along the predicted line.

However, if you look at this second gif, you'll see that if the red ball gets hit closer to its edge, the predicted line is much less accurate.

Why is this and how can I fix it?

This is the prediction code I use:

 if (Input.GetMouseButton(0) && cueBall)
 {
        Vector2 mousePos = cam.ScreenToWorldPoint(Input.mousePosition);
        var direction = (mousePos - (Vector2)cueBall.position).normalized;
        var hit = Physics2D.CircleCast(cueBall.position, _radius, direction, Mathf.Infinity);

        if (hit)
        {
            _lineMain.Draw(cueBall.position, hit.point);
            _ghostBall.SetPosition(hit.point - (direction * _radius));
            _lineTarget.Draw(hit.point, hit.point - hit.normal); //This is the predicted trajectory.
        }
 }

sentences:
Particle system lifetimes in OpenGL ES 2 I don't know how to work with my particle's lifetimes. My design is simple: each particle has a position, a speed and a lifetime. At each frame, each particle should update its position like this:

position.y = position.y + INCREMENT * speed.y

However, I'm having difficulties in choosing my INCREMENT. If I set it to some sort of FRAME_COUNT, it looks fine until FRAME_COUNT has to be set back to 0. The effect will be that all particles start over at the same time, which I don't want to happen. I want my particles sort of live "independent" of each other.

That's the reason I need a lifetime, but I don't know how to make use of it. I added a lifetime for each particle in the particle buffer, but I also need an individual increment that's updated on each frame, so that when PARTICLE_INCREMENT = PARTICLE_LIFETIME, each increment goes back to 0.

How can I achieve something like that?

sentences:
Anyway to change the property of a existing animation to another type? The title pretty much says it all. Take this rather simple animation

I would like to reuse this same animation in a UI element but  for that I have to animate the Image component and not the sprite. Is there a way to copy over the keys or edit the animation somehow so that the property is a Image.sprite ?

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:
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:
Can using different vertex-buffers for each vertex-attributes be good in certain scenarios? Is there scenarios where this is actually good practice? Or does it slow down performance?

Example:

//Vertex format is:
//X, Y, U, V
var myXYs:Vector.<Number> = new <Number>[
  -1, -1,
  1, -1,
  1, 1,
  -1, 1
];

var myUVs:Vector.<Number> = new <Number>[
  0, 0,
  1, 0,
  1, 1,
  0, 1
]

//Create actual VertexBuffers....
// ...yaddiyaddiyadda...

//Set context3d's vertex-attributes:
//Assign 'va0':
context3D.setVertexBufferAt(0, bufferXY, 0, Context3DVertexBufferFormat.FLOAT_2);
//Assign 'va1':
context3D.setVertexBufferAt(1, bufferUV, 0, Context3DVertexBufferFormat.FLOAT_2);

Would the GPU have to constantly internally 'swap' between bufferXY and bufferUV to process the vertex-data? Or does it handle it just as good as a single vertex-buffer?

NOTE: My goal is to figure out a way to minimize uploading data from CPU to GPU for a large number of objects (more than the 128 limit with vertex-constants in Stage3D) by manipulating a list of vertices only responsible for the position of objects rather than the entire geometry + color and/or UV coordinates.

sentences:
How can I restart an animation? The first time the player clicks a button, my animation plays properly.

The problem is that when the player presses the button a second time, the animation does not play.

Here is the code I'm using to control my animation:

public Animator anim;

public Animator animsfirst;
public Animator animssecond;
public Animator animsthird;

public Animator reanimsfirst;
public Animator reanimssecond;
public Animator reanimsthird;
public Animator closeinstruct;

public void instructionpanel()      //(instruction panel open animation)
{
    anim.enabled = true;         //when button click instruction panel open
    animsfirst.enabled = true;
    animssecond.enabled = true;
    animsthird.enabled = true;
}

public void closeinstructionpanel()  //(instruction panel close animation)
{
    Debug.Log("animationrun");   //when button click instruction panel close
    reanimsfirst.Play("freverse");
    reanimssecond.Play("srevese");
    reanimsthird.Play("lreverse");
    closeinstruct.Play("clreverse");
}

Here is the animator controller setup for the animsfirst object:

And for the reanimsfirst object:

How can I resolve this issue?

sentences:
Failing Screen Resize Method So I want my game to draw to a specific "optimal" size and then be stretched to fit screens that are a different size. I'm using LibGDX and figured that I could just draw everything to a FrameBuffer and then resize that buffer to the appropriate size when drawing it to the actual display. However, my method does not work, it just results in a black screen with the top right quarter of the screen white.Intermediary is the FBO, interMatrix is a Matrix4 object, and camera is an OrthographicCamera.

    @Override
public void render()
{
    // update actors
    currentStage.act();

    //render to intermediary buffer
    batch.setProjectionMatrix(interMatrix);

    intermediary.begin();
    batch.begin();

    currentStage.draw();

    batch.flush();
    intermediary.end();

    //resize to actual width and height
    Sprite s = new Sprite(intermediary.getColorBufferTexture());
    s.flip(true, false);

    batch.setProjectionMatrix(camera.combined);

    batch.draw(s.getTexture(), 0, 0, width, height);

    batch.end();
}

These are the constructors for the above mentioned objects (GAME_WIDTH and HEIGHT are the "optimal" settings, width and height are the actual sizes, which are the same when running on desktop).
    intermediary = new FrameBuffer(Format.RGBA8888, GAME_WIDTH, GAME_HEIGHT, false);

    interMatrix = new Matrix4();
    camera = new OrthographicCamera(width, height);

    interMatrix.setToOrtho2D(0, 0, GAME_WIDTH, GAME_HEIGHT);

Is there a better way of doing this or is this a viable option and how do I fix what I have?

Edit
So I changed some things around and it mostly works. This is my code now:

        sv = new StretchViewport(GAME_WIDTH, GAME_HEIGHT);
    currentStage = new StageMainMenu(sv);
}

@Override
public void render()
{
    // update actors
    currentStage.act();

    //render
    currentStage.draw();
}

However this results in some peculiar behavior when changing the window size, that I can't explain. This is what happens:

There should only be one "Press me!" button. The top button of the two does not seem to be scaled correctly and also flickers, but it should not be showing up at all...

sentences:
HTML5 Canvas Converting between cartesian and isometric coordinates I'm having issues wrapping my head around the Cartesian to Isometric coordinate conversion in HTML5 canvas. As I understand it, the process is two fold:

(1) Scale down the y-axis by 0.5, i.e. ctx.scale(1,0.5); or ctx.setTransform(1,0,0,0.5,0,0); This supposedly produces the following matrix:

[x; y] x [1, 0; 0, 0.5]

(2) Rotate the context by 45 degrees, i.e. ctx.rotate(Math.PI/4); This should produce the following matrix:

[x; y] x [cos(45), -sin(45); sin(45), cos(45)]

This (somehow) results in the final matrix of ctx.setTransform(2,-1,1,0.5,0,0); which I cannot seem to understand... How is this matrix derived? I cannot seem to produce this matrix by multiplying the scaling and rotation matrices produced earlier...

Also, if I write out the equation for the final transformation matrix, I get:

newX = 2x + y
newY = -x + y/2

But this doesn't seem to be correct. For example, the following code draws an isometric tile at cartesian coordinates (500, 100).

ctx.setTransform(2,-1,1,0.5,0,0);
ctx.fillRect(500, 100, width*2, height);

When I check the result on the screen, the actual coordinates are (285, 215) which do not satisfy the equations I produced earlier... So what is going on here? I would be very grateful if you could:

(1) Help me understand how the final isometric transformation matrix is derived;

(2) Help me produce the correct equation for finding the on-screen coordinates of an isometric projection.

Many thanks and kind regards

sentences:
How to handle a huge map? Generically speaking, how would you handle a huge 2D Map of which only a part is displayed? Imagine the old top-down racing games like Micro Machines.

I would know how to do something with a tile-based map, but I want to create completely custom Maps.

Target Devices are iOS, Windows Phone 7, Android, Mac and PC.

Assume the Map is too big to fit to fit into a single Texture. Would I have multiple textures, 4096x4096 each and load them all into RAM? Seems wasteful, and if textures are uncompressed I might actually run out of graphics memory.

Would I only load the max. 4 Textures that I need at any given point (when I'm at the intersection)?

Or would I have one huge image file and load parts of it? In that case, are there any image formats that make it easy (O(1)) to find the file offset and length which I would have to load?

Or is there a completely different algorhithm? Are textures the wrong idea?

How would you implement a game like Micro Machines?

sentences: How do I make the PS4 controller vibrate in Unity3D on mac? I am currently working on a 2D game in Unity3D with an option to play with a gamepad/controller. I would like the PS4/dualshock 4 controller to vibrate. I am on mac. I have looked into Xinput but I think it is only for Windows, I may be wrong.

sentences:
Where can I publish my Windows Indie game? I've just finished an XNA game for the Windows Phone 7 and XBLIG.  At the moment, the game is a 'lite' version, so is free, but the next version will have a small price-tag.

I also did a Windows version.  Where's the best place to publish it?

sentences: How should a programmer get started with creating 2D Sprites? I am a programmer. Given a sprite sheet, I can code game as per the requirements. But I do not know how to create these sprites. I use Cocos2D. And I do not know where to begin. I have never done anything art-related before. I am aware of TexturePacker. But it only packs already created sprites. So how do I get started with creating 2D sprites? Are there any dedicated softwares for this purpose? Main main concern is about creating assets for Retina Displays.

sentences:
How to avoid position increment by velocity multiplied by delta time even the body is not moving? In the below image, the character texture is properly sync to body even moving on free space.

In the below image, the character is moving downward. But the texture got a span or not sync properly, when there is an obstacle or a wall.

The systems I've use for the data logic (ECS)

class MovementSystem extends IteratingSystem {

      @Override
      public void processEntity(Entity entity, float deltaTime) {
            PositionComponent position = ...
            VelocityComponent velocity = ...

            position.x = velocity.x * deltaTime;
            position.y = velocity.y * deltaTime;
      }

}

class PhysicsSystem extends IteratingSystems {

      @Override
      public void processEntity(Entity entity, float deltaTime) {
           PositionComponent position ...
           BodyComponent body...

           position.set(body.getPosition());
      }

}

class RenderingSystem extends IteratingSystem {

      @Override
      public void processEntity(Entity entity, float deltaTime) {
           PositionComponent position ...
           SpriteComponent sprite ...

           batch.draw(sprite.texture, position...);
      }

}

I know the problem is in the part of MovementSystem positioning, the position is still incremented by velocity multiplied by delta time even the body is not moving while pressing move button.

sentences:
UE4 - storing complex actors in Game Instance I want to make a game where I can hold tools in my hand and inventory. Obviously I want to pass them between levels and maybe even game sessions. Question is, how would I do that?

With simple variables like amount of money or HP, all I do is store a variable in the Game Instance. But what about, for example, a tool that has more data, like the class type, durability, maybe value? Even worse, whole array of them?

The way I use that in game is, there's an actor representing the tool. But even if I store array of those in the game instance, the actors get destroyed while changing level and the array just points empty memory. I could just spawn new ones by using the class type - but that is not enough for me.

My idea is to create something... maybe a struct, that would hold the information and then recreate the inventory item actors according to the data in the struct.

My questions:
What are other ways to do it?
and
Is there something fundamentally wrong with the way I'm storing the items in my inventory now?

sentences: Recreate UI or move it out of view? Which method would be best? What are the pros and cons? For example, if I have a main menu screen, I can easily start my game loop right as the user presses 'Start'. Which would be better, moving the 'Start' button as well as, 'settings, leaderboard, etc' buttons out of view? or to erase them and then recreate them when needed?

sentences:
How do you author HDR content? How do you make it easy for your artists to author content for an HDR renderer? What kinds of tools should you provide, and what workflows need to change, in going from LDR to HDR?

Note that I'm not asking about the technical aspects of implementing an HDR renderer, but about best practices for creating materials and lighting in HDR.  I've googled around a bit, but there doesn't seem to be much about this topic on the web.  Can anyone point me to some good resources on this, or share their own experiences?

Some specific points:

Lighting - how can lighting artists pick HDR light colors? Do they have a standard LDR color picker and then a multiplier? Is the multiplier in gamma or linear space? Maybe instead of a multiplier it's a log-luminance? Or a physical brightness level, like the number of lumens? How will they know what multiplier/luminance/brightness is "correct" for a given light?
Materials - how can texture artists make emissive color maps, such as neon signs, TV screens, skyboxes, etc? Can you paint one as a regular LDR (8-bit-per-channel) image and apply a multiplier (or log-luminance, etc.)? Are there cases where it's necessary to actually paint HDR images? If so, how do you go about this in Photoshop (or other software)?

sentences:
Slick2d fullscreen with black bars NOTE: I am moving this question here from Stack Overflow because I feel it belongs better on this forum. I am deleting the original question from Stack Overflow.

I'm working on a game in Slick2D and I want to have some versatility with the resolutions I can use for fullscreen. Is there a way to make the game's fullscreen add black bars around the game instead of stretching the game to whatever resolution the graphics card can support for fullscreen? I'm not terribly familiar with openGL so if the only way to fix that requires openGL, I would appreciate some detailed explanation on how to implement the code. Currently I'm using the

arg0.setDisplayMode(X_resolution, Y_resolution, true); //arg0 is my AppGameContainer

method. But it means I have to stretch my game to one of the compatible resolutions.

sentences: How does UVW texture mapping work? I'm trying to understand the mathematical theory behind UVW mapping. Can anyone explain me how UVW mapping works? Or at least provide me a pointer?

sentences:
Jumping Logic Issues Possible Duplicate:
  How to make a character jump?

I have been working on a 2D platformer and am trying to implement jumping. At the moment I have it simply teleporting upward and then falling back down:

if(Keyboard.GetState().IsKeyDown(Keys.Space) && !jumping) _position2D.Y -= 64f;

Is there any way to smooth it out and make it more parabolic?

sentences:
How to properly do top-down aRPG melee attacks? I'm reposting this from my own thread in reddit's gamedev community, since there were too few responses:

I've been looking for some info on that, but I mostly find articles on the design of such systems, which are very useful, but not helpful from the coder's point of view. My main idea is similar to what the 2D Zelda games used to do, but with more directional freedom. In Zelda, you can only face one of the cardinal directions and attack the enemy there.
My idea is to have the same but with any direction, since we now have analog sticks, or even mice. I'm pretty sure this has been done before, and a few Flash games come to mind, such as the Zombie Apocalypse game Dead Frontier (which is now done on Unity3D, but was Flash back when I played it)

I'm working with Unity3D (although I'm making a 2D game), and I'm not completely happy with where I'm going.

This:  is my current hacky solution for a Melee hit check. The green triangle is the player, the faint green circle is a trigger that checks if there are enemies in this trigger, and the red boxy thing is an enemy.
When the player presses the "melee attack" button, it picks one of the enemies in the trigger (by order of the first one to enter the trigger) and causes damage.

Among a few things I've added to that are: Slow down the player movement during an attack, so that they can't "run n' slash" through an entire level, and also limit how many attacks the player can do per second. An attack cannot start if the previous one hasn't finished yet.

This is looking a bit crude, though. I just kind of hacked it together and it doesn't feel as natural as in other games I've played.

Here's my hacky Melee Attack script in my prototype (it uses a few magic numbers, such as the attack duration):

void Update()
{
 //other logic
    if (Input.GetMouseButtonDown (0) && sec <= 0)
    {
        attackDuration = 0.5f; //setting how long the attack takes from start to finish
    }
    if (attackDuration > 0)
    {
        attackDuration -= Time.deltaTime;
        if (attackDuration <= 0.25f && !done) //cause the damage when the attack is halfway done
        {
            if(EnemiesInRange.Count > 0)
            {
                Enemy target = ((GameObject)EnemiesInRange[0]).GetComponent<Enemy>();
                target.health -= 10;
                if (target.health <= 0)
                {
                    EnemiesInRange.Remove(target.gameObject); //if the enemy dies, it's no longer a valid target.
                }

            }
            done = true;
        }
    }
    else
    {
        done = false;
        sec = 0; //attack over, reset it to zero (to avoid stuff like -0,001)
    }
//other logic
}

Meanwhile, in the CharacterMovement.cs script:

void Update()
{
//other logic
    if(gameObject.GetComponent<MeleeAttack>().sec <= 0)
    {
        lookAtMouse();
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * baseSpeed, Space.World);
    }
    else
    {
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * (baseSpeed*0.25f), Space.World);
    }
//other logic
}

What I'm doing here is stopping the player to change their facing during the attack as well as slowing the movement down to 1/4 the base speed.

Anyway, any advice? How could I make attacking and moving feel more natural? What about the hit mechanics themselves?

My biggest gripe right now is: I don't think "Pick an enemy in a small circular area ahead of the player" is really good.  What should I do?

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:
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:
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:
What is the use of FBX files in Unity? I downloaded the Space Kit from Kenney's assets and imported it to my project. I saw a subfolder called Models, with many files with .fbx extension (e.g. "alien.fbx", "astronaut.fbx", etc.). When I dragged them into the scene, I saw objects with some sub-objects (e.g. alien object with head and legs as sub-objects), but they seem just static objects - they have only renderers.
Is this what these .fbx files are all about?
Or maybe I am using these assets incorrectly?

sentences:
Unity - Random Spawned Enemy Is Not Moving I want to make an enemy spawner with random rotation left and right in unity. Its an 2d platformer. The random rotation is working, but the enemy is not moving after it's spawned.

I put the rigidbody of the enemy in the value enemiesrb in the script EnemySpawn and gave it an .velocity = new Vector.

I have 2 scripts

  EnemyPatrol:

public float moveSpeed;
public bool moveRight;

public Transform wallCheck;
public float wallCheckRadius;
public LayerMask whatIsWall;
private bool hitWall;

public float lockPos = 0;

// Use this for initialization
void Start () {

}

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

    hitWall = Physics2D.OverlapCircle(wallCheck.position, wallCheckRadius, whatIsWall);

    if (hitWall)
    {
        moveRight = !moveRight;
    }

    if (moveRight)
    {
        transform.localScale = new Vector3(-1f, 1f, 1f);
        //GetComponent<Rigidbody2D>().velocity = new Vector2(moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
    }
    else
    {
        transform.localScale = new Vector3(1f, 1f, 1f);
        //GetComponent<Rigidbody2D>().velocity = new Vector2(-moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
    }

  and EnemySpawn

public GameObject enemies;
private Rigidbody2D enemiesrb;

public float spawnTime;
public int maxEnemies;
public int lofr;

private int amount;

public float moveSpeed;
void Start()
{
    enemiesrb = enemies.GetComponent<Rigidbody2D>();
}

void Update()
{
    //enemies = GameObject.FindGameObjectsWithTag("Enemy");
    //amount = enemies.Length;

    if (amount != maxEnemies)
        InvokeRepeating("spawnEnemy", spawnTime , spawnTime);

}

void spawnEnemy()
{
    lofr = Mathf.Abs(Random.Range(0, 1));

    if (lofr == 1)
    {
        Instantiate(enemies , transform.position, Quaternion.Euler(1,180,1));
        enemiesrb.velocity = new Vector2(moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
    }
    else if(lofr == 0)
    {
        Instantiate(enemies , transform.position, Quaternion.Euler(1,1,1));
        enemiesrb.velocity = new Vector2(-moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
    }
    CancelInvoke();
}

the lofr means left or right. it defined if it need to spawn left or right

sentences:
Should I write my own physics engine, because of networking integration? I'm currently developing a top down, realtime, zombie shooter. I'm coding this in Java, using JBox2D as my physics engine. I have been coding the networking this week, and am now up to the physics synchronization.

I'm planning to use the predictive client/authoritative server model, where the client is free to move, as long as the server approves of it later. This involves the client sending packets containing movement data to the server, and the server calculating latency, and re-simulating the world from an older state.

My problem is, my current physics engine, JBox2D (basically a port of Box2D), doesn't support rolling back the world, and apparently isn't that easy to serialise the world data. I have 2 solutions, I could either modify/extend my current physics engine, or write my own.

Reasons for writing my own physics engine -

I can remove unnecessary features. In a top down game, I only really need collision mechanics, and handling forces. No gravity is involved.
I can understand the code better, and it would [most likely] be easier to implement roll back functions

Reasons for extending/modifying JBox2D

Writing my own physics engine, would be a significant amount of work, which could be cumbersome
JBox2D has a widely supportive community, that can help me with my dev
JBox2D, has specific optimizations, for things like collision detection, which make it useful
Some work as already been done on this, but little code has been shared

So what are your opinions. This is my first game, and I am no way a professional game developer. If anyone could provide some links to work already done in the area (preferably using JBox2D/Box2D/Java).

sentences:
Line stipple with OpenGL ES 2.0 I found many threads about line stipple (dashed or dotted lines) with OpenGL ES2.0, but there are never any code examples or tutorials on how to implement it.

How do I implement line stipple in OpenGL ES 2.0?

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:
"Your license does not cover Android Publishing" error I recently installed Unity 2017.1.0f3. I imported a project from an older version of Unity it worked perfectly and allowed me to build for Android. I logged in to the Asset Store through the tab in the Unity editor, now I can no longer build for Android.

This is the error I receive:

I created my Unity account before Android was free. Is there a way to update my account to allow me to build with Android again?

sentences:
Cast shadow without rendering object I'm new to UDK, and am using it to develop a survival-horror game based heavily on shadows.

My question is short:  is there a way to create an actor that, when rendered, ONLY renders its shadow (not itself)?

If UDK can't do this, is there any other engine (Unity, CryEngine, Source) that can?

sentences:
How can I add a parallax effect into my side-scrolling game? How can I add a parallax effect into my side-scrolling game? I read a lot about parallax scrolling so I know what the logic is and what parallax is but I can't create a dynamic parallax effect.

I have draw and update functions like this:

void UpdateBackground(Background &back)
{
    back.x += back.velX * back.dirX;
    if(back.x + back.width <= 0)
        back.x = 0;
}
void DrawBackground(Background &back)
{
    draw_bitmap(back.image, back.x, back.y, 0);

    if(back.x + back.width < WIDTH)
        draw_bitmap(back.image, back.x + back.width, back.y, 0);
}

So this draws a parallax effect with two background objects but it draws it statically. I'm creating a 2D side-scrolling game and I'm translating my character and my camera position along x axis. So I have to translate my parallax effect with my camera but when I add to background position.x it doesn't work. How can I solve this?

sentences: Best format for model with double UV sets I'd like to use first UV set as wrapping (or when some faces cover another on UV) diffuse color map and second UV set as baked ambient occlusion (packed to islands) map. It is possibly to use FBX or Collada .dae or other (what?) in this case? I read scene by Assimp library.

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

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

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

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

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

sentences:
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:
DeltaTime is smaller than it should be I have a gameloop for a simulation I'm making, I noticed that the simulation is going very slow, When i checked the DeltaTime it was very small, I set the target fps to be 1 (deltatime should be 1 in that case) and it was still very small (1.1920929E-07) which is making the simulation super slow even with huge numbers.
Here's the gameloop code
    public void Run()
    {
        Ticks = 0;
        _running = true;

        float totalTimeBeforeUpdate = 0;
        float previousTimeElapsed = 0;

        var clock = new Stopwatch();
        clock.Start();

        while (_running)
        {
            var totalTimeElapsed = (float) clock.Elapsed.TotalSeconds;
            var deltaTime = totalTimeElapsed - previousTimeElapsed;
            previousTimeElapsed = totalTimeElapsed;

            totalTimeBeforeUpdate += deltaTime;

            if (totalTimeBeforeUpdate >= TimeUntilUpdate)
            {
                GameTime.Update(deltaTime, (float) clock.Elapsed.TotalSeconds);
                totalTimeBeforeUpdate = 0;

                Update(GameTime);

                Draw(GameTime);

                Ticks++;
            }
        }
    }

Edit: Yes I'm getting the correct target fps
Edit: Here's the results I'm getting when debugging
Ticks: 0, Total Time Elapsed: 1.0002049, Delta Time: 1E-07, FPS: 10000000
Ticks: 1, Total Time Elapsed: 2.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 2, Total Time Elapsed: 3.0000003, Delta Time: 1E-07, FPS: 10000000
Ticks: 3, Total Time Elapsed: 4.0000004, Delta Time: 1E-07, FPS: 10000000
Ticks: 4, Total Time Elapsed: 5.0000004, Delta Time: 1E-07, FPS: 10000000
Ticks: 5, Total Time Elapsed: 6.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 6, Total Time Elapsed: 7.0000004, Delta Time: 1E-07, FPS: 10000000
Ticks: 7, Total Time Elapsed: 8.0000003, Delta Time: 1E-07, FPS: 10000000
Ticks: 8, Total Time Elapsed: 9.0000002, Delta Time: 1E-07, FPS: 10000000
Ticks: 9, Total Time Elapsed: 10.0000003, Delta Time: 1E-07, FPS: 10000000
Ticks: 10, Total Time Elapsed: 11.0000012, Delta Time: 1E-07, FPS: 10000000
Ticks: 11, Total Time Elapsed: 12.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 12, Total Time Elapsed: 13.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 13, Total Time Elapsed: 14.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 14, Total Time Elapsed: 15.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 15, Total Time Elapsed: 16.0000004, Delta Time: 1E-07, FPS: 10000000
Ticks: 16, Total Time Elapsed: 17.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 17, Total Time Elapsed: 18.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 18, Total Time Elapsed: 19.0000006, Delta Time: 1E-07, FPS: 10000000
Ticks: 19, Total Time Elapsed: 20.0000005, Delta Time: 1E-07, FPS: 10000000
Ticks: 20, Total Time Elapsed: 21.0000006, Delta Time: 1E-07, FPS: 10000000
Ticks: 21, Total Time Elapsed: 22.0000006, Delta Time: 1E-07, FPS: 10000000
Ticks: 22, Total Time Elapsed: 23.0000002, Delta Time: 1E-07, FPS: 10000000

it says the FPS is really high, that's because I'm using the deltatime to calculate it, you can see its running at 1 FPS (which is what i set it to) from the Ticks and total time elapsed, Delta Time is really smalls (very close to 0) and it should be actually 1 since I'm running at 1 FPS

sentences: Can I use the names or logos of real football teams in my game? I am developing a football game and I want to know if it is legal to name teams after real football teams. What about their logos?

sentences:
Why can't I rotate anything to be "more than 360 degrees or less than 0 degrees"? I've been trying to make an animation in Unity, but most assets already come bundled with everything facing at 0 degrees, not to say it's a bad thing.
However, the problem I'm facing is that the animation keyframes aren't playing out correctly.
When this is done with raw measurements (simply dragging the XYZ rotations), negative and greater than 360 degree angles are taken account. But then again - Unity could be simply remapping them, whcih is not the case.
For example, the prop_robotArm prefab, found within Unity's Robot Factory asset pack has a rotator script that simply rotates the whole thing along the Y axis.

void OnFixedUpdate()
{
    transform.Rotate (new Vector3(0, rotateSpeed*Time.deltaTime,0));
}

Meaning that after slightly more than a full revolution, the Y rotation value should be more than 360 degrees, which it does end up becoming... Eventually.

Thinking that was possible, I tried to mimic this behavior by making the arm rotate 720 degrees (twice) in an animation file (this is not using the rotator.cs script attached to the body in the example above).
Instead, all I ended up was the arm's body staying still as 720 is the same as... 0 degrees in rotation changes.
So, I tried a second experiment; trying to rotate from 359 degrees to 1 degree (or -1 to 1 degree).
Just like above, it didn't go to plan. When the animation is run, it simply runs from 359, through every angle in-between before reaching 1, instead of 359, 360 (0) and 361 (1).
If you don't get what I mean, see the diagram below.

So, I was wondering, is there a way to allow for such rotation to be defined in an animation curve?
Every time I try doing it, any value greater than 360 (or lesser than 0) is replaced by its co-terminal counterpart that's between 0 and 359.999999...999.

sentences:
arrays last element that has color never gets accessed I have assigned this C# script to a spot light. But the green color which is at 2nd position in array never gets accessed and spot light never gets green light. I tried debugging this code but no idea what's wrong

public class CSharping : MonoBehaviour {

    public Light lt;

    Color[] allColor = { Color.red, Color.blue, Color.green};

    // Use this for initialization
    void Start () {
        lt  = GetComponent<Light>();
    }

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

        if(Input.GetButtonDown("Fire1"))
        {
            int colorVariable = Random.Range(0,2);
            lt.color = allColor[colorVariable];
        }

    }
}

sentences:
How can I smoothly move from tile to tile? I've looked at other games with tile based movement. I am aiming to create a game like pokemon, where the player moves smoothly to the next tile.

I am using KeyAdapter, in my KeyInput class. This basically just sets a move speed which is added to the x position of my player in the player's tick function:

if(key == KeyEvent.VK_A && ((Player)object).velY == 0){
    object.setVelX(-3);
    ((Player)object).setDirection(Direction.LEFT);
}
//The other keys as well...

In my tick method, as I said it basically just adds it:

public void tick() {
    x += velX;
    y += velY;
}

And it renders in my render method through Awt Graphics. Anyways, I was wondering how I could make this have tile based movement. Each tile is 32x32 pixels. I've looked at other tutorials and they all seem to have different solutions, I'm not sure it will be compatible with what I'm using a KeyAdaptor. I assume I might have to use a modulus operator to make sure the movement is in tiles.

sentences:
How to implement 'Fog of War' in SpriteKit or Cocos2D? Take a look at the image below from the game Warcraft 2. There's a darkened area (like a fog) that represents the limits of the 'field of view' -- to the effect that you would not see any enemy characters in the fog.

How would you implement this 'fog' in iOS (SpriteKit, Cocos2d, etc)? Mostly interested in hearing high-level strategies on implementing the fog itself -- within the node-based hierarchy of something like SpriteKit or Cocos2d.

And bonus: what do people call this 'fog' in the game industry?

[Update] 'Fog of War' (thanks @Jon)

sentences:
Which structures to use for maintaining 2D objects on canvas? How to map clicks to objects? I need to draw some 2D objects on a canvas. And I need to map the 2D coordinates of clicks to objects.

What is the usual way to maintain a 2D object's size and position (which data structures,  etc.)? What's the effective way to say: this object is at coordinates (x, y)?

sentences:
Cocos2d savegame cctmxtiledmap my game features several tilemaps that are initially loaded from a tmx file and modified during gameplay.
How can I save the changed tilemaps in a save game? Will NSCoding do the trick here or is the CCTmxTiledMap object too complex for that? How would a sample implementation look for this problem?

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:
XNA Video Playback on XBOX "Invalid operation exception" I am able to play a video in windows in my project, but the same code fails on the XBOX at the _player.Play(_logo) line. The error message is:

"An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll"

Relevant code:

    public LogoScreen()
    {
        TransitionOnTime = TimeSpan.Zero;
        TransitionOffTime = TimeSpan.Zero;

        _content = new ContentManager(Game3.Instance.Services, "Content");

        _player = new VideoPlayer();
        _player.IsLooped = false;

        _sb = new SpriteBatch(Game3.GDM.GraphicsDevice);
    }

    public override void LoadContent()
    {
        _logo = _content.Load<Video>("Video/intro_logo");
    }

    private bool _started = false;
    public override void Update(bool otherScreenHasFocus,
        bool coveredByOtherScreen, bool coveredByPopup)
    {
        if(_started == false)
        {
            _player.Play(_logo);
            _started = true;
        }

        if (_player.State == MediaState.Stopped)
        {
            Exit();
        }
    }

Here is the random test video that I'm using:
http://olhovsky.com/xna/intro_logo.wmv

Any ideas why this might be failing?

sentences:
Why are extra assets left in the final game? I was just reading about what was discovered in the files for No Man's Sky, a lot of things that weren't used or relevant to the game. I also read a short while ago about the E3 settings being left in the Watch Dogs files. Why do game developers leave old and unused files in the final game?

Surely this just takes up extra space on a disc and means more data has to be downloaded if you download the game?

Also, aren't the developers afraid of what people could find?

sentences:
Rotate about a skybox I'm a beginner with OpenGl so please discount my ignorance. I've managed to create a skybox (with a texture mapped cube) and would like to rotate the view (eye) around the center of the box, so I can admire the view :). By changing the X/Y coordinates of eye/camera in GLM.LookAt() I'm able to see most of the faces of the skybox but I'm not able to see the top and bottom faces though I'm sure that they are rendered. In any case what's the best way to rotate around the skybox? What I want to do is exactly shown in this video

Thanks!

EDIT: Sorry for the lack of relevant information.

I'm using OpenGL version 3.3.
Not using immediate mode. Everything is via shaders and VBO/VAO
I have already setup the projection, view and model matrices which I pass to the vertex shader, and obviously have the texture loading also working as I can render the skybox. At the moment i've set the projection and model matrices to Identity for simplicity.
I'm deriving the view matrix from GLM.LookAt(), So initially i thought that to rotate around the view box, I'd just have to change the viewMatrix
I'm working on C# using SharpGL
To draw the skybox, I've set up a VAO to draw a cube with vertices in the range (-1,-1,-1) and (1,1,1). Then I load 6 textures for each cube face to 6 Texture Units. During the rendering I draw the cube and update the texture for each face using a sampler variable. All of this seems to be working OK. I verified this my scaling down the size of the cube and checking if all 6 faces were being rendered properly by rotating the ModelMatrix

I suspect one problem is that I'm not positioning the camera in the center of the cube. At the moment it seems to be viewing the cube from outside. I'm still trying to grasp the usage of GLM.LookAt().

This is how I'm rendering the skybox at the moment. And I can see the front face of the cube, but how do I go about placing the camera in the center of the box and rotating it?

 viewMatrix = mat4.identity();
 projectionMatrix = mat4.identity();
 modelMatrix = mat4.identity();
 viewMatrix = glm.lookAt(new vec3(0f, 0f, 1f), new vec3(0f, 0f, 0f), new vec3(0.0f, 1.0f, 0.0f));

        shaderProgram.Bind(GL);
        shaderProgram.SetUniformMatrix4(GL, "projectionMatrix", projectionMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "viewMatrix", viewMatrix.to_array());
        shaderProgram.SetUniformMatrix4(GL, "modelMatrix", modelMatrix.to_array());

skyBox.renderSkybox(GL);

EDIT #2
I managed to figure out my error. I was trying to look at the Top and Bottom faces by doing
viewMatrix = glm.lookAt(new vec3(0f,-1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); and
viewMatrix = glm.lookAt(new vec3(0f, 1f, 0f), new vec3(0f, 0f, 0f), new vec3(0.0f,1f, 0f)); which was giving me a blank screen. The reason being that (0,1,0) is collinear with my up-vector and LookAt() couldn't generate the viewMatrix in this case. Changing the UpVector makes it OK!

sentences:
How to render specific FBO Texture attachment (assume attachment1) with 2 attached Create FBO & its textures like normal.

// FBO & Texture
glGenFramebuffers(1, &mFbo);
glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
glGenTextures(2, mTexture);

for(int i=0; i<2; i++)
{
    // Init texture
    glBindTexture(GL_TEXTURE_2D, mTexture[i]);
    glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, SCREEN_W, SCREEN_H, \
        0, GL_RGBA, GL_UNSIGNED_BYTE, 0 );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
    glBindTexture( GL_TEXTURE_2D, 0 );

    // attach to FBO
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+i, GL_TEXTURE_2D, \
        mTexture[i], 0);
}
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glUseProgram(0);

Bind FBO and render it inside draw loop.

// Preparing FBO texture.
glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

GLuint at0[1] =  {GL_COLOR_ATTACHMENT0};
GLuint at1[1] = {GL_COLOR_ATTACHMENT0+1};

glDrawBuffers(1, at0);
// Filled texture attachment0 less white (transparency = 0.5f)
GUtils::VideoDriver::GetInstance()->DrawFillRect(glm::vec2(0,0), \
        SCREEN_W, SCREEN_H, glm::vec4(glm::vec3(1.0f/(1)), 0.5f));

glDrawBuffers(1, at1);
// Filled texture attachment0+1 white.
GUtils::VideoDriver::GetInstance()->DrawFillRect(glm::vec2(0,0), \
        SCREEN_W, SCREEN_H, glm::vec4(glm::vec3(1.0f/(1)), 1.0f));

glBindFramebuffer(GL_FRAMEBUFFER, 0);

After all things I did above:

texture attachment0 (mTexture[0]) will be filled in less white.
texture attachment1 (mTexture[1]) will be filled in white.

Right?

I cannot understand when render FBO texture:

glBindTexture(GL_TEXTURE_2D, mTexture[index]);
glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0 );
glBindTexture(GL_TEXTURE_2D, 0);

mTexture[0] , screen = white. (It must be less White)
mTexture[1] , screen = black. (It must be White)

Firstly, Did i do a right way to render attached FBO texture or am I misunderstood fbo attachment?

Lastly, How can I fix this?

sentences:
What kind of projection is ScreenX=X/Z, ScreenY=Y/Z? I have an existing class which transforms 3D vectors and projects them on a 2D plane (Camera). The code is all written in C without help from an external library.

To project a single vector (X,Y,Z) on the screen, the code first applies the View matrix of the camera and then for the actual projection does the following:

ScreenX=X/Z;
ScreenY=Y/Z;

ScreenX and ScreenY are then used as the screen coordinates (after additional scaling and translation).

What kind of projection is this?

Since it uses the Z coordinate to adjust the X and Y coordinates, I would think it is a perspective projection, but I'm not sure. If it's indeed a perspectice projection, then what would be the FOV for this?

I'm just trying to understand how the existing code works so that I can rebuild it using standard libraries and using a standard projection matrix if possible.

Any idea?

Edit - Some more information:

After this division, the coordinates are multiplied (scaled) by the "lens resolution" (pixels per unit) and translated by the lens center (X,Y coordinates in pixels):

ScreenX = ScreenX * Res + CenterX;
ScreenY = ScreenY * Res + CenterY;

Res is a large number and I'm guessing it defines the projection plane, letting the coordinates scale from 0 to the size of the actual image in pixels.

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:
OnTriggerEnter2D or OnCollisionEnter2D not getting called I checked the other answers for this but mine didn't get fixed
Here's the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroyCollectibles : MonoBehaviour
{
    private void Start()
    {
        Debug.Log("Hallo");
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("Trigger");
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log("Collsion");
        // if (collision.gameObject.CompareTag("Collectible"))
        // {
        //     Debug.Log("Apple");
        //     Destroy(collision.gameObject);
        // }
    }
}

And screenshots:

sentences: What is billboarding, and can/should it be used in 3D games to create special effects for weapon blasting effects? What is billboarding, and can or should it be used to create special effects for 3D games on weapon blasting effects?

sentences:
Unity - Transform.RotateAround() + Transform.Translate() - Why is rotation offset created and how can it be fixed? I have one object orbit another with RotateAround(), then I use Translate() to move the orbiting object in the same frame in an effort to change the distance at which the object is orbiting.  This causes the rotation provided by RotateAround to drift.  How can this drift be corrected without rewriting my own RotateAround?

public class TestRotateAround : MonoBehaviour
{
    [SerializeField]
    Transform orbitTarget;

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

    }

    // Update is called once per frame
    void Update()
    {
        Vector3 dirToTarget = (orbitTarget.position - transform.position).normalized;

        transform.RotateAround(orbitTarget.position, Vector3.forward, 10 * Time.deltaTime);

        transform.Translate(-dirToTarget * Time.deltaTime * 2);
    }
}

sentences:
Calculating the weight of an object irrespective of the triangle or vertices count in Unity I have a meat piece which I want to weigh. Now there can be anything like fish, cheese, or other items that we can cut and measure. I want the weight to be determined by myself instead of determining from getting the surface of the item as it varies with different tris count.
Currently, I am calculating the weight from the following code.
public static float CalculateSurfaceArea(Mesh mesh)
{
    var triangles = mesh.triangles;
    var vertices = mesh.vertices;

    double sum = 0.0;

    for (int i = 0; i < triangles.Length; i += 3)
    {
        Vector3 corner = vertices[triangles[i]];
        Vector3 a = vertices[triangles[i + 1]] - corner;
        Vector3 b = vertices[triangles[i + 2]] - corner;

        sum += Vector3.Cross(a, b).magnitude;
    }
    // weightMultiplier is a constant value for getting a reasonable weight value.
    return (float)(sum / 2.0) * weightMultiplier;
}

So if there's a meat piece like bellow and I want it to be a weight of let's say 3kg(6.6lb)

then when I cut it into half it should give me values respectively (1.5kg).

So I want the weighing factor to be in my control so that if in the future we have really detailed high poly items the weight shouldn't get affected by that.

sentences:
Function, that is searching for nearest enemy Transform only works sporadically. What am I doing wrong? so I am trying to implement a "Zelda"- or "Dark Souls"-like z-targeting system. You'll see in the code, that the function compiles a list of every enemy in the current scene. I'm still in the prototyping phase so the only credential for the targeting is the distance between enemy and player. The script is attached to my player and there are three enemies in the scene.

Now for the problem: The function is not reliable. Sometimes it updates the 'target', sometimes it doesn't. The debug.log fires as expected, only the most important thing appears to zoom in and out. This function is supposed to toggle the lockon as well, which doesn't reliably work either.

Tips on how to make the code lighter are appreciated as well!

Edit: Added the FixedUpdate(), which is a hot mess right now:

void FixedUpdate ()
{

    // Store the input axes.
    h = Input.GetAxisRaw ("Horizontal");
    v = Input.GetAxisRaw ("Vertical");

    stateInfo = anim.GetCurrentAnimatorStateInfo(0); // 0 is for the base layer.
    if (!stateInfo.IsName("Swing")) {
        if( Input.GetButtonDown("Fire1")){
            anim.SetTrigger("isAttacking");
        }
    }

    if (controller.isGrounded) {
        CalcMovement (h, v);
    } else {
        movement.y -= gravity * Time.deltaTime;
    }
    if (Input.GetButtonDown ("Jump")) {
        movement.y = jumpSpeed;
    }
    if (Input.GetButtonDown ("Fire3")) {
        LockOnEnemy ();
    }
    ProcessEvasion ();
    controller.Move(movement * Time.deltaTime);

    Debug.DrawRay(transform.position, -Vector3.up, Color.blue, transform.position.y + 0.1f);

}

void LockOnEnemy()
{
    //we default to check == false
    bool check = false;

    //we will ONLY scan for new targets if current target is null
    if (target == null)
    {
        GameObject[] enemyList = GameObject.FindGameObjectsWithTag("Enemy");
        if (enemyList.Length > 0)
        {
            int enemyID = -1; //default this to 'invalid' value (just good practice!)
            float closestEnemyDistanceSqr = float.MaxValue; //max lockon distance here (use float.MaxValue unless you have a good reason not to!)

            //find closest enemy (only change is I'm looking at squared magnitudes, as they do the job and are more efficient)
            for (int i = 0; i < enemyList.Length; i++)
            {
                float enemyDeltaSqr = (transform.position - enemyList[i].transform.position).sqrMagnitude;
                if (enemyDeltaSqr < closestEnemyDistanceSqr)
                {
                    closestEnemyDistanceSqr = enemyDeltaSqr;
                    enemyID = i;
                }
            }

            //store the target. we can safely assume enemyID is no longer -1, as we know there is at least 1 enemy in enemyList
            target = enemyList[enemyID].transform;
            Debug.Log("Found: Enemy( " + enemyID + ") at " + Mathf.Sqrt(closestEnemyDistanceSqr));
        }

        //now we set check to true regardless of whether we found an enemy - is this what we want
        check = true;
    }

    //if check is false (i.e. we didn't go through the above if statement), we clear 'target'.
    if (check == false)
    {
        this.target = null;
    }
}

Please note: This version of the code has been commented and cleaned up by the user wibble82, over at unity.answers. Unfortunately nobody could really help me there.

sentences: Sprite editor "minimum size" feature alternative in Unity 5 As you know , unity has been removed its minimum size feature in sprite editor multiple auto slice mode. In some pics Unity discovers a lot of tiny rubbish sprites for example as 4x3 or 10x5 pixels. Is there anyway to set minimum size for good auto slicing in Unity 5?

sentences:
Reading from Streaming Assets in WebGL I'm trying to set up my Unity game for WebGL, but I quickly found out that you can't access your streaming assets as you would in a standalone build. For example, I have a code snippet below of how I load in all of my game's text for localization (i.e. get english translations of all text in my UI).
public void LoadLocalizedText(string fileName) {
        localizedText = new Dictionary<string, string>();
        // StreamingAssetsPath will always be known to unity, regardless of hardware
        string filePath = Path.Combine(Application.streamingAssetsPath, fileName);
        if (File.Exists(filePath)) {
            string dataAsJson = File.ReadAllText(filePath);

            // deserialize text from text to a LocalizationData object
            LocalizationData loadedData = JsonUtility.FromJson<LocalizationData>(dataAsJson);

            for(int i = 0; i < loadedData.texts.Length; i++) {
                localizedText.Add(loadedData.texts[i].key, loadedData.texts[i].value);
            }
        }
        else {
            // ideally would handle this more gracefully, than just throwing an error (e.g. a pop up)
            Debug.LogError("Cannot find file");
        }

        isReady = true;
    }

I've been looking at online examples, and there's a lot of obsolete examples regarding the use of unity's WWW class and php. From what I understand the UnityWebRequest is now the way to go, but I'm confused how to use it with regards to the example above. I'm also trying to figure out how to connect to my SQLite database which is also stored in streamingAssets.
        public SqliteHelper(string databaseFileName) {
        if (Application.platform == RuntimePlatform.WebGLPlayer) {
            // ????????
        }
        else {
            tag = databaseFileName + ":\t";

            string dbPath = Path.Combine(Application.streamingAssetsPath, databaseFileName);
            if (System.IO.File.Exists(dbPath)) {
                dbConnectionString = "URI=file:" + dbPath;
            }
            else {
                Debug.Log ("ERROR: the file DB named " + databaseFileName + " doesn't exist anywhere");
            }
        }
    }

Now that I can't just open an SqliteConnection, I have no idea if there's a c# only solution, or if I have to learn php as suggested from tutorials such as this one. If someone could walk me through how to solve either of these problems I would greatly appreciate it.

sentences:
Writing via content pipeline in Xbox game project I'm creating an Xbox application and I have this problem with the content pipeline. Loading .xnb files is not a problem but I can't seem to find any helpful tutorials on writing via the content pipeline. I want to write an XML whenever the user presses a custom made "save" button. I've searched the web for "saving game sate" etc. but so far I haven't found a solution for my case.

So, summarized: is there a way to write data (in XML format) via the content pipeline, if my Save() method is called?

Cheerz

sentences:
camera movement along with model I am making a game in which a cube travels along a maze with the motive of crossing the maze safely. I have two problems in this.

The cube needs to have a smooth movement like it is traveling on a frictionless surface. So could someone help me achieve this. I need to have this done in a event callback function
I need to move the camera along with the cube. So could someone advice me a good tutorial about camera positions along with an object?

sentences:
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:
Super formula on shader I'm using Shader-toy to experiment and try to learn a bit the shader science.
As exercise I wan to replicate some of the wikipedia math plots. I've started with a Super Formula.

What I want to achieve is this:

(taken from this wikipedia image)

This image shows the parameter of the super formula thing:

a=b=1,
m=3,
n1=5,
n2=18 and
n3=18

I've looked for a similar example, simplified it and try to reproduce my curve.

In shader-toy this is my code:

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    // Variables to be fed into the formula
    float a = 1.0;
    float b = 1.0;
    float m = 3.;
    float n1 = 5.0;
    float n2 = 18.;
    float n3 = 18.;

    vec2 uv = fragCoord.xy / iResolution.xy;

    // translation
    vec2 sf = uv - 0.5;

    // r of the current point
    float pr = sqrt(sf.x*sf.x + sf.y*sf.y);
    // Angle (Phi) of the current point
    float f = atan(sf.y/sf.x);

    // The formula itself. Division by 10.0 added to scale the result down a bit.
    float r = pow((pow(abs(cos(f*m/4.0)/a),n2) + pow(abs(sin(f*m/4.0)/b), n3)), -(1.0/n1)) / 10.;

    // Output with coloring by relative radius
    fragColor = (pr <= r) ?
        vec4(1., 0., 0., 1.0) :
        vec4(0.1, 0.1, 0.1, 1.0);
}

But I'm achieving a different shape:

What am I doing wrong?

sentences:
How to get and copy font bitmap from WinGDI to a IDirect3DTexture9? I want to get the pixels (or other data) for any character of the available fonts and copy/build them into a D3D texture so I could make some cache of text rendering by mapping only the character coords in the d3d texture and other stuff I need to solve (and using ID3DXFont is not an option).

How is this normally achieved? Should I render the GDI font to a GDI bitmap and then copy the opaque bits from the bitmap?

I thought about GDI because I can use the fonts installed in the system that way, but I would also like to know which formats should I consider for storing my own fonts and how these formats work.

sentences:
Null Reference Exception error occurs when trying to override AndroidManifest file in unity? So I Created A manifest file in Assets/Plugin/Android/. The File contains:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
 <activity android:name="com.unity3d.player.UnityPlayerActivity" android:windowSoftInputMode="stateHidden"></activity>
</manifest>

Error Occurs when building:

  NullReferenceException: Object reference not set to an instance of an
  object

  UnityEditor.AndroidManifest.SetApplicationFlag (System.String name,
  Boolean value)

  UnityEditor.AndroidManifest.SetDebuggable (Boolean debuggable)

I followed the docs from here, about Overriding the Android Manifest.

The apk builds fine when the manifest is removed.

Complete Error:

  NullReferenceException: Object reference not set to an instance of an object
  UnityEditor.AndroidManifest.SetApplicationFlag (System.String name, Boolean value)
  UnityEditor.AndroidManifest.SetDebuggable (Boolean debuggable)
  UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.PatchManifest (UnityEditor.Android.PostProcessor.PostProcessorContext context, System.String manifest)
  UnityEditor.Android.PostProcessor.Tasks.GenerateManifest.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
  UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
  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.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report)
  UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties)
  UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:286)
  UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UNITY 2018.3.4f1

sentences:
How to detect when a moving rectangle (sprite) is tapped I am new to Monogame. I am currently developing a simple game, just to learn some basics of Monogame development.
The idea here is to detect whether or not the user has tapped on a a rectangle (represented by moving sprite) and return true if they did or false if they did not, but it always returns false, even if I tap on the sprite. The pertaining functions are here:

// Part of Update function
protected override void Update(GameTime gameTime)
{
    touches = TouchPanel.GetState();

    if (CheckRectangleTouch(arlington.BoundingBox, touches))
    {
        arlington.spritePosition = new Vector2(200, 200);
    }
    else
    {
        arlington.spritePosition = new Vector2(100, 100);
    }
}

// Collision function
private bool CheckRectangleTouch(Rectangle target, TouchCollection touchCollection)
{
    if (touchCollection.Count > 0)
    {
        if (target.Contains(touchCollection[0].Position))
        {
            return true;
        }
    }
    return false;
}

Any idea why is this code not working, or about a better method for collision detection?

sentences:
Different iPhone screen resolutions and game graphics We are developing a 2D game for iPhone using cocos2d-x. The artists are drawing the raster graphic for a resoluion of 640x960. For older iPhone devices, those that have a resolution of 320x480, should we provide a completely new set of graphics, to be adapted to the smaller resolution?
I was thinking of simply scaling the whole scene of a factor of 2. That would save us the time to write a specific set of graphic elements for the smaller resolution.
What is the best practices? How do you guys handle the different screen resolution w.r.t. the graphic part of the game?

sentences:
Weird case of a key not working I finished a game in Java. It works perfectly fine on my computer.

Sent it to a friend. On his computer, for some reason, one of the keys that are used to play doesn't work inside the game. (It works in any other context, like a web browser).

He tried pushing this key with no other keys held. Still didn't work. So it's not a 'key combination' issue.

We both use Windows and the most updated JRE version.

What could it be? This is really weird. Thanks

sentences:
Looking for a game engine to make a game like "Ikariam" or "Ogame" I'm an IT student and currently in my spare time I want to start a project. I would like to make a game that resembles a browser games like "Ikariam" or "OGame". I don't want this game to be a browser game, but It has to work like the games above with a couple of players.
What game engine would you suggest?

sentences:
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 load sprite from JSON? i know how to load text, but idk how to load texture from json..

this my c#:

 public void soalbegin(){
     filepath = System.IO.Path.Combine(Application.streamingAssetsPath, "soal.json");
     StartCoroutine ("Json");
     soaldata = JsonMapper.ToObject(jsonString);

 }

 IEnumerator Json(){
 if(filepath.Contains("://")){
     WWW www = new WWW(filepath);
     yield return www;
     jsonString = www.text;
     }
     else {
     jsonString = System.IO.File.ReadAllText(filepath);
 }

public void OnClick(){
         soalbegin();
 GameObject.Find("Panel/soal/gambar/Text").GetComponentInChildren<Text>().text = soaldata["data"][numbersoal]["soal"].ToString();//this to load text from json

//i need variable to load sprite / texture from link json
}

and this is my json:

 {
 "data":[
 {
     "id":"1",
     "soal":"siapa tokoh ini",
     "gambar":"//1.png",
     "jawaban":[
         "natsu",
         "shank",
         "goku",
         "gildart"
         ]
 }
]}

sentences: Any ad network for XNA games on the PC platform? There's a lot of press about the ad controls included on the new 7 phone, but I'm looking for candidates for the PC platform.

sentences:
Photon alongside LibGDX Can anyone point me to a possible implementation of the Photon network engine along with LibGDX for Android?  Or any multiplayer networking SDK for all that matters.

From reading source code it seems that Photon uses the native Android SDK heavily, like Intents and such, which are not provided through LibGDX.

sentences:
How do I change color of one part of sprite in Game Maker? I want to generate a competitive game like Age of Empires where each player has access to a variety of units, and each player can be distinguished by a color in each unit

And instead of sprites create 8 different colors, would have only one, with a mark where that color is changed, for example:

How do I change color of one part of sprite in Game Maker?

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:
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:
AdMob - my own impressions I wanted to test my in-game ads and I forgot to add my device as a Test Device. My game is not yet in Google Play and App Store but I have 12 impressions on AdMob. What I have to do in this situation? I know that Google bans for fake click and impression so what can I do? do I have to inform Google about that?

Thank for help.

sentences:
Stress testing a game server without users? I'm working on a card game and its server. There will be a lobby with many tables and many players. The only issue is, how can I see how it might handle 100's of concurrent users without hundreds of concurrent users?

How is this sort of thing usually done?

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:
Why would anti-aliasing work for the debug runtime but not the retail runtime? I'm experimenting with setting various graphical settings in my Direct3D9 application, and I'm currently facing a curious problem with anti-aliasing. When running under the debug runtime, AA works as expected, and I don't have any errors or warnings. But when running under the retail runtime, the image isn't anti-aliased at all. I don't get any errors, the device creates and executes just fine.

As I honestly have little idea where the problem is, I will simply give a relatively high-level overview of the architecture involved, rather than specific problematic code. Simply put, I render my 3D content to a texture, which I then render to the back buffer.

Why would this be?

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:
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:
SDL Parallax Scrolling along two axis I'm trying to implement Parallax scrolling in two dimensions using SDL, but I've run into an issue using SDL_BlitSurface() to blit my layer images to the screen buffer.
The images I'm using for this are borrowed from http://en.wikipedia.org/wiki/Parallax_scrolling, and I was able to get it working fine just scrolling along the X axis, using the following code:

void Parallax::Draw(SDL_Surface* buffer) {

    //draw each layer starting with the bottom
    std::vector<ParallaxLayer*>::iterator it;

    for(it=layers.begin(); it != layers.end(); it++){

        ParallaxLayer* layer = (*it);
        layer->x_offset %= buffer->w;
        int draw_x = layer->x_offset - layer->image->w;

        SDL_Rect blitrect = buffer->clip_rect;

        while(draw_x <= buffer->w) {
            blitrect.x = draw_x;
            SDL_BlitSurface(layer->image, &(layer->image->clip_rect), buffer, &blitrect);
            draw_x += layer->image->w;
        }
    }
}

This works.

Now, I've tried to adapt this into two dimensions. Here's the draw method I'm using now:

void Parallax::Draw(SDL_Surface* buffer) {

    //draw each layer starting with the bottom
    std::vector<ParallaxLayer*>::iterator it;

    for(it=layers.begin(); it != layers.end(); it++){

        ParallaxLayer* layer = (*it);

        //resize offset so as not to overflow ints or whatever
        layer->x_offset %= buffer->w;
        layer->y_offset %= buffer->h;

        int draw_x = layer->x_offset - layer->image->w;
        int draw_y = layer->y_offset - layer->image->h;

        SDL_Rect blitrect = buffer->clip_rect;

        while(draw_x <= buffer->w && draw_y <= buffer->h) {

            blitrect.x = draw_x;
            blitrect.y = draw_y;

            SDL_BlitSurface(layer->image, &(layer->image->clip_rect), buffer, &blitrect);

            if(draw_x <= buffer->w)
                draw_x += layer->image->w;
            if(draw_y <= buffer->h)
                draw_y += layer->image->h;
        }
    }
}

I've added the logic for blitting a layer that's moving in the vertical axis, but when I tested it, this just doesn't play nice. Areas of the screen end up not being blitted, which causes a lovely un-drawn effect:

Link to image as I can't post them directly (new user): SDL blitting bug example

Just to be clear, the images themselves are pushed around in another method. The front two layers are moving along the horizontal axis with varying velocity, and the background is moving vertically with a fixed velocity and horizontal with a variable velocity, but that's largely irrelevant as it's my blit function which is bugged.

It looks like I'm not re-drawing the area of the screen that has the repeating image on it, but I'm lost as to how to go about this.

sentences:
What are the properties of "position, velocity, acceleration, rotation" collectively named? They say naming things is one of the hardest problems in computer programming. They were right.

Given the pseudocode below, what is a more appropriate name for this collection of properties? "Course", "Route", "Heading", "Orientation" all don't capture it.

class NewtonianStuff { // <-- Needs a better name
  vec3 position, velocity, acceleration; // <-- What is this group called
  quat rotation;
};

class SpaceShip {
    NewtonianStuff xxxxxx; // <-- What do you call that
};

Perhaps that collection is too abstract. What is the formal name for this collection of properties?

vec3 position, velocity, acceleration;

The best I can come up with is "PositionAndDerivatives", which doesn't really flow.

sentences:
Refresh a single view The game I'm working on is based on different levels. I can use different activities or only one activity with different layouts ( or maybe only one layout, you have to apologize me but I'm studying alone and it's pretty hard to learn alone ).

My problem is: I'm not sure what is best way to implement levels in game. If I use only one activity as container for each level, where I design each level as different layout, how can I refresh my current activity with the new content ?
To make it clear, think about "Cut the rope", is every level a different activity or they load different xml's on the same ?

I'm sorry if this question is not properly written, but I can't find more specific terms to make it better.

sentences:
Where to put Entity Death Events in a Component/System Design Entities in my game are nothing more than a collection of components, tied together with an entityID. I have (near) data-only components, and systems that work on the data.

One of these components is HitPoints. It is one of the few components that has a little bit more than just data: it houses a Dying event that triggers from the HitPointsSystem when the hitpoints go below 0. One of the event listeners is my user interface, while an entity is selected, it listens to the current selection's Dying event. On-death, the entity is dis-selected. Having entities selected draws little circles around the selection. It works great... Right up until I have an entity without HitPoints that can still die.

I have a Missile in my game which does not have HitPoints, but it can be selected, and it can die. When a Missile is selected, my user interface recognizes that it does not have HitPoints, and therefore also does not have a Dying event, which later causes the draw loop to attempt to draw a "selected" and dead Missile, causing a crash.

You might guess that you could just add HitPoints to the Missile and everything would be fine, but my AI targeting system looks for enemy HitPoints because those are the only things it can damage. I don't want missiles to be targeted, and I don't want to add a special rule either.

So... if all entities can die (or be deleted), where do I place the Dying event? Should I be making a new component? Either a component for all things that can die (almost everything), or a component for AI targets? Or is there a better place to put an event like this?

sentences:
Why don't my generated instances update when I change their prefab? I’m making an Editor tool -- a ScriptableWizard -- that instantiates a prefab on a grid. But I find that when I update the prefab, the instances don’t update.

When I instantiate prefabs interactively in the Editor by dragging them from the Project panel to the Scene or Hierarchy, then updates to the prefab affect the instances as expected.

I see another difference between my scripted instances and the ones created when I drag the prefab into the scene: when I do it interactively, the instance in the hierarchy is listed in blue. But the instances I create from script using the same prefab are listed in black, similar to objects created directly in the scene.

Here’s the hierarchy; the “JitterPrefab” was dragged into the scene, and the ones under “gridParent” were instances of the JitterPrefab generated from my script:

Here’s how I’m generating the instances:

public GameObject prefab; ...

void OnWizardCreate() { ...
  Transform instance = Instantiate (prefab.transform, pos, rot, parent.transform);
  instance.name = string.Format ("L{0:D2}-R{1:D2}-C{2:D2}", l, r, c);
  ...
}

When I make a change on the prefab, e.g. change the radius of the Jitter script from 0.025 to 0.25, the manually created instance updates:

But the script-generated instances do not:

What am I doing wrong? Why are my scripted instances no longer connected to the original prefab?
And, separately, how to I tell in the editor (or in script) whether an object in the scene is an instance of a prefab or not?

sentences:
Why do we get artifacts on objects rendered using depth node + depth render camera on Android? I've encountered and error I can't seem to find online. I get it on all the water shaders I test, and any thing else that I have a depth node + depth render script on the camera for.

I'll share a bit more information about what we're doing in the game.

This artifact changes as we pinch-zoom on Android. So I wonder if the Render Depth script doesn't like that we are changing the zoom/depth for some reason? Maybe it has something to do with how we are handling out cameras movement in Unity?
It is adding more depth information somehow, because the shader is reacting to the artifact. Depending on where the line cuts, the other details will warp to meet it.
This problem doesn't show on all phones. Mostly Android, newer versions, but wasn't showing up on an older S5.

Some other things I've tried within the shader are different shader models 2.5 & 3.0.

Any suggestions on tests I can do, or ideas on what might be the issue?

Here are the nodes I use for the opacity / depth

Currently we've got the controls on one camera, and the depth script on another.
Update, I've found someone talking about a similar sounding problem, but I'm not sure how to do this myself.

Thread here -- https://forum.unity.com/threads/depth-texture-not-working-on-some-devices.319568/

"If I set my RenderTexture Depth format to 16 bits instead of 24 bits it's working!" -- How do I do this? Can I edit my Camera script to do this?

The Camera script seems simple, but I'm not sure how to make it render 16bits instead of 24 bits to test this out.

// Toony Colors Pro+Mobile 2
// (c) 2014-2018 Jean Moreno

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

// Makes the Camera render a depth texture.
// This is needed for some water shaders that use depth-based effects such as edge intersection.

[ExecuteInEditMode, RequireComponent(typeof(Camera))]
public class TCP2_CameraDepth : MonoBehaviour
{
 public bool RenderDepth = true;

 void OnEnable()
 {
  SetCameraDepth();
 }

 void OnValidate()
 {
  SetCameraDepth();
 }

 void SetCameraDepth()
 {
  var cam = this.GetComponent<Camera>();
  if (RenderDepth)
   cam.depthTextureMode |= DepthTextureMode.Depth;
  else
   cam.depthTextureMode &= ~DepthTextureMode.Depth;
 }
}

Thanks!

sentences:
Batching and performances I'm trying to understand batching and I'm not sure to understand how to do that, can I have more informations please? Here is what I found for the moment:

Batching informations

There is many types of batching:

Sprite batching
Geometry batching
???

Sprite batching

This method is useful to draw all sprites with only one draw call.
To do that, a SpriteBatcher class need to get all the mesh with the same Material and the same Geometry (sprite = square geometry).

Get Sprites with same Material
Send all Sprite's matrix to a Sprite shader    (http://antonholmquist.com/blog/sprite-batching-opengl-es-2-0/)

Geometry batching (With static geometry)

Merge meshes's geometry, so you we can draw all meshes in one draw call.

Get all static meshes
Merge meshes's geometry and calculate their position with there matrix (Compute a single VBO and IBO)
Hide original mesh to avoid twice draw.

Am I right with that?
Thanks!

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:
Custom 2D physics on unity I have seen a lot of people think that for a 2D platformer game, Unity2D physics is not really the best approach, and recommend implementing your own physics.

I found the idea interesting, but I don't know how to approach the issue.

Using 2D Rigidbodies, and setting them as kinematic, allows you to ignore unity's physics. But how would collisions be handled without relying on Unity collision system?

sentences:
LIBGDX: Translate grid drawn with ShapeRenderer with an OrthographicCamera I am trying to draw a grid for my "world" that may or may not extend beyond the screen. What I would like to do right now is draw the entire world (which is relatively small) and then use the orthographic camera to translate the view to where the player is inside the "world." Currently I'm just trying to translate the "world" by 100 on the x and y axis to test. What am I doing wrong? Can I use the Shaperenderer with the OrthographicCamera?

public class WorldRenderer implements Disposable{

    private static WorldRenderer worldRenderer;
    private Color gridLineColor = Color.LIGHT_GRAY;
    private OrthographicCamera camera;

    private int worldX;
    private int worldY;

    public WorldRenderer(WorldController worldController) {

        init();

    }

    public void init() {

        worldRenderer = this;
        camera = new OrthographicCamera();

        worldX = 0;
        worldY = 0;

    }

    public void render() {

        //Set the background color to white.
        Gdx.gl.glClearColor(255, 255, 255, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        renderBackground();

    }

    public void renderBackground() {

        ShapeRenderer renderer = new ShapeRenderer();

        //Draw vertical lines.
        for(int i=0;i<=Constants.WORLD_WIDTH * Constants.GRID_WIDTH;i+=Constants.GRID_WIDTH) {

            renderer.begin(ShapeType.Line);
            renderer.setColor(gridLineColor);
            renderer.line(i, 0, i, Constants.WINDOW_HEIGHT);
            renderer.end();

        }

        //Draw horizontal lines.
        for(int i=0;i<=Constants.WORLD_HEIGHT *          Constants.GRID_HEIGHT;i+=Constants.GRID_HEIGHT) {

            renderer.begin(ShapeType.Line);
            renderer.setColor(gridLineColor);
            renderer.line(0, i, Constants.WINDOW_WIDTH, i);
            renderer.end();

        }

        camera.translate(100, 100);

    }

}

sentences:
OpenGL, objects disappear at a certain z distance I'm writing a managed OpenGL library in C++, and I'm having a pretty annoying problem. Whenever I set an objects Z coordinate to -2.0 or lower, the object disappears. And at coordinates 0 through -1.9, it doesn't appear to move away from them camera. I have a world matrix (which is multiplied by the objects position to move it), a view matrix (which is just the identity matrix currently) and a projection matrix, which is setup like this:

FOV: 45.0f
Aspect Ratio: 1
zNear: 0.1f
zFar: 100.0f

using GLMs glm::perspective method. The order the matrices are multiplied by in the shader is world, view, projection, then position.

I can move the object along the X and Y axis perfectly fine. I have depth testing enabled, using GL_LEQUAL. I can change the actually vertices positions to anything I want, and they move away from the camera or towards it perfectly fine. It just seems to be the world matrix acting up. I'm using glm::mat4 for the world matrix, and glm::vec3 for positions. Whats going on here?

I'm also using OpenGL 3.1, GLSL version 140 (1.4?).

sentences:
Unity - Apply different Near/Far clip plane value for different layer I am Lerping the Near value of my camera, from 0 to 38, and it gives this result:
change near clip plane effect

As you see, it gives a nice effect. But now I would like the effect to occur only for one specific layer. How can I do that?

sentences: stepOffset wont work I made a model of a staircase in blender and loaded it into unity. Now my player cant go up the stairs while it can walk up a slope just fine. I have tried puting the stepOffset at different levels,

sentences:
How to approach 360 degree snake without having it "slide" There's a great question here that helps me a little bit in what I want to do, and it explains it quite well:

How To Approach 360 Degree Snake

Basically, I want to have a smooth 360-degrees Snake game, where the snake follows along. I can easily do the same thing as described in the question above (video example), but as you can see that kind of "drags" or "slides" the snake along, which is not what I'm looking for.

I want the entire snake to follow the entire path that the head of the snake follows.

The only solution I can think of is to make some kind of "buffer" to store the rotations of the head, and then "lag" that behind on the other bodies.

Since I think that will end up way too complex, what's the correct way of implementing it?

Here's a screenshot of how my snake looks like right now, to get an idea of what exactly I want to move:

sentences:
Run script after game start, before scene load I'm making some kind of dependencies solving script. To work this script, it must be run before all other MonoBehaviour scripts.

So I made the script something like this:

public class DependencyController {
    private static Dictionary<string, bool> m_DependencyTable = new Dictionary<string, bool>();

    static DependencyController() {
        SceneManager.sceneUnloaded += ResetDependencyData;
    }

    ... some other stuffs ...
}

I'm using dictionary to compare which dependency script(s) loaded. To can use every script's Awake/Start, I declared as static and instantiated right after.

The system actually work pretty good, all scripts can access DependencyController in Awake/Start without any problem, but have some questions remains:

Is static m_DependencyTable is always created before scene loaded?
Is static DependencyController constructor always called after SceneManager is loaded? As you can see, I attached EventListener in SceneManager.sceneUnloaded so that I can clear the dependency table before scene loads.

Any advice will very appreciate it.

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:
How to space actors in scene uniformly? I have a Array data structure right now, which contains 10  soldiers in my army.

They can setup initially in various formations  -
e.g.

 o  o  o
 o  o  o
o  o  o  o

The user can move one of the soldier(currently selected) with the joystick.

 o  o  o
 o  o  o
o  o  o
         o

When he moves I want to automatically adjust the rest of the soldiers position so that they occupy equal areas in the scene, as well as still follow their orignal formation to some extent.

Somehow like this http://arborjs.org/halfviz/#/Mzg

How do I do this? What kind of algorithms should I look at?
How should store my soldiers? which data structure?

sentences:
Why won't this ClanLib "Hello World" project build in Eclipse CDT? I've been trying to get a simple Hello World working with ClanLib using CDT (Eclipse), but I'm just not getting it configured properly.

First, from the command line, I'm able to get it to run using this command:

g++ -o mygame mygame.cpp `pkg-config --cflags --libs clanCore-2.3 clanDisplay-2.3 clanGL-2.3 clanGL1-2.3 clanApp-2.3` -lpthread

So no problems there.

Anyways, I tried setting up the correct build settings in Eclipse, but I just don't know where I'm supposed to add the info for the libraries. I tried adding it in the linker section, that didn't work. I tried a bunch of other things, nothing seemed to work...

Help would be appreciated, possibly as comprehensive as possible... I'm open to alternatives to Eclipse too. And the only reason this is such a problem is because this is the first time I'm trying to start a bigger C++ project, and I decided perhaps it's best to use some tools to make it a little easier, rather than a basic text editor (especially for debugging).

Oh, and I'm running Ubuntu, if that makes a difference. I'm really surprised there aren't any tutorials for setting up ClanLib in a development environment as popular as Eclipse...

sentences: In gamemaker studio, how do I make text boxes? How to make text boxes in gamemaker studio?

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:
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:
Fast lighting with multiple lights How can I implement fast lighting with multiple lights?

I don't want to restrain the player, he can place an unlimited number and possibly overlapping (point) lights into the level.

The problem is that shaders which contain dynamic loops which would be necessary to calculate the lighting tend to be very slow.

I had the idea that if it could be possible at compiletime to compile a shader n times where n is the number of lights. If the number n is known at compiletime, the loops can be unrolled automatically. Is this possible to generate n versions of the same shader with just a different number of lights?

At runtime I could then decide which shader to use for which part of the level.

sentences: How can I represent a tile-based map and related properties on disk? I'm trying to load a tile-based map in my game. I've been watching SDL tutorials for a while now but they never covered how to represent the map in a file? How can I represent a tile map on-disk in a way that also lets me store information about collision and other properties?

sentences:
Unity 2D sprite animation keep in sync after setting inactive I am creating a 2D sprite-based game and the tile map contains many animated background tiles (such as water). The map contains many areas that can be transitioned between in a Zelda style (camera scrolls to new area). After scrolling, I set the previous area to inactive. Setting the area to inactive pauses the animations (which is what I want), but when I reenter a previous area the animations start from where they left off. Therefore, any animated tiles adjacent to each other between screens are out of sync and cause an obvious seam. I would like for all the background tile animations to run on the same time value even after they've been paused. The animations use an Animator Controller attached to each animated tile GameObject with an Animation that changes the sprite from an atlas.

Another idea I had would be to have a separate class modify my texture atlas (maybe using setpixel) to update the tiles to their next frame of animation (since I want all tile animations to be in sync and run at the same speed), but I'm not sure how updating the texture will affect performance.

I would like to hear people's ideas for any solutions to this problem.

sentences:
Cubes drawing on top of each other In follow up of my previous question: Limit the number of draw calls

I've lowered my draw calls to only 58 a frame!! But now I have another problem. I have 2500 cubes all drawn in the same position. I have no idea why. Everything that was done in my previous question works fine. This is my draw method that draws my chunk.

    public void Draw(BasicEffect effect, ThirdPersonCam cam)
    {
        device.SetVertexBuffer(vertexBuffer);
        device.Indices = indexBuffer;

        foreach (EffectPass pass in effect.CurrentTechnique.Passes)
        {
            no++;
            pass.Apply();
            effect.VertexColorEnabled = false;
            effect.TextureEnabled = true;
            effect.Texture = grass;

            Matrix center = Matrix.CreateTranslation(new Vector3(-0.5f, -0.5f, -0.5f));
            Matrix scale = Matrix.CreateScale(1f);
            Matrix translate = Matrix.CreateTranslation(cubePosition);

            effect.World = center * scale * translate;
            effect.View = cam.view;
            effect.Projection = cam.proj;

            effect.FogEnabled = true;
            effect.FogColor = Color.CornflowerBlue.ToVector3();
            effect.FogStart = 1.0f;
            effect.FogEnd = 50.0f;

            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 12);
        }

There might be some problems with the way the code is ordered in the method, but this is after moving things around. Changing the values in my DrawIndexedPrimitives line to vertices.Count and cubes.Count draws more cubes, but very strangely. There's 4 rows of 50 and then another row with just 10

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: (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:
HLSL What you get when you subtract world position from InvertViewProjection.Translation? In one of NVIDIA's Vertex shaders (the metal one) I found the following code:

// transform object normals, tangents, & binormals to world-space:
float4x4 WorldITXf : WorldInverseTranspose < string UIWidget="None"; >;

// provide tranform from "view" or "eye" coords back to world-space:
float4x4 ViewIXf : ViewInverse < string UIWidget="None"; >;
...
float4 Po = float4(IN.Position.xyz,1); // homogeneous location coordinates
float4 Pw = mul(Po,WorldXf);    // convert to "world" space
OUT.WorldView = normalize(ViewIXf[3].xyz - Pw.xyz);

The term OUT.WorldView is subsequently used in a Pixel Shader to compute lighting:

float3 Ln = normalize(IN.LightVec.xyz);
float3 Nn = normalize(IN.WorldNormal);
float3 Vn = normalize(IN.WorldView);
float3 Hn = normalize(Vn + Ln);
float4 litV = lit(dot(Ln,Nn),dot(Hn,Nn),SpecExpon);
DiffuseContrib = litV.y * Kd * LightColor + AmbiColor;
SpecularContrib = litV.z * LightColor;

Can anyone tell me what exactly is WorldView here? And why do they add it to the normal?

PS. Error in the last sentence - they add it to the light vector.

sentences:
Physics / drag of object falling through atomsphere Trying to simulate an object plunging into atmosphere.  It seems to work, until the velocity falls past terminal velocity... down to zero... and then back up!

Something must be wrong with how I am applying drag?  I've looked at the code so long, I've managed to confuse myself.

Here I set variables/constants:

Mass = 5;                           //Object Mass
Radius = 7;                         //Radius of the blunt end facing the air stream (too sensitive!!!)
Area = power(Radius,2)*pi;          //The total area of the blunt end facing the air stream
Gravity = 9.8;                      //Earth
DragCoeff = 1.61;
Velocity = 10000;                   //Initial velocity straight down (vector needs to be added)
Acceleration = Gravity * (1/Mass);  //this is acceleration FORCE... subtract drag from this
Altitude = 100000;                  //initial altitude(meters) (atmosphere "begins" at 100Km)

Then, in the main loop of the program:
(note, delta_time is provided by the system in microseconds from the last execution of the loop)

d_time = delta_time / 1000000;                                          //Convert delta_time to seconds
AirDensity = 1.07* power(2.718,-.00005*Altitude);                       //How dense is the air right now?

TermVel = sqrt(2 * Mass * Gravity / AirDensity * Area * DragCoeff);     //Terminal Velocity at our altitude
Velocity = Velocity + Acceleration * d_time;                            //Acceleration added
Drag = 0.5 * AirDensity * sqr(Velocity)* DragCoeff * Area;              //Drag calculated
Velocity = Velocity - (clamp(Drag, 0, TermVel) * d_time);               //Drag subtracted
Altitude = Altitude - Velocity * d_time;                                //Update the position

Thanks ever so much for your kind help in understanding what I've done wrong here.

SS

Edit:
Thanks, Jason... I think I have the correct changes made... but my mass of "5" was causing it to behave really poorly.... the velocity went way negative... so I increased the mass significantly, and it seems to behave better... I will explore it a bit more.

Does it look like I have it right?

Thank you again, ever so much.

SS

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:
Networking and Timing issue I have been trying to use the low-level API for UNET and the focus of this problem is this: NetworkEventType recData = NetworkTransport.Receive(out recHostId, out connectionId, out channelId, recBuffer, bufferSize, out dataSize, out error);
This line is supposed to take in information from many different clients and sits within Update() function. I haven't actually started coding anything in yet... But the point is, if the clients are all transmitting data to the server at a rate equivalent to Update() then this line of code will not be able to (I think?) receive all of them at once (10+ clients vs 1 server). So is there a way to not lose any of the incoming data and process them accordingly?

sentences:
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:
When do I save the buffer data to the database? My entire game is server side and I use nodejs with mysql.

When players connect or join a game, their player data (Items, Stash, Quests, etc) all get stored into the memory buffer.

For example, if a player joins a game and there are 40 items on the floor and he decides to pick them all up, it's easier just to add that to their Inventory object instead of using a insert statement each time. Then, when that user disconnects I can save all that data respectively. (Now that I think of it, that query would run 40 insertion rows..)

That's the problem I have though, do I save the data during the looting process or wait until the player disconnects and run a db update to save their memory buffer (only the changed buffer) to the database?

The Issue I have with that is, if a player picks up over 40 items in the game, that's going to be a lot of sql insertions when they disconnect..

Imagine them finding a ton of items from mobs and having a huge amount of new updated buffer data that needs to be stored.. (after they disconnect), that would be a dreadful update. Especially if they stored hundreds of items in their stash or whatnot. Hmmm.

sentences:
Graphic Design Resource for Indie Game Dev? I'm creating my first game and want to improve upon the graphic design aspects of my game.

By graphic design I mean layout, font, spacing, etc..

Is there a good resource for learning graphic design for a programmer?

I've taken human-computer interaction classes, but that has more to do with task and making task as easy as possible for the user. Not necessarily about layout/spacing.

I mention layout/spacing twice because that's the biggest problem I'm having. I can clearly tell that things need to be spaced properly to be more visually pleasing.

Thanks to all that reply

sentences:
Networking to make a single player RPG into multiplayer I’ve written a few games in Xcode before and would like to turn one into the simplest possible 2D top-down RPG multiplayer game. Essentially just needing movements around a big tiled map (I love drawing), and chat.
Keen to just host my own server on the iMac I use, with python and twisted framework (new to this but happy to take the time to learn). I’m thinking TCP for chat and UDP for tracking movements but do they need to be on separate servers?
Also for games like this I know there isn’t much on the client side. All my map drawing and game logic is set up in Xcode, which I would prefer to keep working in because I’m familiar with the language and love the sprite kits and tile maps. Do I have to redo it all in python on the server side for scaling in the future? Or for cross platform?
I've done lots of research and found plenty of tutorials, just want to know I’m on the right track. I’m not looking to make a WoW killer just something simple I can gradually build on for fun

sentences:
How do I send multiple matrices to a vertex shader? I'm practising animations using bones/skinning. I am trying to send the shader one matrix per vertex. I can think of these two approaches.
Method 1
I have one uniform handle for each bone matrix like this
u_Bone0 = GLES20.glGetUniformLocation(mProgram, "u_Bone[0]");
u_Bone1 = GLES20.glGetUniformLocation(mProgram, "u_Bone[1]");

and in the onDraw I send each of them to the shader:
GLES20.glUniformMatrix4fv(u_Bone0, 1, false, matrix0, 0);
This obviously isn't a good approach if I have a large number of matrices. My second idea which I haven't tried yet since there is a lot of code to refactor
Method 2
Is to use the glUniformMatrix4fv to send them all at once like (assume I have 20 matrices)
GLES20.glUniformMatrix4fv(u_Bones, 20, false, matrices, 0);

where matrices is float[16 * 20]. But then modifying the matrices for each bones becomes a bit tedious. For example, if I want to get the 3rd matrix, I need something along the lines of
float[] _3rd = Arrays.copy(matrices, 3*16, 4*16);

and saving back the values can become even more annoying.

I'm using Method 1 now, but it doesn't look very smart...
What is the best way to send multiple matrices to an OpenGL ES 2 shader?
LE: I'm using Android, so I'm looking for a Java solution.

sentences:
What can cause ALT-TAB to be 'annoying'/slow/glitchy? This is more of an open ended question, but I hope to get some good insight on how to avoid the issue.

When playing Games on Windows, I might want to ALT-TAB out of it. Some games have no problems, others are not so easy: They may take AGES to switch out and back in. Some are even prone to crashing or to weird behaviour like graphic distortion or stuttering sound.

I just wonder what causes this behavior? Is this more a DirectX or an OpenGL thing? Is it caused by Games being 'clever' and caching/wiping the cache whenever the screen settings change? (I assume they do get some sort of signal when I ALT-TAB?)

I don't have any problem of my own, but I'd like to know what to avoid and which 'clever' trick may cause this type of horrible customer experience?

sentences:
Essentials for building a RTS I was wondering if anyone had any links to good reads or books in regards to things to think about when developing a RTS game, I would have been reading things like this and this but would like to read more into it.

Also I have development experience and soon would like to start building the skeleton myself but if anyone has any additional articles about the process (not in programming, but more on planning) that would be great help.

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:
Child parent rendering (flash) in XNA i am currently in the process of implementing a render engine that works like flash's. Where a sprite is drawn inside another sprite and reflects all transformation (rotation, scale, etc) on the parent.

I have my transformation setup like so.

    public Matrix transform
    {
        get
        {
            Matrix m_transform =
                Matrix.CreateTranslation(new Vector3(x, y, z)) *
                Matrix.CreateRotationZ(rotation) *
                Matrix.CreateScale(scale)
                ;
            return m_transform;
        }

    }

But i cannot use spritebatch to render the sprite with a matrix. Is there a way to properly do this ?

Thanks alot ;)

sentences:
Is creating a separate thread for each game session a bad idea? I'm currently working on iocp game server. My game is just like diablo3 basically. 1~4 players join a separate session.

I did basic iocp preparations and now I'm working on game session class. The reason why I'm stuck right now is that I'm not sure if I should create a separate thread for each game session. This concept is the first idea that I came up with but I can't come up with other ideas to avoid creating so many threads for sessions when there are so many game sessions.

So here's my question.

Should I create a separate game logic loop(thread) for each game session? Because that sounds so inefficient when it comes to the situation where only one player joins each session.
If there are some other ways to design the server, please let me know what I should look for to study.

Thanks for your help in advance and sorry for my bad English.

sentences:
GUI.Button inside GUI.Window not responding I am trying to do some GUI work with unity but am having some issues.

I call a window with this code:

fortuneRect = GUI.Window(0, fortuneRect, fortuneWindow, "Your future");

and inside the window I have a button

if(GUI.Button(new Rect(10, 10, 150, 20), "save fortune")){
       Debug.Log("save fortune button press");
       writeToFile("Button pressed!", "fortune.txt");
       Debug.Log("After save fortune button press");
    }

but the button doesn't fire any of its events on click. I tried commenting out the writeToFile but even with only Debugs in the body it doesn't fire.

sentences:
How to stop deltaTime while debugging Framework: LibGDX

IDE: Android Studio

Game based on Kilobolt tutorial

While debugging, the frame delta time i get using Gdx.graphics.getDeltaTime()continues to increment so when i stop debugging and return to application, everything is fast (it is related to runTime, so delta time too)

runTime is calculated in GameScreen class, which increments it with deltaTime and then passes it to GameWorld and GameRenderer methods calls.

How can i stop it while debugging?

sentences:
IAP consumable stuck with reason DuplicateTransaction I've implemented Unity IAP. I have succesfully implemented it before and all went well.
Now at the moment, everything goes well except for 1 consumable. When I try to purchase it, i get the PurchaseFailureReason with value DuplicateTransaction.

After some googling, I found out that it probably is because the transaction was cleared by Google, but the callback was never invoked inside the app. So somehow and somewhere, a flag is set indicating that this transaction is still pending or something? (The purchase on the - now not working consumable - had also indeed been made before and the callback was NOT called, so this seems to be correct.)

All other consumables work fine. They are configured exactly the same, just with another reward on the callback. (Same method, different parameter. I'm 100% sure this has nothing to do with the bug).

So now I want to try and fix this product.

I tried reverting the purchase (even though it is a test purchase) inside Google Play.
I tried manually adding a restore button and clicking it.

Some info:

I am using Unity Codeless API.
Game is only available on android as of yet.
The bug originates from when I tried making a purchase, but (due to bad wifi) i managed to navigate to another screen before the GooglePlay popup came. This disrupted the callback somehow and probably flagged the purchase as "purchased but not completed" or something.
I store receipts from the products in my database so I can compare/ provide support for clients when purchases go sour. The purchase in question never arrived in my database. All corresponding purchases on the same product ID now fail with reason DuplicateTransaction
Consumable products are configured in Google play, online unity monetization console, in editor iap catalog. All are configured exactly the same 100%
The game is still in Alpha, soon going to Beta (once I fix this :)).

sentences:
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: 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:
Rotate character 180 degrees determine direction In my game it should be possible to rotate the character 180 degrees. I always want the character to rotate clockwise.

If the character is rotated 0 degrees and I press the rotate button, the character rotates clockwise to 180 degrees. However, if I know press the rotate button again, the character rotates to 0 degrees but doing so counterclockwise. How can I modify my code so that the character always rotates in a consistent direction?

One solution I've been thinking of is to do the rotaiton in steps like on first button press { 90, 180 } and on second {270, 0 }...

Any help would be greatly appreciated!

_currentTurnAroundAngle += TurnAroundSpeed*Time.deltaTime;

transform.rotation = Quaternion.Euler(0, Mathf.Lerp(transform.rotation.eulerAngles.y, _targetTurnAround, _currentTurnAroundAngle), 0);

if (transform.rotation.eulerAngles.y >= (_targetTurnAround - 0.1f) && transform.rotation.eulerAngles.y <= (_targetTurnAround + 0.1f))
{
    _currentTurnAroundAngle = 0;
    transform.rotation = Quaternion.Euler(0, _targetTurnAround, 0);
    _targetTurnAround = (_targetTurnAround == 0 ? 180 : 0);
    _isTurning = false;
}

sentences:
Where to store contiguous arrays of components? I've been working on an entity component system and have the trouble of where to define/put the arrays of each component type. Each component type is user defined so I do not know what or how many arrays to create so I am guessing I need to do something with templates.

This is what I have done so far with example usage. I am rather confused and not sure if what I have done so far is the way to go about this.

template<class T>
class Component
{
public:

    Component() = default;
    virtual ~Component() {};

private:

    friend class Entity;

    uint64 m_entity_id;

    static std::vector<T> COMPONENTS;

};

Example component:

class Velocity : public Component<Velocity>
{
public:

    ~Velocity();

    float get_x() const;

    float get_y() const;

private:

    float x;
    float y;

};

The idea is that this would create a static array for each component type. This feels like a weird way to achieve my goal but I can't think of any other way.

Have I missed an obvious solution to this problem?

sentences:
UDP non-blocking or a separate thread for receiving? I am creating a multiplayer game (for under 64 players). I already decided to have a separate thread for the network loop, but I was wondering if it would be better to create an extra thread for receiving UDP or set the receiving socket on non-blocking (without extra thread).

Or is it better to use another method like Asynchronous Sockets? Better methods are always welcome!

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:
Unwanted highlight on far side of objects near the edges of the screen when using orthographic camera I was creating a simple unity game with a sphere as a ball. The problem is that the ball face towards the camera origin renders material correctly but the one away from camera does not.  The ball has a standard material , the scene has directional light which faces in the camera's direction.The camera is orthographic and the background is solid.

Let me explain, in the material inspector window preview the ball is properly shaded from all sides as you can see. But in the game screenshot I have posted, the left half of the ball abruptly becomes lighter. Now this lighter shade is not because of the directional light or any other light source its because of the camera. because as I move near the camera center origin the original material shade returns but the farther I move the lighter shade nearly takes over half of the ball. I tried changing the camera rendering path to a vertex legacy lit and that solves the problem but I don't think that is the ideal solution. I am a newcomer to Unity and this is my first game. I tried going through the documentation but didn't find anything helpful. Any help will be greatly appreciated. :) .

sentences:
How is this glowing with colors radiating outward 2D effect accomplished? I'm currently totally at a loss as to how this effect is done:
http://www.youtube.com/watch?v=zp8MHUNp7Cg

The glowing on the ship and the changing color. I want to do this effect in XNA 4.0 any hints and tips?

sentences:
Can I develop a game for Kinect without a Kinect? I have to make a game in Unity3D using Kinect. The problem is I don't have the Kinect yet. I need to wait until they deliver it to me.

Can I imitate Kinect's movement for debugging my app?

sentences:
Minecraft Forge 1.8 Custom Recipe Manager, need help sorry for asking this question. Some of you will probably find it very easy but I just can't figure out how to do it.

I want to write a custom Recipe Manager. It has to check the recipes. Therefor I create an ArrayList<Item[]> recipes = new ArrayList();

The Item Array store 4 items(3 inputs and one output):Item[] items = {Item1, Item2, Item3, Item4};

I want to get a function that does this:

I give it a Item and it gives me an ArrayList containing all the Item[]s containing that Item as the 0th index and a Boolean that is true when there is any Item[] containing the Item.
Then I give (if needed to another function) an second Item. It returns me a new ArrayList containing all of the previous Item[]s that containe the Item and a Boolean similiar to 1 but for the 1th index.
Analog to 2. (I think you get what I mean).

The 3 points have to be handled in another method call.
Thank you very much in advance
Nova

sentences:
Triangle area selection using BVH raycasting Let's assume I'm already storing a BVH acceleration structure per mesh on my engine and I'd like start
making area selection like on many DCC tools out there, for instance, blender.
With blender you can do {rectangular, circle, lasso} selection to select faces and I'd like to understand the maths behind these algorithms. If I was using color picking techniques these sort of algorithms would be obvious but when using BVH+raycasting I'm still failing to understand the algo/maths behind it.
So, could you please explain the logic behind those? For instance, I assume rectangular selection should be easier to implement than circle/lasso, so how would you gather all screen projected triangles living inside the rectangular selection created by the mouse?

sentences:
How can I instantiate objects with gaps between all objects? When instantiate each a new object I want it to be with the same gaps from also the other instantiated objects.

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

public class GenerateStairsUnits : MonoBehaviour
{
    [Header("Stairs Units Prefab")]
    public GameObject stairsUnitsPrefab;
    [Space(5)]
    [Header("Settings")]
    [Range(1, 20)]
    public int numberOfUnits = 1;
    public static GameObject Unit;
    public int gap = 10;

    private int oldNumberOfUnits = 0;
    private List<GameObject> units = new List<GameObject>();
    private GameObject unitsParent;

    // Use this for initialization
    void Start ()
    {
        oldNumberOfUnits = numberOfUnits;

        unitsParent = GameObject.Find("Stairs Units");
        for (int i = 0; i < numberOfUnits; i++)
        {
            Unit = Instantiate(stairsUnitsPrefab, unitsParent.transform);
            Unit.name = "Stairs " + i.ToString();
            Unit.transform.localPosition = new Vector3(gap, 0, gap);
            units.Add(Unit);
            Unit.AddComponent<MoveObjects>();
        }
    }

    private void Update()
    {
        if (numberOfUnits < oldNumberOfUnits)
        {
            Destroy(units[units.Count - 1]);
            units.RemoveAt(units.Count - 1);

            oldNumberOfUnits = numberOfUnits;
        }
        else
        {
            for (int i = oldNumberOfUnits; i < numberOfUnits; i++)
            {
                Unit = Instantiate(stairsUnitsPrefab, unitsParent.transform);
                Unit.name = "Stairs " + i.ToString();
                Unit.transform.localPosition = new Vector3(gap, 0, gap);
                units.Add(Unit);
                Unit.AddComponent<MoveObjects>();
            }

            oldNumberOfUnits = numberOfUnits;
        }
    }
}

I tried in both places to add a localPosition with gap/s:

Unit.transform.localPosition = new Vector3(gap, 0, gap);

But they are still all at same position.

sentences:
10% idle time in WebGL I'm using requestAnimationFrame to handle my frame rate in a WebGL game, and running through the Chrome profile shows that a solid 10% of the time is spent in (idle).  Why is that?  How can I reduce this time, that, unless I'm misunderstanding, is just wasted?

I'm using raw WebGL. Here's part of my rendering code:

Animator.prototype.tick = function() {
  window.requestAnimationFrame(util.bind(this.tick, this));
  if (this.paused) return;
  this.advanceWorld();
  this.drawScene();
};

Full code at: https://github.com/nickgeorge/quantum/blob/master/animator.js

sentences:
How to play GameObject (ParticleSystem) and stop? Have a game where you've to shoot somethings and when you hit the GameObject I've should play. I've tried with Instantiate but I can keep shooting even if the gameobject is destroyed. What should I do in order to fix it?

 public GameObject particlesystem;

 void Start () {
    particlesystem= GameObject.Find("Effect");
 }

 void Hit(){
 Destroy(gameobject)
 Instantiate(particlesystem, transform.position, transform.rotation);
 }

This is how I handle it now, but as I wrote earlier I can keep activating the particle system.

sentences:
Is there a random command for Boolean variables in Unity C# Can you randomly choose a Boolean's value in Unity C#. I tried random.range, but it only works with floats. Here is an example of what I'm trying to do:

Boolean = (random boolean value command)(false, true);
if(Boolean = true){
    Debug.Log("It's true!")
} else{
    Debug.Log("It's false!")
}

Any ideas?

sentences:
How to manage special state in mecanim? I have a game in which there is a cat that has three states: On Ground, Going Up and Coming down.

This is handled by having 3 states, up,ground and down. Now, there is an additional requirement that the cat picks up a power up and becomes invincible. In this special state, the cat doesn't die if it falls through gaps etc. In this state also, there are same animation states : up, ground and down. However, when the cat is in this special state, it's sprite changes to a starry,shiny sprite.

So now we have two sets of animations : one normal, another power up. How can I manage these two sets?

sentences: How does my GPU know what game is running? I am trying to understand how game ready drivers work. How does my gpu know what application i am running and which application to use a specific driver optimization. For example the new nvidia driver makes some improvements to devil may cry 5 . how does my gpu know that I am running DMC 5. Is there a code in that application the driver recognizes? or does it not care what application i am using and treats every application the same.

sentences:
Tile-based game with DirectX - issues with transparency and StretchRect In my current project I have a class which loads a map file and then it should load all associated tilesets (no transparent tiles - I used to work with magenta as a colorkey) and precreate a surface for each static layer of the map so I only have to display one bigger image per frame rather then iterating over all of my tiles. For each tileset I have a loop which loads them successfully like this

 IDirect3DSurface9 *pTilesetSurface = nullptr;
 // Create surface
 HRESULT hResult = Engine::GetInstance()->GraphicsDevice->CreateOffscreenPlainSurface(
      pTileset->GetImage()->GetWidth(),
      pTileset->GetImage()->GetHeight(),
      D3DFMT_A8R8G8B8,
      D3DPOOL_DEFAULT,
      &pTilesetSurface,
      nullptr);
 if(!SUCCEEDED(hResult))
      return FALSE;

 // Load tileset
 std::wstring strTilesetSource(
      pTileset->GetImage()->GetSource().begin(),
      pTileset->GetImage()->GetSource().end());
 strTilesetSource = strPathToMap + strTilesetSource;
 hResult = ::D3DXLoadSurfaceFromFile(
      pTilesetSurface,
      nullptr,
      nullptr,
      strTilesetSource.c_str(),
      nullptr,
      D3DX_FILTER_LINEAR,
      D3DCOLOR_ARGB(255, 255, 0, 255),
      nullptr);
 if(!SUCCEEDED(hResult))
      return FALSE;

 this->m_vTilesets.push_back(pTilesetSurface);

After this loop I am iterating over every layer of the map and trying to build a surface for each layer with the associated tiles like this.

IDirect3DSurface9 *pLayerSurface = nullptr;
HRESULT hResult = Engine::GetInstance()->GraphicsDevice->CreateOffscreenPlainSurface(
    pLayer->GetWidth() * 16,
    pLayer->GetHeight() * 16,
    D3DFMT_A8R8G8B8,
    D3DPOOL_DEFAULT,
    &pLayerSurface,
    nullptr);
if(!SUCCEEDED(hResult))
    return FALSE;
Engine::GetInstance()->GraphicsDevice->ColorFill(
    pLayerSurface,
    nullptr,
    D3DCOLOR_ARGB(0, 0, 0, 0));
for(int x = 0; x < pLayer->GetWidth(); ++x) {
    for(int y = 0; y < pLayer->GetHeight(); ++y) {
        const Tmx::MapTile tile = pLayer->GetTile(x, y);
        if(tile.tilesetId != -1) {
            int dwTilesetWidth =
            this->m_pTmxFile->GetTileset(tile.tilesetId)->GetImage()->GetWidth() / 16;
            std::div_t tileCoords = std::div(tile.id, dwTilesetWidth);
            RECT srcRect = { tileCoords.rem * 16, tileCoords.quot * 16,
                tileCoords.rem * 16 + 16, tileCoords.quot * 16 + 16 };
            RECT destRect = { x * 16, y * 16, x * 16 + 16, y * 16 + 16 };
            Engine::GetInstance()->GraphicsDevice->StretchRect(
                this->m_vTilesets[tile.tilesetId],
                &srcRect,
                pLayerSurface,
                &destRect,
                D3DTEXF_NONE);
        }
    }
}

A call to D3DXSaveSurfaceToFile for debugging purposes creates transparent png files which can be layered correctly in Photoshop etc. but when I render these surfaces with this loop

for(auto iter = this->m_vLayers.begin(); iter != this->m_vLayers.end(); ++iter) {
    Engine::GetInstance()->GraphicsDevice->StretchRect(
        *iter,
        nullptr,
        Engine::GetInstance()->Backbuffer,
        nullptr,
        D3DTEXF_NONE);
}

then I have some wrong output which you can see here: .

All the blacks areas should be transparent such that one can see the layer below. Has anyone an idea what I might be doing wrong?

PS: I have read about the IDirect3DTexture9 and ID3DXSprite interfaces which could be helpful, but I haven't used them yet as I did not find any information on how to rebuild a map with tiles like I did here with usual surfaces. If anyone has suggestions about this, I would be glad to here them!

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 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:
2D Isometric Movement - Move to Mouse Position I'm developing a 2d isometric game on a engine made by myself (as a way to practice Java), however i'm stuck on what it seems to be a math problem.
I wish I could have some help on how to implement a 360 degree movement system based on Mouse Position, where the character angle will be the mouse angle, and the mouse angle is defined based on the center point the screen itself. The screen work like a compass, and where you click on it, it will set the angle and character should walk following said angle.
But trigonometry is by no means one of my strenghts, i'm struggling on how to determine the angle, then, how to set a formula to change the Y and X velocity based on the angle found.
Example, my native resolution is 512x288. Center point is 256x144. So, If I click in in the coordinate of X = 256 and Y is 0~144, the character should walk on a perfect stright line upwards. If Y is 145~288, then, a perfect line downwards.
Any help is welcome!
Edit: The camera is always fixed on the character, so it will always render on the middle of screen.
So far I've only managed to get basic movement through mouse by adding 8 hitboxes on screen, and set the angle based on which box the mouse clicked. For the speed, it's a hardcoded switch case on angle value, like, angle = 90, vel_x = 0, vel_y = -10.

sentences:
How to use HyperLink with Actor in Libgdx I am making a quiz game using LibGDX. I want it to redirect to a website. I am using classes like Text and Label that extends Actor to write text using a bitmap Font. I have no idea on how to provide a link (like anchors in html) in a native app. However, I am not very good at Android but know java well. In android , I saw on stackexchange, we can do so using Intent or string.xml configuration.

Can anyone suggest me a way to do so using Actor in libGDX?

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:
How can I test if an object will "fit" during pathfinding? I'm tinkering around with a 2d game where obstacles are polygons of arbitrary shapes, sizes and locations, and movable entities (players/enemies) can also be of arbitrary sizes.

What's a good general approach for detecting whether a given entity can "fit" between two obstacles during pathfinding? Basic graph-based pathfinding algorithms like Dijkstra's or A* typically involve merely a boolean (and possibly a weight). It's not immediately clear to me what's the best way of extending that to restrict narrow passages to small entities.

Presumably each entity size would need to have its own graph of the map?

I'm not familiar with the literature on this subject but I'm sure it exists - any pointers would be welcome.

sentences:
Having trouble running OpenGL on MSVC I'm using the  OpenGL Programming Guide, 8th Edition with MSVC 2013 but I can't get the triangles.cpp file to run.

These are the errors popping up:
http://puu.sh/jAokn/c07420cf46.png

sentences:
libgdx - Box2d debug draw not correct I have a problem where the bodies in my debug draw does not draw correctly, take a look:

As you can see, there is some space between the dynamic body and the ground. I have checked the contact listeners and they are indeed colliding, but with a space inbetween. The contact point is not drawn either, which gives the hint of some drawing error (?).

My PPM = 100. If I set it to 1, the problem disappears (dafuq), but that's not really feasable to have a 1 pixel/meter ratio. I have tried to play around with the cameras but without result. Here is a simplified snippet from my screen:

public class GameScreen implements Screen {

    private OrthographicCamera cam;
    private OrthographicCamera b2dcam;

    private World world;
    private Box2DDebugRenderer b2dr;

    private static final float PPM = 100;
    private static final int V_WIDTH = 160;
    private static final int V_HEIGHT = 90;

    public GameScreen() {
        cam = new OrthographicCamera();
        b2dcam = new OrthographicCamera();
        b2dr = new Box2DDebugRenderer();
        world = new World(new Vector2(0, -9.82f), true);

        /* ... create bodies etc ... */
    }

    public void render(float delta) {
        /* I actually use more complex fixed timestep - just simplified here */
        world.step(1/60f, 6, 2);

        // Render
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // Align the b2dr renderer to the camera
        b2dr.render(world, cam.combined.cpy().scale(PPM, PPM, 1));
    }

    public void resize(int width, int height) {
        float aspectRatio = (float) width / (float) height;
        float aspectRatio2 = (float)height / (float)width;

        // This is to maintain the same aspect ratio, using virtual screen-size
        if(aspectRatio >= (float) V_WIDTH / (float) V_HEIGHT){
            cam.setToOrtho(false, V_HEIGHT * aspectRatio, V_HEIGHT);

        } else {
            cam.setToOrtho(false, V_WIDTH, V_WIDTH * aspectRatio2);
        }

        cam.update();
    }
}

sentences:
Multiple Colour Gradient Lerp I want to return a colour for a position t, given an arbitrary number of colour stops - a stop is comprised of a position, and a colour.

Like selecting a colour from a multiple-colour gradient, linearly interpolated between stops.

Positions and point t are floating point numbers and can be negative. Positions and their respective colours are ordered lowest to highest in the arrays.

I would like to avoid conditional statements, as this is for use within a shader.

Code would ideally be in the form:

float3 MultiColorLerp(float positions[], float3[] colors, float t) {
    // Returns the color at the point t.
}

sentences:
Bounding Box in Monogame for mouse picking Hello guys so I'm implementing this mouse manager to be able to pick up objects.

My application uses mainly textured quads in 3d space.
I'm using bounding boxes in monogame to do so, however my solution lacks accuracy.

Right now what I have is this:
http://imgur.com/oySTCay

you can clearly see what the problem is, so this solution is probably not the best.

this is my method to calculate the bounding box:

        public BoundingBox GetBoundingBox()
    {
        Matrix transform = Node.GetTransformForBoundingBox();

        vertices[0] = Vector3.Transform(new Vector3(0, 0, 0), transform);
        vertices[1] = Vector3.Transform(new Vector3(Texture.Width * m_fTexturescale, 0, 0), transform);
        vertices[2] = Vector3.Transform(new Vector3(0, (Texture.Height * m_fTexturescale) * -1, 0), transform);
        vertices[3] = Vector3.Transform(new Vector3(Texture.Width * m_fTexturescale, (Texture.Height * m_fTexturescale) * -1, 0), transform);

        return BoundingBox.CreateFromPoints(vertices);
    }

And the mouse picking part is the standard ray tracing into near/far clipping planes with unproject.

So I was thinking, maybe if I do the other way around, and instead of un-projecting the mouse, i could project all the vertices and do some kind of polygon math to check if the mouse position is inside the polygon formed from the projected vertices, (occluded vertices are worrying me though).

Do you think is feasible, or is there any other option, should i just go for OBB?

Thanks alot,

Roger Martins

EDIT:

So after searching a bit for OBB's i found that CartBlanche had one implementation on his samples repo

this:
https://github.com/CartBlanche/MonoGame-Samples/blob/master/CollisionSample/BoundingOrientedBox.cs

so I just used it and it works pretty well, now i just have one bug that i cant figure out, one transformation must be wrong.¨

result : http://imgur.com/QOsIbj7

what i'm doing:
so now I have a box parameter in this class, nullable one.

how I build the bounding box :

  public SOrientedBoundingBox GetBoundingBox()
    {
        //create the initial bounding box
        if (obb == null)
        {
            //calculate the vertices for the textured quad in model space at the origin (inferior left corner is origin because we invert the y to conpensate for the perspective projection)
            vertices[0] = new Vector3(0, 0, 0);
            vertices[1] = new Vector3(Texture.Width * m_fTexturescale, 0, 0);
            vertices[2] = new Vector3(0, (Texture.Height * m_fTexturescale) * -1, 0);
            vertices[3] = new Vector3(Texture.Width * m_fTexturescale, (Texture.Height * m_fTexturescale) * -1, 0);
            //get bounding box and trasnform it to orientedboundingbox
            //TODO : remove the middle step
            BoundingBox box = BoundingBox.CreateFromPoints(vertices);
            obb = SOrientedBoundingBox.CreateFromBoundingBox(box);
            return obb.Value;
        }
        else
        {
            return obb.Value.Transform(Node.GetQuaternion(), new Vector3(Node.AbsolutePosition.X, Node.AbsolutePosition.Y * -1, Node.AbsolutePosition.Z)*Node.Scale);
        }

    }

I'm going to fiddle a bit more with it, but the problem is something minor, i think. But maybe one of you can detect something silly i did.

Thanks, Roger.

sentences:
Finding cells within range on hexagonal grid First up - I know I'm being super-dense here.

With that out of the way, I'm trying to write a C# implementation of this algorithm:

var results = []
for each -N ≤ dx ≤ N:
  for each max(-N, -dx-N) ≤ dy ≤ min(N, -dx+N):
    var dz = -dx-dy
    results.append(cube_add(center, Cube(dx, dy, dz)))

I've taken this from this tremendous resource.

My problem is that every implementation of this I've tried so far has had crazy results. For example, the code shown below currently results in this:

and this:

My code currently sits like this:

for (int x = this.CellPositionX - distance; x <= this.CellPositionX + distance; x++)
    {
        for (int y = this.CellPositionY - Math.Max(-distance, -x - distance); y <= this.CellPositionY + Math.Min(distance, -x + distance); y++)
        {
            HexPosition rangePosition = new HexPosition(x, y);
            range.Add(rangePosition);
        }
    }

Can anyone spot something awry here? All suggestions welcome. I've been banging my head on this one a while now.

Thanks!

Updated note: I am using Axial coordinates in the grid.
Update #2: as pointed out below, I had my for..each loop wrong and wasn't using deltas for the working out. Thanks for the help!

I currently have an issue as shown below with the implementation from the answers:

I'm going to keep investigating - if I figure it out I'll post the full results back here. Thanks all!

sentences:
Opengl the light position always on the origin point therefore the diffuse and specular does not work I am newbie of opengl, so I did the tutorial by learnopengl. I have a strange problem when I was trying to do the light effect (ambient, diffuse and specular).
For the diffuse, the effect appears on incorrect surface,and it seems like the light position always local on the origin point even I have change the position of it(the right cube position and the light position as the image shows):

I was also tried to add the specular in fragment shader but it also only appear on the left surface of that cube(the green arrow, that surface should not be lighten because now the vector is parallel the surface, so theoretically that surface should be black).
I have passed the light position and camera position to fragment shader of the cube (also the light fragment shader):

    glm::vec3 lightPos(0.0f, 2.5f, 3.0f);
    cubeShader->use();
    cubeShader->setVec3("lightPos", lightPos);
    cubeShader->setVec3("cameraPos", secondCamera->Position);

and the fragment shader is, as simply as the tutorial's example:

out vec4 FragColor;
in vec3 Normal;
in vec3 FragPos;
in vec3 lightPos;
uniform vec3 cameraPos;
uniform vec3 lightColor;
uniform vec3 objectColor;
void main()
{

    //ambient CONDITION
    float ambientStrength = 0.1;
    vec3 ambient = ambientStrength * lightColor;
    //diffuse CONDITION
    vec3 norm = normalize(Normal);
    vec3 lightDirection = normalize(lightPos - FragPos);
    float diff = max(dot(norm, lightDirection), 0.0);
    vec3 diffuse =  diff* lightColor;
    //specular CONDITON
    float specularStrength = 0.5;
    vec3 viewDirection = normalize(cameraPos- FragPos);
    vec3 reflectDirection = reflect(-1.0 * lightDirection, norm);
    float spec = pow(max(dot(viewDirection, reflectDirection), 0.0), 32);
    vec3 specular = specularStrength * spec * lightColor;
    //Result
    vec3 Result = (ambient + diffuse + specular) * objectColor;
    FragColor = vec4(Result, 1.0f);

}

Even I add the specular, the specular appears on the incorrect surface.
I was also refer this answer, thought it might be the transformation of model from camera to world by using inverse and transpose:

glsl directional light specular seems to be relative to origin not camera

However I did this in my vertex shader:

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
out vec3 Normal;
out vec3 FragPos;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform vec3 cPosition[10];

void main()
{
vec3 newPosition = cPosition[gl_InstanceID];
gl_Position =  projection * view  * model * vec4(aPos + newPosition,1.0);
FragPos = vec3(model * vec4(aPos +newPosition,1.0));
Normal = mat3(transpose(inverse(model))) * aNormal;
}

So in totally, the problem is, when the light position changed, the effect will not change because it only control by the "ghost" light which locals on the origin point.
Could you guys please tell me, why there is a light on the origin? Thanks!

sentences:
How to draw an image on canvas without html I'm trying to add a sprite to the canvas of my game. However, I don't want to use an image tag. However, I haven't found a way to do this no matter how hard I searched. Something like:

var image = 'sample.jpg'
draw(image)

sentences:
Sounds overlapping when playing too many at the same time I am pretty novice when it comes to game sound management, so excuse my ignorance.

I am having an issue when playing too many sounds at the same time where some sounds stop playing, or doesn't play at all, almost like some sounds overlap others. I've read some about the sounds using individual buffers and that there should be no problem playing these at the same time at runtime. When I only had a small ammount of sounds in the game, it all worked flawlessly. My SoundManager had no problem playing multiple sounds at the same time ( I loaded the sound to memory when I  was going to play it and disposed it when it was done playing, approx. 5 seconds).

My SoundManager Class

I've recorded a video to better illustrate what this sound problem is. As you can hear in the video below, the attacking sounds can only be heard at some points, as for some enemy sounds. The idling sounds of the enemies (breathing and bat sounds) seem to work without issues, though.

Video

Thank you for helping, because I have no clue how to fix this issue. Is there something that I've left out in my SoundManager?

sentences:
Pathfinding to unknown destination point Usually you need path finding algorithms to find one or the best path between two points. Do you know if path finding algorithm where you don't know the destination point exists?

I have a graph made of thousands of nodes, I'd like to pick one, and tell my path finding algorithm "find a destination node that is at least at N units of distance of my origin point".

Is it a common problem? How would you solve it?

Thanks.

sentences:
GLES2 GL_BGR undeclared? I tried to bind a bitmap texture. This bitmap is BGR format, and I'm trying to use
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_BGR, GL_UNSIGNED_BYTE, data), but during compile, error: 'GL_BGR' undeclared appears.

I checked <GLES2/gl2.h> and <GLES2/gl2ext.h>, but there isn't any GL_BGR
. Is there any way to upload BGR format?

sentences:
Replacement memory allocators - pros and cons I am developing a hobby project to learn game engine development and to have a platform where I can test new ideas and have fun. Currently I have a quick-and-dirty multiplayer server and client using some third party libraries (enet for networking and Ogre3D for rendering). My "game" is mostly like a free-ride sandbox.

I have read some great articles about custom memory allocators and all the benefits - complete control, different strategies for different game objects, tracing and profiling. But also I have read that it is hard to develop an allocator which is better than the default one and that it might be hard to get it to play nicely with 3rd party libraries.

As it seems so hard to develop a custom allocator, I thought about using jemalloc but I'm not sure if it is a good choice for game server and/or client.
I tried to find some 3rd party free/open source memory allocators designed specifically for game engines but I could not find anything production-ready.

I really would like to track allocated objects by their type - to see how many network packets I have, how much memory is taken by meshes, static objects, NPCS etc. and also to see where exactly are some memory leaks coming from. Also I would like to avoid having to restart my game server regularly because of memory fragmentation issues.

What is your experience? Is it a good idea to use some general purpose memory allocator (like jemalloc or tcmalloc) for game servers and clients or should I develop my own custom allocator (which seems a daunting task considering that I don't have enough experience with advanced C++)?

How do I integrate my custom memory allocator with popular 3rd party libraries (enet, Ogre3D, some physics libraries) if I have no idea what allocation mechanisms are used inside of those libraries?

If I decide not to use a custom allocator and stay with the one provided by MSVC runtime, is there any simple way to track my memory usage and prevent memory fragmentation without sacrificing performance?

sentences:
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:
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:
Handling collision with LWJGL rectangles I'm testing collision with other rectangles so I can implement it into my current project. The problem is the rectangle starts at the right x and y, but I'm not sure where exactly they are. I'm pretty sure they're starting from the x and y point and the height is going either up and down. My current ortho makes the y axis start from the bottom of the screen but I'm not sure how their rectangle calculates. How can I improve this class so for each side the bottom rectangle touches, it turns a certain color to identify collision.

public class a {

    static int playerX = 400;
    static int playerY = 400;

    static int enemyX = 100;
    static int enemyY = 100;

    public static void main(String[] args) {
        try {
            Display.setDisplayMode(new DisplayMode(640, 480));
            Display.setTitle("collision");
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
            Display.destroy();
            System.exit(1);
        }

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0, 640, 0, 480, 1, -1);
        glMatrixMode(GL_MODELVIEW);

        Rectangle rl = new Rectangle(playerX, playerY, 10, 20);

        Rectangle r2 = new Rectangle(enemyX, enemyY, 200, 10);

        float c2 = 0;//color

        while (!Display.isCloseRequested()) {
            glClear(GL_COLOR_BUFFER_BIT);
            rl.setX(playerX);
            rl.setY(playerY);

            r2.setX(enemyX);
            r2.setY(enemyY);

            if(rl.intersects(r2))
            {
                c2 = 1f;
            } else if(!rl.intersects(r2))
            {
                c2 = 0f;
            }

            if(Keyboard.isKeyDown(Keyboard.KEY_A))
                playerX -= 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_D))
                playerX += 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_W))
                playerY += 1;
            if(Keyboard.isKeyDown(Keyboard.KEY_S))
                playerY -= 1;

            System.out.println(playerY-100);

            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

            glColor3f(0, 1, 0);

            //PLAYER

            //l
            glBegin(GL_QUADS);
            glVertex2f(playerX, playerY     -10      );
            glVertex2f(playerX + 10, playerY    -10  );
            glVertex2f(playerX + 10, playerY - 100    );
            glVertex2f(playerX, playerY      - 100    );
            glEnd();
            //r
            glBegin(GL_QUADS);
            glVertex2f(playerX + 100, playerY   -10           );
            glVertex2f(playerX + 110, playerY        -10      );
            glVertex2f(playerX + 110, playerY - 100            );
            glVertex2f(playerX + 100, playerY      - 100       );
            glEnd();
            //top
            glBegin(GL_QUADS);
            glVertex2f(playerX + 10, playerY     -9               );
            glVertex2f(playerX + 100, playerY       -9       );
            glVertex2f(playerX + 100, playerY - 20          );
            glVertex2f(playerX + 10, playerY      - 20           );
            glEnd();
            //bot
            glBegin(GL_QUADS);
            glVertex2f(playerX + 10, playerY          -90          );
            glVertex2f(playerX + 100, playerY    -90          );
            glVertex2f(playerX + 100, playerY - 101        );
            glVertex2f(playerX + 10, playerY      - 101         );
            glEnd();

            glColor3f(c2, 1, 0);
            //ENEMY
            glBegin(GL_QUADS);
            glVertex2f(enemyX, enemyY);
            glVertex2f(enemyX + 200, enemyY);
            glVertex2f(enemyX + 200, enemyY - 10);
            glVertex2f(enemyX, enemyY - 10);
            glEnd();

            Display.update();
            Display.sync(60);
        }
        Display.destroy();
        System.exit(0);
    }

}

I just made it so OpenGL set its position to the rectangle instead of the rectangle to OpenGL.

sentences: detect asset change while running in unity editor? Is it possible to detect asset change while running in the unity editor.  When I update my model, I see it change but the xml data associated with it does not change.  So it would be nice to detect that and reload the xml data while running in the unity editor.

sentences:
Lighting problems with Terrain I'm in the process of learning Open GL and am having issues with lighting on my Terrian, I don't know if the issue is related to how I calculate my normals or the shader itself (I am using the shader from the Open GL wikibook - Lighting Arc tutorial 1). I calculate the normals like this:

void Terrian::construct_normals()  {
    terrian_normals.reserve(width * height);

    for (int i = 0; i < terrian_elements.size() / 3; i++)  {
         int index1 = terrian_elements.at(i * 3);
         int index2 = terrian_elements.at(i * 3 + 1);
         int index3 = terrian_elements.at(i * 3 + 2);

         glm::vec3 side1 = terrian_vertices.at(index1) - terrian_vertices.at(index3);
         glm::vec3 side2 = terrian_vertices.at(index1) - terrian_vertices.at(index2);
         glm::vec3 normal = glm::cross(side1, side2);
         normal = glm::normalize(normal);

         terrian_normals.emplace_back(normal);
         terrian_normals.emplace_back(normal);
         terrian_normals.emplace_back(normal);
    }

    std::cout << "Terrian Vertices: " << terrian_vertices.size() << "\nTerrian Normals: " << terrian_normals.size();
}

And the vertex shader can be viewed here:

http://pastebin.com/3vU8SHvK

Here's what the terrain looks like:

If you would like me to post any more of my code I would be happy to do so.

Edit:

Vertices:

void Terrian::construct_vertices()  {
    terrian_vertices.reserve(width * height);
    terrian_colors.reserve(width * height);

    std::cout << "Generating data\n";

    for (int y = 0; y < height; y++)  {
        for (int x = 0; x < width; x++)  {
            int i = x + y * width;

            terrian_vertices.emplace_back(glm::vec3(x, terrian_heightmap[y][x], -y));
            terrian_colors.emplace_back(Color(0.0, 1.0, 0.0, true));
        }
    }
}

and elements:

void Terrian::construct_elements()  {
    terrian_elements.reserve((width - 1) * (height - 1) * 6);

    for (int y = 0; y < height - 1; y++)  {
        for (int x = 0; x < width - 1; x++)  {
            GLushort bottom_left = x + y * width;
            GLushort bottom_right = (x + 1) + y * width;
            GLushort top_left = x + (y + 1) * width;
            GLushort top_right = (x + 1) + (y + 1) * width;

            terrian_elements.emplace_back(top_left);
            terrian_elements.emplace_back(bottom_right);
            terrian_elements.emplace_back(bottom_left);

            terrian_elements.emplace_back(top_left);
            terrian_elements.emplace_back(top_right);
            terrian_elements.emplace_back(bottom_right);
        }
    }
}

sentences:
Algorithms for Automated Game Levels Creation ( 2D )? I am trying to algorithmically create a game like the one in the picture below

I am trying to Create random levels from an algorithm.

Ideally, the algorithm will take into account the desired difficulty size and the board size ( N x N ) and produce a random map based on those 2 things.

I personally don't know how to determine difficulty in this game nor how to mathematically model it.

sentences:
Sprite quickly disappears after rendering I'm currently making space invaders and I'm using the game loop pattern as described here. I have an entity class from which there is a spaceship derived class. The base entity class contains all of the general entity data such as the x/y position, speed, etc...
Currently, I have the X and Y positions initialized to (0,0) so the spaceship is rendered in the center of the screen. I tried initializing the y position to a different coordinate corresponding to a position, but for some reason, the spaceship just keep moving vertically as if the y position is just being accumulated at each frame. I think the problem is caused by the fact that in my render() method of the spaceship class, I'm translating the modelmatrix with the x and y position of the spaceship as that would explain why there isn't vertical movement when the coordinates are (0,0). I'm not sure exactly if this is the proper way to structure the render() method but I couldn't think of another way to change the object's position. Below is the relevant code:
Spaceship class definition:
class Spaceship : public Entity {
public:
    Spaceship(float xDirect, float yDirect,
        float xPosition, float yPosition, float speed, float rState, ShaderProgram* program, SheetSprite newSprite, bool movingLeft, bool movingRight):
        Entity(xDirect, yDirect, xPosition, yPosition, speed, rState, program, newSprite), movingLeft(movingLeft), movingRight(movingRight)
    {
        posY = 0.1;
    }

    virtual void Update(float elapsed) {
        // move stuff and check for collisions

        if (movingLeft) {
            posX -= elapsed* 0.001;
        }

        else if (movingRight) {
            posX += elapsed * 0.001;
        }
    }

    virtual void Render() {
        setOrthoProj();
        setObjMatrices();
        translateObj(posX, posY, 0.0);
        mySprite.Draw();
    }
    bool movingLeft;
    bool movingRight;
};

Initialization Code in main
Spaceship* spaceship = new Spaceship( 1.0f, 1.0f, -5.1f, 0.0f, 3.0f, 0.0f, program,mySprite, false, false);
    spaceship->Render();

Game Loop movement code
    const Uint8 *keys = SDL_GetKeyboardState(NULL);

    if (keys[SDL_SCANCODE_LEFT]) {
        spaceship->movingRight = false;
        spaceship->movingLeft = true;
        spaceship->Update(elapsed);

    }
    else if (keys[SDL_SCANCODE_RIGHT]) {
        spaceship->movingLeft = false;
        spaceship->movingRight = true;
        spaceship->Update(elapsed);

    }
    spaceship->Render();

For some reason, the first render() call outside of the loop isn't rendering the spaceship, only the one inside the loop works.
Given the structure of the program, what could be causing the problem?
EDIT
Translate method from Entity base class
void translateObj(float x, float y, float z) {
        posX = x;
        posY = y;
        modelMatrix.Translate(posX, posY, 0.0);
    }

void setObjMatrices() {
        glUseProgram(program->programID);
        program->setModelMatrix(modelMatrix);
        program->setProjectionMatrix(projectionMatrix);
        program->setViewMatrix(viewMatrix);

    }

sentences:
Comparing a saved movement with other movement with Kinect I need to develop an application where a user (physiotherapist) will perform a movement in front of the Kinect, I'll write the data for the movement in the database and then the patient will try to imitate this motion. The system will calculate the similarity between the movement recorded and executed.

My first idea is to store the position of the recorded points and then compare them in the execution time to the patient's movement. I know that this approach is too simple, however, because I imagine that in people of different sizes the skeleton is recognized differently, so the comparison is not reliable.

My question is about the best way to compare a saved motion with a movement executed (on the fly).

sentences:
Advice for programming a lobby for a network multiplayer game? I'm working on learning network programming. I'm working on a simple card game. The basic idea is:

Players enter the lobby
Players see tables
Players sit at an empty seat

Once they sit, they do not need any information from the lobby, they see the card table and the data about the other players and so forth.

I've programmed the server portion for the game itself. The clients connect to my server object and the server then receives and sends messages; quite simple.

The tricky concepts for me are:

What's a good way to run many tables at the same time?
What's a good way to keep the lobby consistently updated for each person in the lobby (eg: MSG_TABLE_FILLED, 22)

Ideally I'd like to have 1 server exe for all of this and to have to deal with multithreading as little as possible.

I'm going to use the enet library.

I was thinking that each time a game session starts, I push a new Game and I map the client IPs to that table, then I just route messages from those clients to that Game.

Since enet supports channels I was thinking of using 2 channels per table, one for the game messages and one for in game chat.

Would something like this work?

Does anyone have any advice / design ideas for a game with a lobby and many tables?
Is there a usual way this is done that I'm overlooking?

Any conceptual ideas or even c/c++ code examples would be very helpful.

Thanks

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: What advantages does DirectX 11 have over DirectX 10? What advantages does DirectX 11 have over DirectX 10?  Most of the new features seemed to be for directcompute from what I can tell, and how much more are you limiting your market by if you use DX11 compared to DX10 (assuming you don't add DX10 support).

sentences:
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: Can names of abilities or spells within a game be trademarked/copyright? Okay, say I want to create an RPG similar to and takes inspiration from such games as Final Fantasy, The Elder Scrolls, Shin Megami Tensei, Pokemon, etc. and I would like to use familiar names in some cases because the names simply fit from a design perspective (like from anything as mundane-but-aptly-named as "Water" or "Waterfall" to something like "Ultima" or "Souleater"). For the sake of the question I want to make it clear I'm not attempting a parody or the sort (it's going to be its own franchise), just most ability/spell names I can think of tend to come from video games or board games I've played.

sentences:
How long to display each sentence? When creating a sequence where text advances automatically, is there a metric which will allow me to calculate a reasonable duration to display each "sentence"?

My intuition tells me that because of the way we read, the number of words is probably more relevant than the number of characters, but I'm curious what people may have already figured out about this problem.

sentences:
Unity test/Play mode window problem I tried to find an answer to his problem but i wasn't successful. When i press play to test my game, instead of the play mode going to the Game tab and play the game there, with all the unity tabs and options still on the screen, it goes almost full screen, all of the unity window goes to the game mode and i can't see anything but the game, to see the scene, options, etc.. again i need to stop the play mode. For example, if i want to test triggers in play mode, i can't because all i see is the game window. How can i test the game just in the Game tab? Perhaps i changed some setting.

I'm not sure if im explaining my problem correctly.

Thank you

sentences:
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: Better ways of handling the server for a Multiplayer Browser Based Game I am looking to create a multiplayer browser based game, similar to tribal wars and such, and i'm trying to think of better ways of handling the server, for example when troops and buildings are completed and the landing of troop movements

sentences:
2-Color Fonts in Unity? (so maybe called 3-Color including transparent alpha?) I have been trying to make my game title screen look better. I realised it was because all my fonts have just one colour.
I read some very old threads about a Editor Scripts to extract the font to png format. I then see there is now a way to do it in the 'hamburger' menu of the Font in Inspector.
I had to change my font to be not 'Dynamic' then it allowed me to extract a copy to PNG. I opened this in GIMP and added my white inside the outlines of each character (it had been alpha before this, giving a horrible see-thru effect on the letters).
I put this back into Unity (the new PNG) and used it as the source texture for my Text Shader. However it is still not handling both colours. (Screenshot below). So what can I do using Unity 2020 to achieve better looking text? I've read this: (https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html) and many other pages on Unity site but I am now going around in circles not achieving anything.
Thanks for any help.

EDIT: Since DMGregorys comment. I am posting picture of my import settings on the modified (coloured-in) font PNG file:

EDIT 2: The 3rd screenshot shows the 'Text' objects settings. Note I have changed Material to be my extracted one. 4th screenshot shows that Material's settings
enter image description here

sentences:
How to determine the point of intersection of two lines? I have two lines say P1( 0, -1, 0, -1 ) and P2( -1, 0, 0, -1 ). Since I'm working in 2D, there is no Z component. The x,y,z components are normals and the w component is the distance from origin. I am not given the origin or any points on the line.

What method should I use to programmatically determine the point of intersection for these two lines?

sentences:
How to make a top down shooter? I want to know is with XNA 4.0 (and C#) How do I exactly make a top down shooter? I have been looking for ages, but have been unable to find out how.

If someone could tell me how to get started with it or possibly link me to a good easy to understand tutorial that would be fantastic!

sentences:
fbx file asks for fbm file in xna? I downloaded a bat model from the internet and I went to Blender, used texture and shading as I want, then I exported it as a fbx file. Next I placed it into my content pipeline and ran it but it is asking me for the path of a .fbm file. It says Error Missing asset

  C: ...._Game\obj\x86\Debug\FBX\387D35A3\bat.fbm\wpn_fps_mel_barbedwire_df.dds

What does this mean. How can I place these images in that file like that?

sentences:
Project 3D points to a plane, then project their bounding box back to 3D I have a table in 3D space, represented by a plane.

I want to project arbitary points representing an object (cup, toy, etc) onto that table, run 2D principal components analysis to get an oriented bounding box (https://www.sciencedirect.com/topics/computer-science/oriented-bounding-box)

This gives me 2D oriented bounding boxes (defined by 8 corner points) that lie along the table plane. Now, I want to project these points back to 3D somehow so I can get 3D bounding boxes that are aligned with the plane.

The projection from 3D to 2D plane is not invertible.. so how do I do this?

sentences:
How can I find a position between 4 vertices in a fragment shader? I'm creating a shader with SharpDX (DirectX11 in C#) that takes a segment (2 points) from the output of a Vertex Shader and then passes them to a Geometry Shader, which converts this line into a rectangle (4 points) and assigns the four corners a texture coordinate.

After that I want a Fragment Shader (which recieves the interpolated position and the interpolated texture coordinates) that checks the depth at the "spine of the rectangle" (that is, in the line that passes through the middle of the rectangle.

The problem is I don't know how to extract the position of the corresponding fragment at the spine of the rectangle. This happens because I have the texture coordinates interpolated, but I don't know how to use them to get the fragment I want, because the coordinate system of a) the texture and b) the position of my fragment in screen space are not the same.

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:
How to replicate Unity's Rigidbody.AddForceAtPosition in C++? I am trying to replicate the function Rigidbody.AddForceAtPosition of Unity in C++, it means, to apply force to a body offset from its center.

How could I achieve that in C++?

sentences:
Correct way to integrate scaled axis angular velocity into a quaternion Across my travels on the internet I have came across two different ways of integrating a scaled axis angular velocity into a quaternion.

The first way converts the angular velocity into an axis angle quaternion like so

Quaternion q = new Quaternion(vector.normalised(), vector.getLength());

Where the constructor looks like:

float sinHalfAngle = (float) Math.sin(angle / 2);
float cosHalfAngle = (float) Math.cos(angle / 2);

this.x = axis.x * sinHalfAngle;
this.y = axis.y * sinHalfAngle;
this.z = axis.z * sinHalfAngle;
this.w = cosHalfAngle;

And then multiplies the existing quaternion by that new quaternion

this.rotateSelf(q);

The second approach also converts the velocity into a quaternion, but uses a different method:

Quaternion change = Quaternion.mul(
    new Quaternion(x * 0.5f, y * 0.5f, z * 0.5f, 0),
    this
);

It then adds the quaternions together, scaled by delta T:

this.w += change.w * scale;
this.x += change.x * scale;
this.y += change.y * scale;
this.z += change.z * scale;

Both approaches produce a rotation, however the first approach rotates the object much faster than the second. I was wondering which is the 'more' correct way, or if they are just different methods used for different units perhaps? (ie: degrees vs radians?)

Thanks very much if you can help.

sentences:
player keeps on firing (Javascript + Canvas) I'm brand new to game development (with Javascript)... I'm pretty sure my question is very simple, but I have a hard time to figure out myself... I'm starting at the very beginning, so this is pretty simplistic.

This is my whole code in javascript:

var fire = false;
function keyUp(evt) {
  switch (evt.keyCode) {
     case SPACE:
        fire = false;
     break;
     ...
  }
}
function keyDown(evt) {
  switch (evt.keyCode) {
     case SPACE:
        fire = true;
     break;
     ...
  }
}
function update() {
    ...
    if (fire) {
        playerHasShot = true;
        shot.x = player.x + player.w;
        shot.y = player.y + (player.h / 2);
        shot.vx += 2;
    }
    if (!fire) {
        playerHasShot = false;
    }
   ...
    shot.x += shot.vx;
   ...
    //Bullet
    if (playerHasShot) {
        playerHasShot = false;
    }
    if (!playerHasShot) {
        playerHasShot = false;
    }
    ...
    if (shot.vx > 4) {
        shot.vx = 4;
    }
    ...
    if (shot.x > canvas.width) {
        shot.x = player.x + player.w;
        shot.y = player.y + (player.h / 2);
        playerHasShot = false;
    }
    ...
    render();
    renderShot();
}

I hit the spacebar once, and that guy can't stop shooting... Would any of you mind telling me how to stop him, please ? I'm sure I'm close, but there's something I'm missing somewhere.... Thanks! :)

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:
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:
Missing shadow: why? In these scene, i can't figure why, my player, and object it place, can't cast shadow on floor.

All other static objects in scene cast shodow correctly.

There is a floor with it's material, then there is also a Reflection probe.

Is Reflection Probe something that influence shadow cast correctly ?

Follow, floor proprieties

Floor material proprieties:

My Lights:

My scene:

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:
Superclassing RPG Game Entities I am in the design process of an RPG game and I have no experience at all in game dev.
This question is about how I should approach entity management using OOP classes.

My train of thought is as followed:

Have Entity interface with basic update() function
"Mortal" class and "NPC" class implement Entity
"Hero" and "Monster" class inherit from "Mortal" class

In this case, Mortal class are all those entities that have statuses such as HP and MP.
NPC are self explanatory.

I am sure my approach is naive so I would like to know the pros and cons and what would be a better way to approach this.

sentences:
GL_INVALID_OPERATION on glBindVertexArray Despite glGenVertexArrays() so I've been trying to create a simpler way to draw polygons and and have come across the following issue:

When I call glBindVertexArray(m_VAO); it throws a GL_INVALID_OPERATION even though I have previously called these functions:

glGenVertexArrays(1, &m_VAO);
glBindVertexArray(m_VAO);

Why does this happen? The only description for this error officially is that I failed to call the lines above.

Here is the source with any relevant parts. Please note that I have the error pop up the line after this one, but it might be because of this current error.

Polygon::Polygon(const std::vector<GLfloat>& vertexArray,
         const char* vertShaderPath,
         const char* fragShaderPath)
    :m_vertexArray(vertexArray)
{
    // Created and linked shaders here...
    // ...
    // ...

    // Generate and bind vertex array object.
    glGenVertexArrays(1, &m_VAO);
    glBindVertexArray(m_VAO);

    // Generate and bind vertex buffer object.
    glGenBuffers(1, &m_VBO);
    glBindBuffer(GL_ARRAY_BUFFER, m_VBO);

    //Send verticies to buffer's memory.
    glBufferData(GL_ARRAY_BUFFER,
         m_vertexArray.size() * sizeof(GLfloat),
         &m_vertexArray[0],
         GL_STATIC_DRAW);

    // Set up vertex attributes.
    glVertexAttribPointer(0,
              3,
              GL_FLOAT,
              GL_FALSE,
              3 * sizeof(GLfloat),
              (GLvoid*)0);

    // Enable the attributes at layout position 0.
    glEnableVertexAttribArray(0);

    //Unbind VBO and VAO.
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);
};

// Destructor
Polygon::~Polygon()
{
    // De-allocated resources
    glDeleteVertexArrays(1, &m_VAO);
    glDeleteBuffers(1, &m_VBO);
}

void Polygon::draw()
{
    glUseProgram(m_shaderProgram);
    check_gl_error();
    glBindVertexArray(m_VAO); // GL_INVALID_OPERATION here
    check_gl_error();
    glDrawArrays(GL_TRIANGLES, 0, m_vertexArray.size()); // GL_INVALID_OPERATION here
    check_gl_error();
    glBindVertexArray(0);
    check_gl_error();
}

Let me know if you need any more info. Thanks!

sentences:
Fast, accurate 2d collision I'm working on a 2d topdown shooter, and now need to go beyond my basic rectangle bounding box collision system.

I have large levels with many different sprites, all of which are different shapes and sizes. The textures for the sprites are all square png files with transparent backgrounds, so I also need a way to only have a collision when the player walks into the coloured part of the texture, and not the transparent background.

I plan to handle collision as follows:

Check if any sprites are in range of the player
Do a rect bounding box collision test
Do an accurate collision (Where I need help)

I don't mind advanced techniques, as I want to get this right with all my requirements in mind, but I'm not sure how to approach this. What techniques or even libraries to try. I know that I will probably need to create and store some kind of shape that accurately represents each sprite minus the transparent background.

I've read that per pixel is slow, so given my large levels and number of objects I
don't think that would be suitable. I've also looked at Box2d, but haven't been able to find much documentation, or any examples of how to get it up and running with SFML.

sentences:
Identifying quad patterns in a two-dimensional array In the tech demo I'm trying to make, tetrominoe-style blocks will be placed by the player, at which point the game checks to see if they've made a quad with any existing shapes on the board (a 2D array). If so, the quad should be processed in some way.

I have a 2D array like so:

[ [0, 0, 0, 1, 1, 1],
  [0, 1, 1, 1, 1, 1],
  [1, 0, 0, 1, 1, 1],
  [1, 0, 0, 1, 0, 1] ]

And I need to identify 'quad' patterns such as that in the top-right corner, e.g.

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

I'm not sure of the best way to do this. I've had a look at some two-dimensional array pattern matching algorithms, which all seem to flatten the 2D array into 1D, then use a 1D text searching algorithm (e.g. KMP) to identify any matches. My problems with that idea are that the quad can be any size, as long as it's rectangular and bigger than an arbitrary minimum (in my case, 2 x 2).

I also thought about using some variant of the 4 way flood fill algorithm or connected-component labelling, for each position of the newly-place tetrominoe. But I'm not quite sure how to best follow the path out and establish the bounds of a quad (for example, capturing this:

[ [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1] ]

out of this:

[ [1, 1, 1, 1],
  [1, 1, 1, 0],
  [1, 1, 1, 0] ]

My latest though is perhaps a floodfill to get all interconnected parts after a tetrominoe lands, then 'round off' the jagged edges, maybe by checking the number of neighbours of each block, if it's 1, remove it, repeating the process until all remaining blocks have 2 or more neighbours. But this seems like it could be slow.

Has anyone any experience of this problem, or any pointers about how best to accomplish this task? I'm sure there's a common or at least applicable algorithm, I just don't know it!

sentences:
Is there any API that returns information about "all games"? I'm building a project about games and I need to make a "portfolio" of games.

Something like a catalog of Netflix, but about games, and I need some basic information about the game, like Publisher, Genre, Developer, Release Date and some more information.

Someone know a free API that returns the date that I need? I tried Steam API, but doesn't work for me.

Obs: Returns a JSON.

sentences:
Soccer national teams uniforms and copyright when developing a soccer game I have a project to be accomplished in a distant future about a soccer game.
I´ve read that you can´t feature the actual national teams uniforms without getting permission from FIFA.
Is this only for special designs or for jerseys which are a single colour (most of them) too?
Can you copyright a color? From what I know, most copyright laws don´t allow for a single colour or color combinations to be registered, but maybe in the context of a specific sport and specific teams it is allowed.

PS: thanks, when and if this gets commercially serious, I will seek legal advice.
To be more precise, by presenting a team as Germany with a white shirt and black pants, no logo, no real player names and no real stadiums, do you think that would be considered a copyright infringement?

PS2: the RGB knob approach is what I thought of for teams created by each user. But also though it would be nice to have a special competition which would be a world cup.

sentences:
What is the cleanest way to code predictable client/server components Lots of classic games that I've read the source code to do things like

if (clientside)
    // ...

or the same but with serverside. The code is littered with this and it becomes an extreme nightmare to test. This is especially so when the games I've looked at all happen to use global variables for the above so testing goes out the window, and I am fortunate enough to be able to write tests for such things (hobby projects with no time constraints!)

I'm at a point where I need to care about this now (especially with having to deal with prediction and actions, scripts, etc, in a level). As such, I've gone searching for how people architected solutions to this problem such that there was the ability to have clientside prediction of some stuff, while preventing the code from becoming a gigantic series of if statements strewn about everywhere.

What is the best way to approach this? I am willing to trade a bit speed for clean code with good OOP. Is there a good example that I can learn from? Or am I stuck with littering if (client/serverside) everywhere?

Ideally I want to write the least code possible, write it in the cleanest way possible, and have something that I can easily reason about without having a ton of branching thinking "ok what if condition A, not B, C and D, not E" when trying to figure something out.

I've been trying to see if there's a way to make some kind of common base class which shares all the code between them, and then making a bunch of abstract methods that either the Client implementation or Server implementation would do their own stuff on top of it, but part of me is worried that because I've neither done anything like this before nor seen anyone ever do it this way, I'm scared of wasting a significant amount of time on something that may be architecturally bad. This is primarily why I'm posting this.

In short: What is the cleanest way to architect the code? Are there any examples or articles I can learn from?

Edit: The code should all be in one binary, so people can host a multiplayer server from an offline experience.

Note: This question is completely different from how to do prediction, unlagged, etc, and as such is not about that (and I already know exactly what I need to do). It's about the implementation of such things such that I can write a client that supports predicting and server code that reduces the amount of duplication as much as possible.

sentences:
Starting Couroutine in newly activated gameObject I'm working on a UI system that animates an element's properties using coroutines. Every element that should be animated has a component called AnimatedUIElement which provides the function Enter().
The function Enter() is basically starting coroutines depending on the chosen animation settings, but only after calling Enable(), which sets the gameObject active with gameObject.SetActive(true);, updates its component references and makes the element interactable.
AnimatedUIElement also defines an Exit() function acting similar, but disabling the element after the animation.

public class AnimatedUIElement : MonoBehaviour {
    private CanvasGroup canvasGroup;
    // ...

    public void Enter() {
        // ...
        TriggerEntry();
    }

    private void TriggerEntry() {
        PlayChildrenEntry(); // Calls Enter() on all animated Children
        Enable();
        StartCoroutine(SomeAnimation(...));
    }

    private void Enable() {
        gameObject.SetActive(true);
        Init();
        canvasGroup.interactable = true;
        canvasGroup.blocksRaycasts = true;
    }

    private void Init() {
        canvasGroup = GetComponent<CanvasGroup>();
        // ...
    }

    private IEnumerator SomeAnimation(...) { ... }

    public void Exit() {
        // Similar to Enter, but disabling the element
    }
}

Now I want to open the options panel by clicking a button in the game's UI. The panel is inactive (unticked) in the beginning, while the AnimatedUIElement component is enabled.

UI Hierarchy: Options Button calls Enter() on Options Panel.

The desired setup in the Button Component calling OptionsPanel.Enter() and MainPanel.Exit()

But clicking the button throws the following exception:

Coroutine couldn't be started because the the game object 'Main Menu Button' is inactive!
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AnimatedUIElement:AnimatePosition(Vector2, Vector2, Single, AnimationCurve) (at Assets/Animated UI Elements/AnimatedUIElement.cs:265)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:93)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
AnimatedUIElement:PlayChildrenEntry(Transform) (at Assets/Animated UI Elements/AnimatedUIElement.cs:219)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:79)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
UnityEngine.EventSystems.EventSystem:Update()

In this stack trace you can see that the Options Panel did not start coroutines as no animation was defined in its component, but called Enter() on its children, which are animated.

Using debug logs I found out that, while Init() is called immediately after Enter(), Awake() is called after the coroutines (which happen later in the program flow) throw errors. This makes it seem like the object is not available instantly after calling setActive(true).

Is there an explanation and possibly a fix for this behavior?

sentences:
Spriting Animation Method http://www.kickstarter.com/projects/539087245/spriter

At 3:00 they discuss that there is a method used to separate the parts of character into individual sprites and move them saving production time and video memory. What is this method called I am thinking that I want to implement it for my game but need to do more research.
Thanks alot =)

sentences:
Unity - Static Camera Perspective, Walls Obscure Player Pretty simple and common problem here.
The world I'm designing is fully explorable, no invisible walls or tricks. It's presented as a single seamless area, a School complex with 9 buildings, some of which have 2 or 3 floors and contain many rooms.

The perspective I've chosen is simple, inspired by topdown RPGs:

A problem arises with walls. They obscure the player.

I've tried some shaders which draw a silhouette of the player ontop but I don't like this approach, other objects and decoration remains obscured behind the wall.
Some kind of dissolve effect allowing you to see through the walls would be preferable, but writing my own shaders is not my forté...

Another problem is with large buildings outside. The camera is at a fixed distance, about 14 metre's away. If the player walks behind a large building (over ~10 metres tall) then the camera cuts off the top of it as it is now within the building.

The only way I can think of fixing this is to adjust the distance between player and camera, but some of the buildings are so tall the zoom-out looks very unusual and impractical.

I suppose this is why you don't see this simplistic camera setup in large explorable games...

While I've been developing games for some years now, I've only come to 3D and Unity fairly recently, so there might be a jaw-droppingly simple solution which I'm not seeing.

Anyway, I'd like to hear some interesting or novel approaches towards fixing these problems, besides the simple ones I've suggested.

I hope that's not asking too much.

sentences:
Whats the mobile touch version of raycast2D and Input.GetAxis Mouse X and Y in Unity? I tried
      float pointer_x = Input.GetAxis("Mouse X");
      float pointer_y = Input.GetAxis("Mouse Y");
      if (Input.touchCount > 0)
      {
          pointer_x = Input.touches[0].deltaPosition.x;
          pointer_y = Input.touches[0].deltaPosition.y;
      }

`
for Mouse X and Y but didn't do the results i wanted. I basically have shapes that I want to move on the X and Y axis. So when I move up and Down only move on Y axis, and when I move left and right only move on X axis.
The Raycast2D mobile version of this I'm not sure either.
         Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);

         RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero);

         if (Input.GetMouseButtonDown(0))
         {

             for (int i = 0; i < empty.Length; i++)
             {
                 empty[i] = true;
             }

             if (hit.collider != null)
             {
                 startPos = transform.position;

                 offset = gameObject.transform.position -
                          Camera.main.ScreenToWorldPoint(
                          new Vector3(Input.mousePosition.x,
                          Input.mousePosition.y, screenPoint.z));
             }
         }

         if (Input.GetMouseButton(0))
         {

             if (hit.collider != null)
             {

                 Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
                 Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;

                 if (!posY)
                 {
                     if (Input.GetAxis("Mouse X") > 0.1 ||
                         Input.GetAxis("Mouse X") < -0.1)
                     {
                         posX = true;

                         if (Mathf.Round(transform.position.y * 2f) * 0.5f == Mathf.Round(hit.transform.position.y * 2f) * 0.5f)
                         {
                             transform.position = new Vector3(curPosition.x, startPos.y, curPosition.z);

                         }
                     }
                 }

                 if (!posX)
                 {
                     if (Input.GetAxis("Mouse Y") > 0.1 ||
                         Input.GetAxis("Mouse Y") < -0.1)
                     {
                         posY = true;

                         if (Mathf.Round(transform.position.x * 2f) * 0.5f == Mathf.Round(hit.transform.position.x * 2f) * 0.5f)
                         {
                             transform.position = new Vector3(startPos.x, curPosition.y, curPosition.z);
                         }

                     }
                 }

 Mathf.Round(transform.position.y * 2f) * 0.5f + " " + Mathf.Round(hit.transform.position.y * 2f) * 0.5f);
             }

         }

         if (Input.GetMouseButtonUp(0))
         {
             posX = false;
             posY = false;

             if (hit.collider != null)
             {
                 transform.position = new Vector3(outputX, outputY);
 Mathf.Sign(hit.transform.position.x) * (Mathf.Abs((int)hit.transform.position.x) + 0.5f));

 Mathf.Round(transform.position.y * 2f) * 0.5f + " " + Mathf.Round(hit.transform.position.y * 2f) * 0.5f);
             }

             if (Mathf.Sign(transform.position.x) * (Mathf.Abs((int)transform.position.x) + 0.5f) >= 2.5f ||
                 Mathf.Sign(transform.position.x) * (Mathf.Abs((int)transform.position.x) + 0.5f) <= -2.5f ||
                 Mathf.Sign(transform.position.y) * (Mathf.Abs((int)transform.position.y) + 0.5f) >= 1.5f ||
                 Mathf.Sign(transform.position.y) * (Mathf.Abs((int)transform.position.y) + 0.5f) <= -4.5f)
             {
                 Destroy(gameObject);
             }

             clicked = false;
         }

sentences: How do I apply a force using the object direction and speed? I have a 3D object moving and I need to be able to apply forces to it such as gravity. In 2D, I would simply store its movement in dx and dy, but since this is in 3D, I am using a Vector3D direction and a float speed. How can I determine how much to rotate the direction and change the speed when by using something like applyForce(Vector3D force)?

sentences:
Creating and connecting rooms for a roguelike I'm creating a Roguelike and I'm having constant troubles with map generation, it's just something I have a lot of difficulty wrapping my head around.

I currently have my map as a 50x50 square of tiles, which is then cut up into a 6x6 grid. The grid resembles as follows

+---+---+---+----+----+----+
| 1 | 2 | 3 | 4  | 5  | 6  |
+---+---+---+----+----+----+
| 7 | 8 | 9 | 10 | 11 | 12 |
+---+---+---+----+----+----+

etc etc up to 36. I can generate perfectly an identical room into each of these map sections but what I'm actually concerned about is filling a small number of them and connecting them.

Is there a known approach to this? Currently what I'm doing is just looping through the sections, taking a 50/50 coin toss and making a room there but I'm unsure how I can tell where to make paths, what if I have my map set out as follows

+---+---+---+----+----+----+
| 4 |   |   | 1  |    |    |
+---+---+---+----+----+----+
|   |   |   |    | 2  |    |
+---+---+---+----+----+----+
|   |   | 3 |    |    |    |
+---+---+---+----+----+----+

How do I intelligently map between 1 and 2? How do I map between 2 and 3, much less how do I map between 3 and 4?

I'm very new to game development, so please excuse me if this is a silly question

sentences:
How do you play more than one animation at a time in Unity? I am trying to have 2 animations on one GameObject, and I want them to play at the same time. I have been looking all over and messing around with the animator controller, but I cant get it working.

How do you play more than one animation at a time in Unity?

sentences:
Adapting DirectX samples to SlimDX I'm trying to learn DirectX and SlimDX but I'm having a terrible time getting started.

I'm taking the Triangle tutorial and trying to add color and transformations.

Starting with controlling color, I've updated the .fx file to the following:

cbuffer cbPerObject
{
    float4x4 gWVP;
};

struct vsInput
{
    float4 positionLS   : POSITION;
    float4 color        : COLOR;
};

struct vsOutput
{
    float4 positionCS   : POSITION;
    float4 color        : COLOR;
};

struct psInput
{
    float4 positionCS   : POSITION;
    float4 color        : COLOR;
};

vsOutput VShader(vsInput input)
{
    vsOutput output;

    output.positionCS = input.positionLS; //mul(position, gWVP);
    output.color = input.color;

    return output;
}

float4 PShader(psInput input) : SV_TARGET
{
    return input.color;
}

And the code updates limited to the following lines:

// create test vertex data, making sure to rewind the stream afterward
var vertices = new DataStream(16 * 6, true, true);
vertices.Write(new Vector4(0.0f, 0.5f, 0.5f, 1f));  // What is W (of POSITION)
vertices.Write(new Color4(.8f, 1f, 0f, 0f));        // What should it's value be?
vertices.Write(new Vector4(0.5f, -0.5f, 0.5f, 1f));
vertices.Write(new Color4(.8f, 0f, 1f, 0f));
vertices.Write(new Vector4(-0.5f, -0.5f, 0.5f, 1f));
vertices.Write(new Color4(.8f, 0f, 0f, 1f));
vertices.Position = 0;

// create the vertex layout and buffer
// Thanks to Mārtiņš Možeiko for fixing these next lines
var elements = new[] {
    new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, InputElement.AppendAligned, 0)
};

var layout = new InputLayout(device, inputSignature, elements);
var vertexBuffer = new SlimDX.Direct3D11.Buffer(device,
    vertices,
    (int)vertices.Length,
    ResourceUsage.Default,
    BindFlags.VertexBuffer,
    CpuAccessFlags.None,
    ResourceOptionFlags.None,
    0);

After a few other attempts at using SV_POSITION, COLOR, and SV_TARGET in the wrong spots, it finally executes without error; however, the triangle does not appear.

Please help me get the triangle working again with this updated shader.
Sample code for SetConstantBuffer() for populating gWVP for standard perspective.

Thanks!

sentences:
why doesnt this function work? glsl opengl c++ Im trying to move a transformation matrix onto the gpu, and I managed to find this code to help me on the way:

vertex.shader:

#version 410 core
layout ( location = 0 ) in vec3 vertex_position ;

mat4 rotationMatrix(vec3 axis, float angle)
{
    axis = normalize(axis);
    float s = sin(angle);
    float c = cos(angle);
    float oc = 1.0 - c;

return mat4(oc * axis.x * axis.x + c,           oc * axis.x * axis.y - axis.z * s,  oc * axis.z * axis.x + axis.y * s,  0.0,
            oc * axis.x * axis.y + axis.z * s,  oc * axis.y * axis.y + c,           oc * axis.y * axis.z - axis.x * s,  0.0,
            oc * axis.z * axis.x - axis.y * s,  oc * axis.y * axis.z + axis.x * s,  oc * axis.z * axis.z + c,           0.0,
            0.0,                                0.0,                                0.0,                                1.0);
}

void main()
{

gl_Position=rotationMatrix(vertex_position,45.0);

}

However, this gives errorc1035: assignment of incompatible types. Shouldnt this work? What am I missing

sentences:
Unity - Display array of Objects in inspector I have an array of ScritableObject's, which should only be displayed in the inspector if a boolean is true. How would I do this? With my current code, I get an error saying:

  Cannot implicitly convert type Tile to `Tile[]

This is my current code:

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

[CreateAssetMenu (fileName="Data", menuName="Tiles/Map", order=1)]
public class Tile : ScriptableObject {

    public ETile eTile;
    public Sprite sprite;

    [Space(5), Header("Variety")]
    public bool variety;

    [Range(0f, 1f)]
    public float varietyChance;
    public Tile[] varietyTiles; <---- This should be hidden if variety is true
}

public enum ETile {
    Water,
    Grass
}

[CustomEditor(typeof(Tile))]
public class MyScriptEditor : Editor {

    override public void OnInspectorGUI() {
        var tile = target as Tile;

        tile.variety = EditorGUILayout.Toggle("Hide Fields", tile.variety);

        if (tile.variety) {
            tile.varietyTiles = (Tile)EditorGUILayout.ObjectField("Tile", tile, typeof(Tile), allowSceneObjects: true);         }
        }
    }
}

sentences:
I am having trouble with gravity in my game I am trying to detect if the player is on an object with a tag "canHoldWeight". But the detecting if the player is on an object isn't working.

falling code called every tick:

    boolean isObjectSolid;
    boolean isOnObject;
    boolean falling = true;

    for (int i = 0; i < InitObject.getSizeOfAll(); i++)
    {
        GObject object = InitObject.getObjectFromAll(i);

        isOnObject = checkCollision(InitObject.player, object);
        isObjectSolid = object.isHoldWeight();

        if (checkCollision(InitObject.player, object) && isObjectSolid)
        {
            falling = false;
            break;
        }
    }

GObject code (parent of the player and the "ground")

public int rX, rY, hSpeed, vSpeed;
public int x;
public int y;
public boolean dying;
public double dx;
public double dy;
public boolean canHoldWeight;
private Rectangle bounds;
private boolean visible;
private Image image;

public GObject (Image img, int startX, int startY)
{
    image = img;
    visible = true;

    rX = startX;
    rY = startY;

    hSpeed = vSpeed = 0;
    bounds = new Rectangle(startX, startY, img.getWidth(null), img.getHeight(null));
}

public Rectangle getBounds ()
{
    bounds.x = rX;
    bounds.y = rY;
    return bounds;
}

public boolean checkCollision (GObject obj1, GObject obj2)
{
    if (obj1.getBounds().intersects(obj2.getBounds()))
    {
        return true;
    } else
    {
        return false;
    }
}

if you need any more information please let me know :D

sentences:
Ping Pong bat is not detecting the collision with the wall I have been learning Unity for last couple of days. I want to make one simple ping pong game. The idea is simple. The game has a Sphere as a ball, a plane as ground, 2 rectangles as bats and 4 rectangles as walls. Look at the image

It is a 2 players game. One player will use 'W' and 'S' key and another player will use 'Up Arrow' and 'Down Arrow' on the keyboard to move the bat up and down.

But I have a problem here. If a player moves the bat at the limit (up or down), the bat does not detect the collision with the wall. It just goes through the wall. Look at the image.

The bats and the walls have Box Collider, but still the problem persists. So what should I do so that the bat detects the collision with the wall.

sentences:
Rotating a gameobject in the Inspector doesn't change direction When I add a Cube to a scene, the blue axis (=forward) of the cube points into a certain direction.

When I now change the Y rotation of the cube to 90 in the inspector, the blue arrow doesn't rotate.

I would have expected it to rotate with the rotation that I have defined for the cube.

What is happening here?

To explain more in detail why this is bothering / confusing me:

I want to rebuild the RE4 inventory (which is actual 3D). The items in this inventory can be moved within the "grid":

To do that I have created a suitcase and then I added a gun to it:

As one can see, I have assigned the facing direction properly: The blue axis (=forward) points into the direction of the gun.

Now I wanted to rotate the gun in such a way that it is shown like in the original RE4 inventory.

To do that, I apply a rotation of Y = -90.

The gun looks correctly now:

However, the blue axis now faces the wrong direction in my opinion. Why does it not rotate along with the rotation of the gameobject?

This really confuses me because now when I want to move the gun left or right, I have to change its X position value instead of changing the Z position value.

This just seems wrong to me.

Can somebody tell me what I'm missing here?

Thank you.

sentences:
Is developing 2D sprites as projections of 3D models viable? I am a solid programmer and have a strong desire to make a 2D top down game. My immediate stumbling block, however, is the art. I am currently using placeholder images, but I really want to develop my own IP. The problem is that I simply can't draw that well. However, I do have really great three dimensional reasoning, and I am rapidly improving in 3D modeling with Maya.

My hope is that I can develop models in three dimensions, and then generate sprites from cross sections, or use of those models. Is this a viable path of developing production quality 2D art?

sentences: How to make a fan like behavior I am making a game in Unity. I have an object e.g. cube. I want to release air from it like fan so that when other cubes come closer, it throws them away. What velocity,force etc I will need to do that?

sentences:
Balancing a game about gladiatorial robot combat Suppose a player can construct a robot built from various parts and each part costs money. How would you balance the cost of a weapon against its capabilities? What about balancing weapons against other parts?

The base case seems pretty easy: imagine the player can only buy weapons and everything else on the robot is the same. A machine gun that fires 1 bullet per second costs $100. A super machine gun that fires twice as fast could cost twice as much. But what about an ultra machine gun that has four times the range?

Now imagine the player can add other capabilities to the robot like better speed or armor. How do you relate the cost of a machine gun against the ability to move very quickly, or to be stealthed against radar?

I understand that there's a later stage of experimentation where costs and capabilities are adjusted, but where do you start from?

sentences:
How to make sure that at least one element in a collection has a certain value? In my game, I assign each agent a random direction. However, at least one of these agents has to have a direction of Vector2.up. How can I ensure that?

private void AssignRandomDirection()
{
    var directions = new List<Vector2>
    {
        Vector2.up,
        Vector2.down,
        Vector2.left,
        Vector2.right
    };

    foreach (var agent in FindObjectsOfType<Agent>())
    {
        var random = Random.Range(0, directions.Count);
        agent.direction = directions[random];
    }
}

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: How to stop Follow Path steering behavior when reached target? I'm using libgdx Follow Path Steering Behavior in my top-down game. When unit reaches the end of the path, it goes to the start (not directly, but following path), then to the end and so on. How to stop following path, when unit reached the end point?

sentences:
What tools are available for game script writing? I'm looking to find some software options on OS X that are geared toward writing game scripts. Features like the ability to craft dialogue trees and other non-linear script formats would be appreciated.

I own Celtx and love its ability to store character information along with various other media assets, but it's very linear and straight, film-style script based which doesn't exactly work well for game applications.

Any dedicated or more appropriate software options out there?

sentences:
First Person Camera strafing at angle I have a simple camera class working in directx 11 allowing moving forward and rotating left and right. I'm trying to implement strafing into it but having some problems.

The strafing works when there's no camera rotation, so when the camera starts at 0, 0, 0. But after rotating the camera in either direction it seems to strafe at an angle or inverted or just some odd stuff.

Here is a video uploaded to Dropbox showing this behavior.
https://dl.dropboxusercontent.com/u/2873587/IncorrectStrafing.mp4

And here is my camera class. I have a hunch that it's related to the calculation for camera position. I tried various different calculations in strafe and they all seem to follow the same pattern and same behavior. Also the m_camera_rotation represents the Y rotation, as pitching isn't implemented yet.

#include "camera.h"

camera::camera(float x, float y, float z, float initial_rotation) {
m_x = x;
m_y = y;
m_z = z;
m_camera_rotation = initial_rotation;

updateDXZ();
}

camera::~camera(void)
{
}

void camera::updateDXZ() {
m_dx = sin(m_camera_rotation * (XM_PI/180.0));
m_dz = cos(m_camera_rotation * (XM_PI/180.0));
}

void camera::Rotate(float amount) {
m_camera_rotation += amount;

updateDXZ();
}

void camera::Forward(float step) {
m_x += step * m_dx;
m_z += step * m_dz;
}

void camera::strafe(float amount) {
float yaw = (XM_PI/180.0) * m_camera_rotation;

m_x += cosf( yaw ) * amount;
m_z += sinf( yaw ) * amount;
}

XMMATRIX camera::getViewMatrix() {
updatePosition();

return XMMatrixLookAtLH(m_position, m_lookat, m_up);
}

void camera::updatePosition() {
m_position = XMVectorSet(m_x, m_y, m_z, 0.0);
m_lookat = XMVectorSet(m_x + m_dx, m_y, m_z + m_dz, 0.0);
m_up = XMVectorSet(0.0, 1.0, 0.0, 0.0);
}

sentences:
How to check if a line casted from one point to another point passes through a mesh? Let's say we have two vectors A and B. Is there a way to use Three.js' Ray or Raycaster classes to cast a line between vector A and vector B and check is it passes through a mesh in the scene? I know from the documentation that both the Ray and Raycaster classes accept origin and direction vectors but I specifically need two points.
Thanks in advance.

sentences:
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:
Accumulating rotations for camera It seems there are three ways to store a camera's rotation: in angles, view matrix or quaternion. I was using euler angles since when I used a matrix it had a tendency to accumulate rounding errors quickly that threw off everything and quaternions would have the same problem.

The problem I've run into is how do I accumulate the rotation? When the camera is rotated, it's rotated in local space about its local XYZ axes. How would you use the given angles in a rotation to rotate about these arbitrary axes? Usually this operation is done with a matrix but it doesn't make sense to try to extract the new angles out of it.

Or perhaps I should be just storing the rotation in a matrix or quaternion? But can this be done without errors eventually causing problems?

sentences:
Help setting up money system in game maker I am trying to make a clicker game where one button makes the item and then one button sells the item. My problem is that I don't know how to make the one button stop selling when it reaches 0 items to sell. My code for the selling of the item as of right now looks like this in game maker:

///Sell items
global.money+=global.PC
global.items-=global.PC

It works to subtract per click, but once it reaches 0, it keeps going in to negatives. I am very new to this so forgive my asking probably simple questions.

sentences:
When should a VBO be unbind or not? Searching about VAOs and VBOs I read here and here that I can optionally unbind them to avoid accidental modification so I gave it a try. The problem is that unbinding the VBO causes an access violation when calling glDrawElements and I don't understand why am I getting this behavior.

int main(int argc, char *argv[]) {
    if (!glfwInit()) {
        return -1;
    }

    GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL", nullptr, nullptr);
    glfwMakeContextCurrent(window);
    glewExperimental = GL_TRUE;

    if (glewInit() != GLEW_OK) {
        return -1;
    }

    GLfloat vertices[] = {
        -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, // Top-left
        0.5f, 0.5f, 0.0f, 1.0f, 0.0f, // Top-right
        0.5f, -0.5f, 0.0f, 0.0f, 1.0f, // Bottom-right
        -0.5f, -0.5f, 1.0f, 1.0f, 1.0f  // Bottom-left
    };

    // Create Vertex Array Object
    GLuint vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    //Vertex Buffer Object
    GLuint vbo;
    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    // Index Buffer Object
    GLuint elements[] = {
        0, 1, 2,
        2, 3, 0
    };

    GLuint ibo;
    glGenBuffers(1, &ibo);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elements), elements, GL_STATIC_DRAW);

    (...) // Shader-related stuff

    // Specify the layout of the vertex data
    GLint posAttrib = glGetAttribLocation(shaderProgram, "position");
    glEnableVertexAttribArray(posAttrib);
    glVertexAttribPointer(posAttrib, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), 0);

    GLint colAttrib = glGetAttribLocation(shaderProgram, "color");
    glEnableVertexAttribArray(colAttrib);
    glVertexAttribPointer(colAttrib, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (void*)(2 * sizeof(GLfloat)));

    glBindVertexArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

    glBindVertexArray(vao);
    while (!glfwWindowShouldClose(window)) {
        glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
        glClear(GL_COLOR_BUFFER_BIT);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);

        if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
            glfwSetWindowShouldClose(window, GL_TRUE);

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    // Prepare to close the application
    glDeleteProgram(shaderProgram);
    glDeleteShader(fragmentShader);
    glDeleteShader(vertexShader);
    glDeleteBuffers(1, &vbo);
    glDeleteBuffers(1, &vao);
    glDeleteBuffers(1, &eab);

    return 0;
}

I'm getting the following error and it happens only when I unbind the VBO. Unbinding the VAO and the IBO doesn't throw any exception.

  Unhandled exception at 0x0282D434 (ig4icd32.dll) in main.exe: 0xC0000005: Access violation reading location 0x00000000.

Is there a problem with the way I did the unbinding?

sentences:
Maya/Unity - See through models I've recently modeled my character inside Maya; here's an image. The first thing I noticed whilst creating my model is that the models could be seen through source 1, after doing a little research people stated that it was a graphical bug in Maya. However, once imported into Unity the same effect occurs.

Therefore, my Question is: How can I fix this inside Maya or Unity?

To prove that my UV map doesn't contain a low opacity texture see the second image below:

sentences:
How do I procedurally generate level like in Dino Run, or Tiny Wings? I'm looking to create a game like Dino Run, where I will need to create large slopes for a level, procedurally generated.
How do I go about this?

Do I have to make certain predefined pieces of level that I can connect to each other?
How do I make this fully procedural?

I'm using Sprite Kit if it makes any difference.

sentences:
32 bit or 16 bit textures I'm trying to build some 2d character with Photoshop and Spine. By now, I have created some of my characters using 16 bit color depth images in Photoshop. Now, I wonder whether I have to use 32 bit or just create everything with 16 bit textures...
How much does it affect my game? Considering a 2D Unity or Flash game.

sentences:
Rotating gradually in response to input, instead of snapping I'm trying to replicate Silent Hill's mechanic where if you press a button, the character does a 180, but instead of getting a smooth turn around, my character is snapping from one rotation to another.
This is the code I have so far:
if (Input.GetKeyDown(KeyCode.Tab))
{
    transform.Rotate(0f, 180f, 0f);
}

I also have a Sprint(); function and I want to disable this feature if the character is sprinting.
Here's the code for that:
private void Sprint()
{
    float newTurnSpeed = _turnSpeed - 1.4f;

    vertical = Input.GetAxis("Vertical");
    horizontal = Input.GetAxis("Horizontal");

    Vector3 direction = new Vector3(0f, 0f, vertical);
    Vector3 movement = transform.TransformDirection(direction) * _sprintSpeed;

    transform.Rotate(0f, horizontal * newTurnSpeed, 0f); //add the new turn speed
    isGrounded = _characterController.SimpleMove(movement);
}

Any help is appreciated!

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:
How can I make animations "snap" between transitions in Unity? I have an animator with a few animations in it.  These are very basic animations, just changing a transform to slide a sprite around in a cutscene.  The issue that I'm running into is that when I transition from one animation to the next it will try to smooth out the animation differences.  So if I have something move off the right of the screen, then with the next animation come falling from the top of the screen, it will first quickly slide to the new position.

I've tried to change the last frame of the first animation to Right Tangent -> Constant, and the first frame of the second animation to Left Tangent -> Constant.  It didn't make any noticeable difference.

I also set up two functions (one for X, one for Y) to set the position at the beginning of the second animation, but only one of them were called, and it didn't seem to do anything.

So, how do I get an animation to snap to the starting values of the new animation after a transition?

sentences:
What should I use (controls, methods) to make a 2D tile based map editor? I'm making a 2d game where each tile is a square and it's viewed at straight angle, no skewing, no rotation, it's pretty simple.

Two weeks ago I tried using DataGridView, but as the number of rows and columns increased, it became frustratingly slow, then I read how it should've happened to me earlier, because this control is not supposed to work with large number of cells, and I have at least 7500 cells in my smallest level, which made it unbearable to use.

This is what I expect from my new editor:
Most importantly, tile type. Tile images or their color codes are fine (seeing map as it is in-game is cool, but the faster, the better).

Secondly, all tile parameters (in text, preferrably editable in a popup or sidebar).

I'm using my own format, so I'm most probably not going to use third party product. Besides, I'm trying to learn how to do it myself.

sentences:
How do I clear streaming textures in SDL? I need to clear a streaming texture before I draw into it on the next frame, because only a part is updated, and it's random enough that I can't predict which part will be clear.

I don't want to reinitialize it every time, or rewrite the whole texture each time.

Here is the code I tried, but this fails every time, since the texture is in streaming mode.

SDL_Texture* StreamingTexture = SDL_CreateTexture(render, SDL_PIXELFORMAT_RGBA8888,
        SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);

SDL_SetRenderTarget(render, StreamingTexture);
SDL_SetRenderDrawColor(render, 0, 0, 0, 0);
SDL_RenderClear(render);

sentences:
How do I properly implement zooming in my game? I'm trying to implement a zoom feature but I have a problem. I am zooming in and out a camera with a pinch gesture, I update the camera each time in the render, but my sprites keep their original position and don't change with the zoom in or zoom out.

The Libraries are from libgdx.

What am I missing?

private void zoomIn()
{
    ((OrthographicCamera)this.stage.getCamera()).zoom += .01;
}

public boolean pinch(Vector2 arg0, Vector2 arg1, Vector2 arg2, Vector2 arg3)
{
    // TODO Auto-generated method stub
    zoomIn();
    return false;
}

public void render(float arg0)
{
    this.gl.glClear(GL10.GL_DEPTH_BUFFER_BIT | GL10.GL_COLOR_BUFFER_BIT);
    ((OrthographicCamera)this.stage.getCamera()).update();
    this.stage.draw();
}

public boolean touchDown(int arg0, int arg1, int arg2)
{
    this.stage.toStageCoordinates(arg0, arg1, point);
    Actor actor = this.stage.hit(point.x, point.y);

    if(actor instanceof Group)
    {
        ((LevelSelect)((Group) actor).getActors().get(0)).touched();
    }

    return true;
}

Zoom In

Zoom Out

sentences: What is the maximum value for a leaderboard entry in Google Play Services? What is the maximum value an entry in a leaderboard using the Google Play Services can have?

sentences:
Efficient 2d Java Line of Sight for a lot of entities? My problem today is this:

I have many civilians going around, they are classes stored by an arraylist.

The idea is when they see another civilian panic, they'll start to panic and it will spread.

First I call each classes Step() function by looping through an iterator. Then in the Step() function it goes through another civillian iterator
     As it goes through, it tries to detect whether it can see the other civillian in the iterator, this is where performance time goes from 0 to 50 Milliseconds for having 100 Civillians.

This is the problem I need to fix, I tried to make an easy way to detect whether any objects are in the way of point a to point b.

Here's the code for the line of sight:

public static Object LOS(int x, int y, int x2, int y2, String Scan, Object Me, Object You) {
   DirectionX = (x-x2)/Quality;
   DirectionY = (y-y2)/Quality;
   CurrentX = x;
   CurrentY = y;
   String[] ScanArray = Scan.split(":");
   for(int I=0;I<=Quality;I++) {
      for(String Type: ScanArray) {
         if(Type.equals("Boxs")) {
            Iterator it=Level.Boxs.iterator();
            while(it.hasNext()) {
               Box Box = (Box)it.next();
               if(Me!=Box&&You!=Box) {
                  //Collision = Tools.Collision((int)(CurrentX-(Width/2)), (int)(CurrentY-(Width/2)), Width, Width, Box.GetX(), Box.GetY(), Box.GetWidth(), Box.GetHeight(), 1);
                  boolean Col = Tools.BasicCollision((int)(CurrentX-(Width/2)), (int)(CurrentY-(Width/2)), Width, Width, Box.GetX(), Box.GetY(), Box.GetWidth(), Box.GetHeight());
               }
            }
         }
      }

      CurrentX-=DirectionX;
      CurrentY-=DirectionY;
   }
   return null;
}

If you have a headache the fundamentals are:

It figures out 10 points in between and detects whether it is inside, using BasicCollision:

public static boolean BasicCollision(int x, int y, int width, int height, int x2, int y2, int width2, int height2) {
   if(x<x2+width&&x+width>x2&&y<y2+height&&y+height>y2) {
      return true;
   } else {
      return false;
   }
}

My question is: Is there an easier way to detect this Line of Sight that doesn't severely impact my performance in large numbers? Any feedback?

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:
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:
How do I get the mouse coordinates relative to my whole scene with Monogame? I am making a topdown isometric real time game using Monogame.

I know how to get the mouse position for my camera view. How do I get the mouse coordinates relative to the entire scene?

My game's rendering looks isometric, but it's actually simply 2D and the illusion of isometric projection is done with a simple script that converts the cartesian coordinates for the mouse position to isometric ones, which I pass into a simple grid pathfinding algorithm that makes paths from them. This worked well for me when I used Game Maker.

sentences:
How to "hide" an adventure game in an RPG I have a shakey idea for a game, and I need help fleshing out what mechanics could make this work.

I want to make a game that, on the surface, is a fun little exploration/dungeon crawler/rpg-lite sort of game. There's some story, a large map, and basic quests to go off to various dungeons and defeat all the monsters that are threatening the kingdom.

The idea is that a player can play through, and defeat the game by just going and defeating the monsters everywhere, and that should be a rewarding enough way to play the game.

However, I don't want that to be the only way to play the game. What if the monsters attacking the kingdom from a nearby "dungeon" are just misunderstood, or are being provoked? What if they could instead be made into allies?

For each set of set of monsters threatening the kingdom, I want the player to either be able to just go and kill them all, or find some other solution, but for killing all the monsters to be the only obvious thing to do.

The idea being that finding a different solution should feel very rewarding, or a suggestion that there are other solutions should come late in the game and provide motivation for the player to replay the game.

My question is: What sort of game mechanics could be used to provide an alternative way of progressing through the game while not making it obvious that the alternative exists? I think if a dialog tree open up with the first monster you met in each dungeon, it would telegraph the idea that there's an alternative solution. So how could there be a dungeon of monsters that you can wade into and immediately start fighting, while at the same time there being a non-violent solution?

sentences:
How does the logic "column < row + 1" work? The output gives half an asterisk pyramid This code creates half a pyramid on the compiler, but I'm not sure how that works. The only thing I understand is that the column < row + 1 line is what influences the code, because when I change it to column < 10, then it creates a square when run.

for(int row = 0; row < 10; row++) {
    for(int column = 0; column < row + 1; column++) {
        Console.Write("*");
    }
    Console.WriteLine();
}

//The output gives half the asterisk pyramid.
//I don't get the logic of how "row + 1" works.
//How does this influence the asterisk to not be entered in the particular places?

sentences:
How to Continue the state of Unity Game Scene I am developing a simple Unity 2D game. During the development of Level One, I wanted the scene to continue after the player is triggered by the enemy and dead util the given 5 lives are completed. When I add Coroutine, it reloads the whole scene and I don't want that...I just want to continue its life from the last hit. So how can I make the scene continue until it loses the whole 5 lives?

void OnTriggerEnter2D (Collider2D col) {
    if (col.gameObject.tag == "Player" ) {
        health.CurrentVal -= 1;
        Explode ();
        if (health.CurrentVal != 0) {
            StartCoroutine ("ReloadGame");
        } else {
            StopAllCoroutines();
        }
    }
}

Thanks!

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:
Am I allowed to sell a XNA game by myself? I've just started the development of an XNA game, and I'm asking myself if it wouldn't be better to use an open-source alternative since I absolutely want to keep the complete control over my game. I need to be able to sell it to whoever I want, using the media I want.

Based on the XNA license and all that sort of legal stuff, am I allowed to sell an XNA game on my own, or am I forced to sell it through the Xbox Live Marketplace?

I'd like to see some reliable reference with your answer.

sentences:
Help understanding camera/scene Unity I'm a brand new unity developer and I watched a few tutorials and then found a game on the Asset Store to provide a nice base for my game. However the setup, especially with multiple scenes is quite different than the tutorials I watched and I can't figure out what is happening. Here is my Scene view from the main menu:

When I click on Main Camera the tiny little thing with the green outline in the corner is highlighted.

Now if I click play, that whole menu fits in the screen, even though the Main Camera is apparently tiny? Then, while playing, I click back to scene view I see this:

It shows the camera as being empty, even though in Game View I can see/interact with the menu.

When I swap to my Scene 1, which is the game view, it is the exact opposite. This is what I see in Scene View while the game is playing:

Note the game running in the preview in the corner. Those tiny circles are the same circles on the main menu, how does the same asset fit in what appears to be two wildly different sizes?

So I ask, what is the different between the two scenes. One appears in the preview while one doesn't. One fills in the huge canvas while the other apparently fits in the tiny camera. What am I missing?

sentences:
Unity - Plugin 'MFC100U.DLL' is used from several locations: As per subject, I got this error message using Metaio SDK in Unity5. BTW, I'm using Mac, not Windows machine.

Plugin 'MFC100U.DLL' is used from several locations:
 Assets/Plugins/x86_64/MFC100U.DLL would be copied to <PluginPath>/MFC100U.DLL
 Assets/Plugins/x86/MFC100U.DLL would be copied to <PluginPath>/MFC100U.DLL
Plugin 'MSVCP100.DLL' is used from several locations:
 Assets/Plugins/x86/MSVCP100.DLL would be copied to <PluginPath>/MSVCP100.DLL
 Assets/Plugins/x86_64/MSVCP100.DLL would be copied to <PluginPath>/MSVCP100.DLL
Plugin 'pthreadVC2.dll' is used from several locations:
 Assets/Plugins/x86/pthreadVC2.dll would be copied to <PluginPath>/pthreadVC2.dll
 Assets/Plugins/x86_64/pthreadVC2.dll would be copied to <PluginPath>/pthreadVC2.dll
Plugin 'Shore140.dll' is used from several locations:
 Assets/Plugins/x86_64/Shore140.dll would be copied to <PluginPath>/Shore140.dll
 Assets/Plugins/x86/Shore140.dll would be copied to <PluginPath>/Shore140.dll
Plugin 'MSVCR100.DLL' is used from several locations:
 Assets/Plugins/x86/MSVCR100.DLL would be copied to <PluginPath>/MSVCR100.DLL
 Assets/Plugins/x86_64/MSVCR100.DLL would be copied to <PluginPath>/MSVCR100.DLL
Plugin 'metaiosdk.dll' is used from several locations:
 Assets/Plugins/x86/metaiosdk.dll would be copied to <PluginPath>/metaiosdk.dll
 Assets/Plugins/x86_64/metaiosdk.dll would be copied to <PluginPath>/metaiosdk.dll
Please fix plugin settings and try again.

UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

How I can fix this error? Please advice. Thank you.

sentences: Can I use the 2d physics engine in a 3d game (or viceversa) in Unity? This is entirely for performance. The 2D physics are less expensive, but I require 3D for some scenes. I never need both at the same time. I know you can have 2D with an orthographic perspective in a 3D engine, but what I want is really the physics engine. Also, is there a way of turning off these engines? I´ve made most collisions from scratch and am only using  them for some raycasts at the beginning and for some collider/rigidbody.casts in not every, but a lot of frames (If I understand correctly, they are calculated from the physics engine in each FixedUpdate()).

sentences:
how to clamp the look at function? how can i look at a target on 2 axis but clamp the the object's rotation ,to only rotate from -45 to 45 on x and from -60 to 60 on y axis. i used this script to look at target and clamp the rotation, but it's not working right ): there is no problem with maximum value but whenever the rotation is about to become zero or a negative value the wired problem will show up. i made a gif here (http://www.mediafire.com/view/55phgr5qrhy8fk1/record.gif)

public Transform target;
public float speed;

public float minimumX;
public float maximumX;

public float minimumY;
public float maximumY;
// Start is called before the first frame update
void Start()
{

}

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

    Quaternion OriginalRot = transform.rotation;
    transform.LookAt(target);
    Quaternion NewRot = transform.rotation;
    transform.rotation = OriginalRot;
    transform.rotation = Quaternion.Lerp(transform.rotation, NewRot, speed * Time.deltaTime);

    transform.eulerAngles = new Vector3(Mathf.Clamp(transform.eulerAngles.x, minimumX, maximumX), Mathf.Clamp(transform.eulerAngles.y, minimumY, maximumY), 0);

}

}

sentences: An archery's arrow should be a node or particle? I am using Sprite Kit to do game development. I would like like to design an archery with arrow. Should I use the arrow as one of the node? If so, it is a concern to have too many arrow on the screen, so that the performance will be slower? What do you think?

sentences:
Selecting a range of hex tiles within radius of main tile What I'm doing is pretty new to me, or at least I think it is, so I'm not really sure of what I'm looking for. Hopefully someone here knows =-)

Using a grid of hexes I generate, I can hover over any tile and it will highlight just fine. Now what I'm trying to figure out is how to allow for a radial selection of tiles around that hovered tile (brush size, basically), eventually allowing for a somewhat radial soft-selection gradient to allow falloff.

Each hex already knows about their neighbors, so currently I am hard-coding logic to handle a radius of 1, 2 or 3. I could duplicate that logic over and over to handle bigger radii but this is definitely not going to work for much longer, so I am trying to figure out a more efficient and cleaner way using loops/recursion/whatever.

Can anyone offer any pseudo-code or possibly a link that explains how to do this? Below is a (probably bad) attempt at what I think it would look like.

OnMouseOver(){
    // This would select a radius of x hex tiles including center tile
    this.SelectTile(3);
}

SelectTile(selectionRadius){
    if(!this.alreadySelected){
        this.Select();
    }
    for(int i = 0; i <= selectionRadius; ++i){
        if(i < selectionRadius){
            foreach(HexTile tile in thisTile.neighbors){
                tile.SelectTile(selectionRadius - i);
            }
        }
    }
}

Edit: I'm using this fantastic resource to help with hexes - http://www.redblobgames.com/grids/hexagons/ - so might there be a section on this page that may explain what I need and I'm just missing?

sentences:
Why isn't my sprite being drawn in the correct position in XNA? Sorry if this has been asked before, but I can't seem to find it here. I'm trying to make an asteroids clone in XNA. I took the Game State Management project and am making new classes for things like the player and placing them in the GameplayScreen class. For some reason my ship isn't being draw correctly.

GameplayScreen's Draw method:

 public override void Draw(GameTime gameTime)
    {
        ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
                                           Color.CornflowerBlue, 0, 0);

        SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

        spriteBatch.Begin();
        //draw fps
        if(showFPS)
            spriteBatch.DrawString(framerateFont, "FPS: " + frameRate, new Vector2(15, 15), Color.White);

        player.Draw(spriteBatch);

        spriteBatch.End();

        // If the game is transitioning on or off, fade it out to black.
        if (TransitionPosition > 0 || pauseAlpha > 0)
        {
            float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);

            ScreenManager.FadeBackBufferToBlack(alpha);
        }
    }

And my ship's drawing code:

 public PlayerShip(Game game)
    {
        this.game = game;
        Viewport view = game.GraphicsDevice.Viewport;
        center = new Vector2(view.Width / 2, view.Height /2);
        sourceRectangle = new Rectangle();
        Reset(center);
    }

    public void Reset(Vector2 position)
    {
        this.position = position;
    }

    public void LoadContent()
    {
        ship = game.Content.Load<Texture2D>("ship");
        sourceRectangle = new Rectangle(0, 0, ship.Width,
            ship.Height);
        origin = new Vector2(ship.Width / 2, ship.Height);
    }

    public void Update(GameTime gameTime)
    {
        HandleInput();

    }

    //handles all keyboard input by user. rotates ship based on current rotation.
    private void HandleInput()
    {
        input = Keyboard.GetState();
        float x = position.X;
        float y = position.Y;
        Matrix m = Matrix.CreateRotationZ(rotation);

        if (input.IsKeyDown(Keys.Right))
            rotation += turnFactor;
        else if (input.IsKeyDown(Keys.Left))
            rotation -= turnFactor;
        else if (input.IsKeyDown(Keys.Up))
        {
            x += m.M12 * directionFactor;
            y -= m.M11 * directionFactor;
        }
        else if (input.IsKeyDown(Keys.Down))
        {
            x -= m.M12 * directionFactor;
            y += m.M11 * directionFactor;
        }
        position.X = x;
        position.Y = y;
        Console.WriteLine("Y: {0} ", y);
        Console.WriteLine("X: {0} ", x);
    }

    public void Draw(SpriteBatch sb)
    {
        Vector2 origin = new Vector2(ship.Width / 2, ship.Height);
        sb.Draw(ship, ship.Bounds, null, Color.White, rotation, origin, SpriteEffects.None, 0f);
    }

I hooked the project up to a console window and it seems that the X and Y positions are updating correctly code wise, but not visually. It seems to update where it is rotationally, but going up or down doesn't draw correctly.

Image of what it's doing http://imgur.com/4cKBk

sentences: How to make a 2d game with Ascii art assets I am new to game development and have been practicing programming games in godot. I am looking to make a minimalist game that uses simple ascii art however I am unsure if I should use UI elements to represent different elements of the game or if I should make each letter I want to use into a sprite.

sentences:
Storing quests for an online RPG in a MySQL database I'm creating an online RPG game and I've been looking around for a way to save players' progressions in quests in MySQL. I've been looking at Pim Jager's answer answer for a while and I've come to the conclusion that this could work, but then my question would be:

Where/how do I store if a player currently has a quest accepted? How do I keep track of at which step of the quest the player currently is? This has to be saved somehow but I can't seem to figure out how I would do that. Let me know if you can help me out.

Thanks!

sentences:
Error inserting new pass entry into PassGroupRenderableMap I started playing around with terrain and I am getting this assertion in

QueuedRenderableCollection::addRenderable: "Error inserting new pass entry into PassGroupRenderableMap"

I am trying to find out what I have done wrong, but it is hard, so perhaps someone has any idea of what may it be.

I can reproduce it easily on my engine and my scene consists only of:

1 terrain page
1 mesh (highlander house)
1 directional light

If I reload the scene and look again at the house the assertion fires and it is very strange. I have tried to debug the code and the only reason for the assertion to fire that I have found is the hash being changed after the node was inserted on the map.

Any ideas how can I find a solution to it? Which data and information I can provide to help debug this?

Also I have seen in the forum some posts about this assertion, but no one that I have seen explain ways to debug or to fix it.

Ogre version 1.7.1
Windows 7
render Direct3d 9

sentences:
Making a Point Light follow a cube (Unity) I'm trying to have a point light positioned directly above a cube follow wherever the cube goes. However, it doesn't move at all. This is my code for the light:

using UnityEngine;
using System.Collections;

public class SpotlightController : MonoBehaviour {

// Use this for initialization
void Start() {

}

void OnGUI(){
    GUI.Label(new Rect(20,50,500,20), "(" + transform.position.x.ToString() + ", " + transform.position.y.ToString() + ", " + transform.position.z + ")");
}

// Update is called once per frame
void Update() {
    GameObject cube = GameObject.Find("Cube");
    float xlocation = cube.transform.position.x;
    float zlocation = cube.transform.position.z;

    transform.TransformPoint(new Vector3(xlocation,transform.position.y, zlocation) * Time.smoothDeltaTime);
    //transform.Translate(new Vector3(xlocation, 0, zlocation));
}
}

sentences:
How should a 3D map be stored? I have an array of 3d vertices, Vertex3D[][] ground;
so for each element in the array, I have an array of three 3D vertices, a triangle.

But this means I cannot implement a quad tree, and I cannot render polygons far away from the player with less accuracy, this also means I cannot have caves because one point on the map can only have one height (y) value. How are 3D maps stored (as in what data structure) to allow further polygons to be larger and close ones to be smaller as well as having different levels (height) at the same (x,z) coord?

sentences:
How can I implement simple distributed processing in a Unity game? I'm looking to set up a game which uses distributed processing. Just a simple brick shooter in unity with the distributed part being that the calculations for the falling blocks are handled by another PC and the transformations are sent back and applied to a clients machine.

To use this in Unity I assume I'll be using Remote Procedure Calls?
Will I also require socket programming? Any other networking elements I require?

sentences:
How do I multiply two RGBA colours? I have two RGBA integers. What procedure should I perform on them to return the multiplied colour? Do I need to split the RGBA integer into its component integers (R, G, B, A)?

I'm using this for a lighting engine.

sentences:
SDF - indexing the folding space I had been repetitively watching this part of the video just trying to understand his point:

  you can optionally use the return value as cell index ... as random
  seed to introduce some variation ...

at the near end of the video he stress that:

  don't use for loop ... anything can be achieved by repeating space ...
  I will make an operator to repeat an interval ... give it additional
  values like the first and the last cell index ... start by -2 and end
  at +2 then you get 5 objects ...

How can we achieve like what he say? Do we use clamp() to do that? Something like:

float a = clamp(pMod1(pos.x,2),start_value, end_value);

It is brilliant that everything he present is just like magic to me.

Update01

I dig deeper into SDF research and reading more codes from shadertoy, and discovered this interesting capsule code:

float sdCapsule( float3 p, float3 a, float3 b, float r ) {
    float3 pa = p - a,
    ba = b - a;
    float h = clamp( dot(pa, ba) / dot(ba , ba), 0.0, 1.0 );
    return length( pa - ba * h ) - r;
}

Basically, length(x)-r will get sphere, for x as the origin of the sphere and r is radius of the sphere. so the sdCapsule to some extend, is a variation of sphere, with the clamp(). That means my speculation might be correct. However, I still not sure what that clamp() do and how to adapt it to my use.

sentences:
Viewport / Camera Calculation in 2D Game we have a 2D game with some sprites and tiles and some kind of camera/viewport, that "moves" around the scene. so far so good, if we wouldn't had some special behaviour for your camera/viewport translation.

normally you could stick the camera to your player figure and center it, resulting in a very cheap, undergraduate, translation equation, like :

vec_translation -/+= speed (depending in what keys are pressed. WASD as default.)

buuuuuuuuuut, we want our player figure be able to actually reach the bounds, when the viewport/camera has reached a maximum translation.

we came up with the following solution (only keys a and d are the shown here, the rest is just adaption of calculation or maybe YOUR super-cool and elegant solution :) ):

if(keys[A])
{
    playerX -= speed;

    if(playerScreenX <= width / 2 && tx < 0)
    {
        playerScreenX = width / 2;
        tx += speed;
    }
    else if(playerScreenX <= width / 2 && (tx) >= 0)
    {
        playerScreenX -= speed;
        tx = 0;

        if(playerScreenX < 0) playerScreenX = 0;
    }
    else if(playerScreenX >= width / 2 && (tx) < 0)
    {
        playerScreenX -= speed;
    }
}
if(keys[D])
{
    playerX += speed;

    if(playerScreenX >= width / 2 && (-tx + width) < sceneWidth)
    {
        playerScreenX = width / 2;
        tx -= speed;
    }
    if(playerScreenX >= width / 2 && (-tx + width) >= sceneWidth)
    {
        playerScreenX += speed;
        tx = -(sceneWidth - width);
        if(playerScreenX >= width - player.width) playerScreenX = width - player.width;
    }
    if(playerScreenX <= width / 2 && (-tx + width) < sceneWidth)
    {
        playerScreenX += speed;
    }
}

i think the code is rather self explaining:

keys is a flag container for currently active keys, playerX/-Y is the position of the player according to world origin, tx/ty are the translation components vital to background / npc / item offset calculation, playerOnScreenX/-Y is the actual position of the player figure (sprite) on screen and width/height are the dimensions of the camera/viewport.

this all looks quite nice and works well, but there is a very small and nasty calculation error, which in turn sums up to some visible effect.

let's consider following piece of code:

if(playerScreenX <= width / 2 && tx < 0)
{
    playerScreenX = width / 2;
    tx += speed;
}

it can be translated into plain english as : if the x position of your player figure on screen is less or equal the half of your display / camera / viewport size AND there is enough space left LEFT of your viewport/camera then set players x position on screen to width half, increase translation (because we subtract the translation from something we want to move). easy, right?! doing this will create a small delta between playerX and playerScreenX.

after so much talking, my question appears now here at the bottom of this document:

how do I stick the calculation of my player-on-screen to the actual position of the player AND having a viewport that is not always centered aroung the players figure?

here is a small test-case in processing:

http://pastebin.com/bFaTauaa

thank you for reading until now and thank you in advance for probably answering my question.

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:
Game Engine Design – Ubershader - Shader management design I want to implement a flexible Ubershader system, with deferred shading. My current idea is to create shaders out of modules, which deal with certain features, such as FlatTexture, BumpTexture, Displacement Mapping, etc. There are also little modules which decode color, do tone mapping, etc. This has the advantage that I can replace certain types of modules if the GPU doesn't support them, so I can adapt to the current GPU capabilities. I am not sure if this design is good. I fear I could make a bad design choice, now, and later pay for it.

My question is where do I find resources, examples, articles about how to implement a shader management system effectively? Does anyone know how the big game engines do this?

sentences:
Infinite world floor grid shader I am trying to render an infinite world floor grid, similar to this question.
My project is using SceneKit with Metal Shading Language but the concepts are no doubt similar between GLSL/HLSL.
Here is an example project where I attempt to render a plane as a full screen quad with the grid lines drawn using a fragment shader.
Full shader code can be found here.

Grid Rendering
A simple vertex shader sets the position and grid coordinate for the plane:
f.position = scn_node.modelViewProjectionTransform * float4(v.position, 1.0);
f.ij = v.position.xy;

The fragment shader then determines which color to render the grid or floor:
fragment half4 floor_fragment(FragmentIn f [[stage_in]]) {

    float2 fractional  = abs(fract(f.ij; + 0.5));
    float2 partial = fwidth(f.ij;);

    float2 point = smoothstep(-partial, partial, fractional);

    float saturation = 1.0 - saturate(point.x * point.y);

    return half4(mix(backgroundColor.rgb, gridColor.rgb, saturation), 1.0);
}

I then remove any MVP transforms and simply set the vertex position as is in clip space to fill the screen. This does have the intended effect of filling the screen but mangles the grid lines.
//inside floor_vertex()
f.position = float4(v.position, 1.0);
f.coordinate = v.position.xy;

Ray Casting
As suggested in the comments, the fragment position should be projected into world space and intersected with the floor plane to find a new vector on the plane. I have an intersect(plane:ray) method returns a hit with a distance and a point on the plane or otherwise false if the ray is orthogonal to the plane.
It is my understanding that by multiplying the position in clip space with the inverseViewProjectionTransform the result will be in camera space. The plane is also converted to camera space with the modelViewTransform and I then test my ray against this which appears to work but with incorrect results.

fragment half4 floor_fragment(Fragment f [[stage_in]], constant SCNSceneBuffer& scn_frame [[buffer(0)]], constant NodeBuffer& scn_node [[buffer(1)]]) {

    //f.ij is in the vertex position in clip space (-1, -1) to (1, 1)

    //convert position into camera space
    float4 position = (scn_frame.inverseViewProjectionTransform * float4(f.ij.x, f.ij.y, 0.0, 1.0));

    //create ray from camera with direction
    Ray ray = Ray { .origin = float3(0.0), .direction = normalize(position.xyz) };

    //convert floor plane from world space to camera space
    float3 worldFloor = (scn_node.modelViewTransform * float4(float3(0.0, -5.0, 0.0), 1.0)).xyz;

    //hit test ray against floor plane
    Plane plane = Plane { .position = worldFloor, .normal = float3(0.0, 1.0, 0.0) };

    RayHitTest hitTest = intersect(plane, ray);

    if(!hitTest.hit) {

        return f.backgroundColor;
    }

    //grab xz values to determine floor fragment color
    float2 uv = hitTest.vector.xz;

    float2 fractional  = abs(fract(uv + 0.5));
    float2 partial = fwidth(uv);

    float2 point = smoothstep(-partial, partial, fractional);

    float saturation = 1.0 - saturate(point.x * point.y);

    return half4(mix(f.backgroundColor.rgb, f.gridColor.rgb, saturation), 1.0);
}

This video shows the final results where you can see that the grid is not correctly aligned with the world axis. The floor plane is positioned at 0.0, -5.0, 0.0 and the rectangle at 0.0, -4.5, 0.0 which should be aligned with each other but this is not the case. It looks to me that the perspective is off as the grid seems much larger than is should be.
Can anyone please point out the obvious mistake(s) I am making?

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:
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:
Best way to Draw a cube for 3D Picking on a specific face Currently I am drawing a cube for a game that I am making and the cube draw method is below.  My question is, what is the best way to draw a cube and to be able to easily find the face that the cursor is over?  My draw method works just fine, but I am getting ready to start to add picking (this will be used to mold the cubes into other shaps), and would like to know the best way to find a face of the cube.

public void  Draw() {
    // center point posX, posY, posZ
    float radius = size / 2;

    //top
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(1.0f,0.0f,0.0f); // red
            glVertex3f(posX + radius, posY + radius, posZ - radius);
            glVertex3f(posX - radius, posY + radius, posZ - radius);
            glVertex3f(posX - radius, posY + radius, posZ + radius);
            glVertex3f(posX + radius, posY + radius, posZ + radius);
        }
    glEnd();
    glPopMatrix();

    //bottom
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(1.0f,1.0f,0.0f); // ?? color
            glVertex3f(posX + radius, posY - radius, posZ + radius);
            glVertex3f(posX - radius, posY - radius, posZ + radius);
            glVertex3f(posX - radius, posY - radius, posZ - radius);
            glVertex3f(posX + radius, posY - radius, posZ - radius);
        }
    glEnd();
    glPopMatrix();

    //right side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(1.0f,0.0f,1.0f); // ?? color
            glVertex3f(posX + radius, posY + radius, posZ + radius);
            glVertex3f(posX + radius, posY - radius, posZ + radius);
            glVertex3f(posX + radius, posY - radius, posZ - radius);
            glVertex3f(posX + radius, posY + radius, posZ - radius);
        }
    glEnd();
    glPopMatrix();

    //left side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(0.0f,1.0f,1.0f); // ?? color
            glVertex3f(posX - radius, posY + radius, posZ - radius);
            glVertex3f(posX - radius, posY - radius, posZ - radius);
            glVertex3f(posX - radius, posY - radius, posZ + radius);
            glVertex3f(posX - radius, posY + radius, posZ + radius);
        }
    glEnd();
    glPopMatrix();

    //front side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(0.0f,0.0f,1.0f); // blue
            glVertex3f(posX + radius, posY + radius, posZ + radius);
            glVertex3f(posX - radius, posY + radius, posZ + radius);
            glVertex3f(posX - radius, posY - radius, posZ + radius);
            glVertex3f(posX + radius, posY - radius, posZ + radius);
        }
    glEnd();
    glPopMatrix();

    //back side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(0.0f,1.0f,0.0f); // green
            glVertex3f(posX + radius, posY - radius, posZ - radius);
            glVertex3f(posX - radius, posY - radius, posZ - radius);
            glVertex3f(posX - radius, posY + radius, posZ - radius);
            glVertex3f(posX + radius, posY + radius, posZ - radius);
        }
    glEnd();
    glPopMatrix();
}

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:
Unity: Why do my normals flip during an animation? This problem boggles my mind. I have an animation running on a face object (imported from Blender). At a few points in the animation, the normals switch direction! It causes the mesh to blink.

Of course this animation won't work in its current state. Even odder, I slowed down the animation sample in Unity to 1 so I could isolate the frames it happens on. There are no keyframes on the face when this happens!

What could be causing this? It only happens on this one animation. I can't find anything with extensive web searching. I've also tried recalculating normals and applying transformations, but it doesn't help.

These screen shots depict the same two frames, one frame before it happens (left) and the frame when it happens (right), just from different angles.

I'd very much appreciate any input or guidance to fixing this!

sentences:
Can I publish a game on Steam while obscuring my personal identity from the public? I'm looking to publish a game on Steam that contains explicit adult content.

I am seeking to make this a hobby that earns passive income as opposed to pursuing it as a full time job. I would prefer that a prospective employer could not easily track my name back to this game and thus not consider me for the job.

I have read the Steamworks Partner Program here:
https://partner.steamgames.com/steamdirect

And thus understand that for Steam's sake, I will need to identify myself. But can I publish under some sort of pseudonym to prevent a simple Google Search of my name from returning this game? Or will this pretty much be on my so-called "permanent record" for life?

sentences:
Designing a profit maximization model - multi-level game I am looking for some help in designing a multi-level game for a network simulator I am building.

In this network, actors have a choice to set up a number of units and to fill their units with money. They have a fixed amount of money that they start out with and are aiming to gain the earn the largest monetary reward they can.

Before the game starts, each actor has a heterogeneous amount of money and no units.

A pot of money will be distributed to the actors according to their relative size in the marketplace, which is determined by the number of units they have and the amount of money in each unit. Specifically, each unit will receive a score and the proportion of the reward claimable for that unit is determined by that unit's score divided by the total of all units' scores in the network. Logically, an actor's reward is the sum of their units' scores divided by all the units' scores in the network.

A unit's score is divided into two parts: operations and investment. A unit receives 0.7 points for operating (it is assumed all units will gain at least this score), and a unit can receive up to 0.3 points for the level of investment in the node.

There is a minimum investment of $20 for a unit to be eligible for rewards. When a unit has the minimum investment, it earns 50% of the total possible investment points - 0.15. This gives a node with the minimum investment amount a score of .85.

For all investment above the minimum, there are diminishing marginal returns with the optimal investment being $50, which gives 90% of the total possible investment points - 0.27 - and an overall score of .97

For further reference, here are the percentages of the total possible investment points (0.3) for each investment level.

$20 - 50% (of 0.3) --> .15

$25 - 65%

$30 - 75%

$35 - 81%

$40 - 85%

$45 - 88%

$50 - 90%

This is calculated by an arctan diminishing marginal returns function, the second derivative of which is 0 at $50.

--

How can I write an equation that shows how an actor chooses how many units to build and how much money to put in each unit?

sentences:
Rigidbody2D without pushing eachother on collision TLDR; How to stop movement if two Rigidbodies collides?

Also,  here's a potato video of the problem: https://gfycat.com/ComposedArcticBetafish

Say I have three objects in a scene:

Player
Enemy
Rock

The player and enemies is moving freely, but the rock is static. So I attached a Rigidbody2D on player and enemy to move them around with script. All of them has a Box Collider 2D.

Now, if I (Player) move into an Enemy, I will start to push it (changing its position). I don't want this.
I can set the Enemy's mass to something large, but then two enemies can still push eachother. I don't want this. If I try kinematic solutions I've found, but then they can move through the rock.

I want:

Player can not move enemies
Enemies can not move players
Enemies can not move each other
Nothing can move or go through the rock
Enemies can not move through player
Player can not move through enemies

I keep reading that if I'm moving colliders, I should also use Rigidbodies for performance. But I can't see how I get this to work with Rigidbodies.

How do I set it up? Or should I move away from rigidbodies and set it up myself?

sentences:
Texture filtering of look-up table in post process shader I am doing post processing by drawing to an FBO and then applying a certain fragment shader when drawing the FBO's texture to the screen. I want to use a look-up table texture to apply color grading. Since I am targeting OpenGL ES 2.0 and possibly older PCs, I cannot use 3D textures. Instead I can use a 2D texture as an atlas of the layers of my 3D look-up table.

What I'm concerned about is correctness and performance when the texture lookup is performed. My look-up texture needs to have linear filtering so I don't have to have a full 256^3 sized look-up table to cover all hues.

My fragment shader would look something like this: Round B up and down to get the two regions of the texture to sample from, add offsets accordingly to R/G and sample the texture twice with the two offset .rg values. And finally linearly interpolate based on B.

But I as I understand it, the when the GPU encounters a texture2D call on a texture with linear filtering, it will be calculating the input coordinates for those calls for neighboring pixels in parallel to get a derivative. This derivative is used to determine how to sample the texture pixels.

Since this is a post process, I don't want two neighboring pixels to influence each other. It could be a black pixel from the edge of a sprite next to a bright blue sky pixel. In the look-up table, these two would need to sample distant points. So is the GPU going to decide the derivative is huge (minification) and try to linearly sample and involve all the random in-between texels on my look-up table?

Is there a way to get my linear filter to ignore neighboring pixels and only interpolate from the 4 nearest texels? Sort of like treating everything as magnification?

The problem is similar to this question that was asked in regards to HLSL, but I'm targeting OpenGL 3.0 and OpenGL ES 2.0: Color grading, shaders and 3d textures

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 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:
Procedural terrains in 3D: what has been done ? Are there common algo and/or theories about it? Besides programming, modeling an environment takes a great deal of time.

I don't know about the work time involved, for example, in a WoW dungeon level, or other beautiful city-like, future environment, jungles, fantasy, etc, but this kind of work is made from scratch by artists.

What are the techniques involved in the TorchLight level randomizer, and does other titles have similarities with this ? Is there a family name for such techniques ?

sentences:
Random Range Without Duplicates I have an array of gameobjects (some questions) if player hit some triggers a question from the array is displayed randomly, I want to avoid duplication of displaying questions.

 public GameObject[] Q;
 public static int ColliderCounter = 0;
 int WrongAnswerCounter = 0;
 public int i,old;

 private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Obstcle")
        {
            i = Random.Range(0, Q.Length);
            old = i;
            ColliderCounter++;
            Q[i].SetActive(true);
            GetComponent<PlayerMovement>().enabled = false;
        }

    }

 IEnumerator waitWrongAnswer()
    {
            WrongAnswerCounter++;

            yield return new WaitForSeconds(3f);
            Q[old].SetActive(false);
            i++;
            Q[i].SetActive(true);
            old = i;
    }

And I want to know how to check if all questions are displayed do something.

Thanks in advance

sentences:
Percentage based half circle filling I am trying to re-create this:

So what I did is, made an half-circle image, filled with red, and set a TextureRegion, and used setRegionHeight for given percentage:

public void setDamage(int d) {
    int height = damage.getTexture().getHeight();

    double val = (double) d / 100;
    damage.setRegionHeight((int) Math.round(val * height));
}

I did the same for the water one

And called after creating:

water.flip(false, true);
bilge.flip(false, true);
setDamage(70);
setWater(30);

I had to flip it aswell y-wise.

And it looks like this:

Doesn't look right, because it fills in a straight line, like I guess it would.

What methods can I use to create that filling look? I know I can use ShapeRenderer but I am not sure how, maybe use the circle equation and use half circle and fill lines at each degree based on the percentage set on damage? I would be happy to get some ideas

sentences:
PyBox2D car moves uncontrollably I am trying to program TopDown Car using python and Box2D (similar to this tutorial: http://www.iforce2d.net/b2dtut/top-down-car ) The steering is so far limited to thres states of wheel rotation, that I will need to solve later, now
I have problem with controlling the car velocity.

The problem is that the vehicle moves rather uncontrollably, I press "W" to move forward, "A" or "D" to steer, but then I ofttimes need to press "S" key to keep going in forward direction (which is of course counter-intuitive).

EDIT: I tried to convert world/object coordinates, it helped partially because now my car is moving from the beginning in straight line (it was always going slightly obliquely to the right, but now it has problems with turning, it turns uncontrollably and there is still the problem with messed-up directions (when I need the car to go forward after turning i have to press S

This is the main game loop: it should be updating PyGame frame 60 times per second, in Every frame I am cancelling lateral velocity of a body and then I am trying to controll the body

while running:
# Check the event queue
    screen.fill((255, 255, 255,0))
    for body in world.bodies:
        for fixture in body.fixtures:
            fixture.shape.draw(body, fixture)

        # Cancelling lateral velocity
        for wheel in Wheels:

            if wheel in range(2):
                continue # Rear wheels are not powered
            else:
                Current_Normal = wheel.GetWorldVector((0,1))
                Current_N_Squared =  b2Dot(Current_Normal, wheel.linearVelocity) * Current_Normal

                Right_Normal = wheel.GetWorldVector((1,0))
                Right_Normal_Squared = b2Dot(Right_Normal, wheel.linearVelocity) * Right_Normal

                Impulse = -Right_Normal_Squared * wheel.mass
                if Impulse.length >max_lateral_impulse:
                    Impulse *= max_lateral_impulse/Impulse.length

                wheel.ApplyLinearImpulse(Impulse, wheel.worldCenter, True)

                # Allowing skidding

                aimp = 0.05 * wheel.inertia * -wheel.angularVelocity
                wheel.ApplyAngularImpulse(aimp, True)

                current_forward_speed = Current_N_Squared.Normalize()

                drag_force_magnitude = -2 * current_forward_speed
                wheel.ApplyForce(drag_force_magnitude * Current_N_Squared,
                                        wheel.worldCenter, True)

        # Moving forward/backward
    if event.type == KEYDOWN and event.key == K_w:
        Left_Wheel.ApplyLinearImpulse(impulse=Left_Wheel.GetWorldVector((0, 10)), point =Left_Wheel.GetWorldVector((Left_Wheel.position)),wake = True)
        Right_Wheel.ApplyLinearImpulse(impulse=Right_Wheel.GetWorldVector((0, 10)),point = Right_Wheel.GetWorldVector((Right_Wheel.position)),wake = True)

    elif event.type == KEYDOWN and event.key == K_s:
        Left_Wheel.ApplyLinearImpulse(impulse=Left_Wheel.GetWorldVector((0, -10)), point =Left_Wheel.GetWorldVector((Left_Wheel.position)),wake = True)
        Right_Wheel.ApplyLinearImpulse(impulse=Right_Wheel.GetWorldVector((0, -10)),point = Right_Wheel.GetWorldVector((Right_Wheel.position)),wake = True)

If you want to play with my code in order to better see where the problem is I can give you the whole script (270 lines in total)

I know that to move more realistically I need to play with the aimp or max_lateral_velocity values. But first I need the car to be controlled better

EDIT 2: I am sorry, I was probably able to solve this problem by applying this:

Left_Wheel.ApplyLinearImpulse(b2Vec2(Left_Wheel.GetWorldVector((0, 10))), Left_Wheel.position,True)
Right_Wheel.ApplyLinearImpulse(b2Vec2(Right_Wheel.GetWorldVector((0, 10))), Right_Wheel.position,True)

This seems to be working, many thanks to Aleš Koblížek for patience Now my problem seems to be solved

sentences: Why do games have hats? I noticed that a lot of games tend to have hats.  I was wondering why?  Is it some sort of tradition to add hats to your games?  What makes this trend so popular in game development?

sentences:
How to "place" object in a 3d world without overlapping them ? I would like to place object  in a 3d world "like minecraft player can do".

What I'm trying to do is to allow the user to place objects, without overlapping them (like in minecraft you can do).

So if the player try to place an object partially over another, my  game automatically "move and place" the object in the allowed position.

What can be the right approach ?

sentences:
Switching bezierpath to follow SpriteKit swift I am trying to make it so that a SKShapeNode follows a UIBezierPath. Then when the screen is tapped it switches to another UIBezierPath to follow. I have this functionality working except that when the screen is tapped the shape node moves back to where it started. I want it so that when the screen is tapped the circle does not go back to where it starts. Here is my code.

override func didMoveToView(view: SKView) {
    //screenWidth and screenHeight
    screenWidth = view.bounds.width
    screenHeight = view.bounds.height

    // Set up the circle track
    let trackWidth = screenWidth/3

    let circleTrack = UIBezierPath(roundedRect: CGRectMake(screenWidth/2 - trackWidth/2, screenHeight/2  - trackWidth/2, trackWidth, trackWidth), cornerRadius: 100)
    let shapeTrack = SKShapeNode(path: circleTrack.CGPath, centered: true)
    shapeTrack.position = CGPointMake(screenWidth/2, screenHeight/2)
    shapeTrack.strokeColor = UIColor.whiteColor()
    self.addChild(shapeTrack)

    //Outside track
    outsideTrack = UIBezierPath(roundedRect: CGRectMake((screenWidth/2 - trackWidth/2) - trackWidth*0.08, (screenHeight/2  - trackWidth/2) - trackWidth*0.08, trackWidth + trackWidth*0.16, trackWidth + trackWidth*0.16), cornerRadius: 100)

    //Inside track
    insideTrack = UIBezierPath(roundedRect: CGRectMake((screenWidth/2 - trackWidth/2) + trackWidth*0.08, (screenHeight/2  - trackWidth/2) + trackWidth*0.08, trackWidth - trackWidth*0.16, trackWidth - trackWidth*0.16), cornerRadius: 100)

    //Set the default track
    track = outsideTrack

    // Create the ball
    circle = SKShapeNode(circleOfRadius: 15)
    //circle.position = CGPointMake(screenWidth/2, screenHeight/2)
    circle.fillColor = SKColor.whiteColor()
    self.addChild(circle)

    //Move the circle
    let followPath = SKAction.followPath(track.CGPath, asOffset: false, orientToPath: false, speed: 200.0)
    let repeatForever = SKAction.repeatActionForever(followPath)

    //Move the circle
    circle.runAction(repeatForever)
}

//Movement of circle
func movemementOfCircle(){
    if track == insideTrack{
        track = outsideTrack
    }else{
        track = insideTrack
    }

    //Actions
    circle.removeAllActions()
    //Move the circle
    let followPath = SKAction.followPath(track.CGPath, asOffset: false, orientToPath: false, speed: 200.0)
    let repeatForever = SKAction.repeatActionForever(followPath)

    //Move the circle
    circle.runAction(repeatForever)
}

sentences:
SharpDx Custom effect in SpriteBatch I'm trying to port a blur effect from an XNA project over to SharpDx, and I get a "Null Reference Exception" wich I'm unable to find the reason for.

    private void blurShadow(RenderTarget2D to, RenderTarget2D from, int dir)
    {
        _graphicsDevice.SetRenderTargets(to);
        _shadowBlurEffect.CurrentTechnique.Passes[dir].Apply();
        _spriteBatch.Begin(SpriteSortMode.Deferred, _shadowBlurEffect);
        _spriteBatch.Draw(from, Vector2.Zero, Color.White);
        _spriteBatch.End();  // <-- Null Reference Exception here
    }

    public void Draw()
    {
        _graphicsDevice.SetRenderTargets(_graphicsDevice.DepthStencilBuffer, ShadowDepthTarget);
        _graphicsDevice.Clear(Color.White); // Clear the render target to 1 (infinite depth)
        foreach (var obj in ShadowCastingObjects)
            obj.Draw(Camera, DrawingReason.ShadowDepthMap, this);

        blurShadow(_shadowBlurTarg, ShadowDepthTarget, 0);
        blurShadow(ShadowDepthTarget, _shadowBlurTarg, 1);

        _graphicsDevice.SetRenderTargets(_graphicsDevice.DepthStencilBuffer, _graphicsDevice.BackBuffer);
    }

The render targets are created like this:

    ShadowDepthTarget = RenderTarget2D.New(_graphicsDevice, width, height, PixelFormat.R16G16.Float);
    _shadowBlurTarg = RenderTarget2D.New(_graphicsDevice, width, height, PixelFormat.R16G16.Float);

This is the shader code, I have tried variuos versions of the method signatures - in vain:

Texture2D Texture;
SamplerState TextureSampler;

// Precalculated weights and offsets
float weights[15] = { 0.1061154, 0.1028506, 0.1028506, 0.09364651, 0.09364651,
    0.0801001, 0.0801001, 0.06436224, 0.06436224, 0.04858317, 0.04858317,
    0.03445063, 0.03445063, 0.02294906, 0.02294906 };

float offsets[15] = { 0, 0.00125, -0.00125, 0.002916667, -0.002916667,
    0.004583334, -0.004583334, 0.00625, -0.00625, 0.007916667, -0.007916667,
    0.009583334, -0.009583334, 0.01125, -0.01125 };

float4 BlurHorizontal(
    float2 UV : TEXCOORD0) : SV_Target
{
    float4 output = float4(0, 0, 0, 1);
    for (int i = 0; i < 15; i++)
        output += Texture.Sample(TextureSampler, UV + float2(offsets[i], 0)) * weights[i];
    return output;
}

float4 BlurVertical(
    float2 UV : TEXCOORD0) : SV_Target
{
    float4 output = float4(0, 0, 0, 1);
    for (int i = 0; i < 15; i++)
        output += Texture.Sample(TextureSampler, UV + float2(0, offsets[i])) * weights[i];
    return output;
}

technique Tech
{
    pass Horizontal
    {
        SetGeometryShader(0);
        SetVertexShader(0);
        SetPixelShader(CompileShader(ps_4_0, BlurHorizontal()));
    }

    pass Verical
    {
        SetGeometryShader(0);
        SetVertexShader(0);
        SetPixelShader(CompileShader(ps_4_0, BlurVertical()));
    }
}

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:
OpenGL 3+ Range Picking How do I perform range picking in the latest OpenGL version? By range picking I mean selecting all objects which are picked using a selection rectangle, like in an RTS game.

For single object picking I'm using the ray picking method, which I guess can be used in this case as well, but I'm not sure how I should go about doing that.

Could you give me any pointers?

Thank you.

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:
Should I use object references or integral values to store pieces in a chess board? just a general question regarding a checkers project. I built a class hierarchy for the game pieces (that could be extended for chess etc). The hierarchy looks something like

interface GamePiece() {...}
class EmptySquare implements GamePiece {...}
class Pawn implements GamePiece extends EmptySquare {...}
class Queen implements GamePiece extends EmptySquare {...}

I store an object reference in the board[][] array. In the tree search that array is cloned for each recursion (not with doMove() ... call recursion ... undoMove()). I store object refs for the game pieces so I can do something like this for generating the list of moves:

for(sq:Squares)
    sq.getPossibleMoves()
    possibleMoves.addAll(sq.possibleMoves)

I'm not sure how much space this array of references takes up and if that is any good way to it from a performance point of view. It works nicely logically though. Would you do it like that or sacrifice the nicer code for a more compact game board array and the use switch() to call subroutines for each piece to make the move list?

sentences:
What are the options when float textures aren't precise enough? I am currently experimenting with rendering planetary scale terrain.

I am generating the terrain on the GPU with noise, and to fix the 32 bit floating point precision problems, I generate the heightmaps that need the most precision (the deepest levels of the quadtree I am using for the level of detail) by bicubically interpolating the heightmaps generated for the parent heightmaps (that are generated with normal 32 bit floats, since they don't need a lot of precision).

Doing it this way limits the amount of details the terrain can have, because the smallest details are generated with 32 bit floats, and if more detail is needed, bicubic interpolation is used to generate the intermediate height values.

The issues with this is that if I want extremely detailed terrain, 32 bit float textures (I store the heightmaps in those) are not precise enough, resulting in terraced terrain.

Is there a way I can store more distinct values inside a texture?

Thanks.

sentences:
What is the correct and most efficient approach of streaming vertex data? Usually, I do this in my current OpenGL ES project (for iOS):

Initialization:

Create two VBO's and one IndexBuffer (since I will use the same indices), same size.
Create two VAO's and configure them, both bound to the same Index Buffer.

Each frame:

Choose a VBO/VAO couple. (Different from the previous frame, so I'm alternating.)
Bind that VBO
Upload new data using glBufferSubData(GL_ARRAY_BUFFER, ...).
Bind the VAO
Render my stuff using glDrawElements(GL_***, ...);
Unbind the VAO

However, someone told me to avoid uploading data (step 3) and render immediately the new data (step 5). I should avoid this, because the glDrawElements call will stall until the buffer is effectively uploaded to VRAM. So he suggested to draw all my geometry I uploaded the previous frame and upload in the current frame what will be drawn in the next frame. Thus, everything is rendered with the delay of one frame.

Is this true or am I using the good approach to work with streaming vertex data?

(I do know that the pipeline will stall the other way around. Ie: when you draw and immediately try to change the buffer data. But I'm not doing that, since I implemented double buffering.)

sentences:
Rotating according to ground normal on Unity 3D I know there are already some threads about this, but my problem isn't exactly with the algorithm itself.
I was able to use RayCast and get the ground normal, using it to store the rotation necessary to align to the ground in a quaternion using:

slopeRotation = Quaternion.FromToRotation (transform.up, hit.normal);

Where hit.normal is the normal of the ground. After this, I check whether the player is moving (the user is moving the joystick axis) or standing still. If it's standing still, I align it with the ground using:

transform.rotation = Quaternion.Slerp(transform.rotation,slopeRotation * transform.rotation,10*Time.deltaTime);

When the player is moving, I rotate using:

transform.rotation = Quaternion.Slerp (transform.rotation,slopeRotation *camRotation*movementRotation , 10 * Time.deltaTime);

Where camRotation is simply the rotation of the MainCamera(a third person one) on the Y axis and movementRotation is the rotation of the joystick axis, also on the Y axis, calculated using:

movementRotation = Quaternion.LookRotation (new Vector3(Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical")));
camRotation = Quaternion.Euler (0, cam.transform.rotation.eulerAngles.y, 0);

Although the code above makes sense in my head, it doesn't work as expected, as seen in the picture below:

As you can see, it works fine when you're standing still, which means that the ground normal and the slopeRotation are correctly calculated. When the player moves though, the combination of all the quaternions seems to cause some kind of problem that makes the player slightly deviate from the correct rotation.
It might be worth noting that camRotation and moveRotation also work completely fine on their own, so the player moves correctly according to both the rotation of the camera and of the joystick, both on the floor and on ramps.

sentences:
How to drag an object with mouse with collision? I want to drag a GameObject with the mouse but I need collision. The basic mouse dragging code simply sets the position of the object to the hit.point with an offset from the difference at the start of the drag.

As for collision, I've tried using kinematic rigidbodies and setting the position with rigidbody.MovePosition(uh) but that allows the object to rotate while pushing it up against a corner on one side.  With rotation constraints enabled, it flickers a lot and still intersects a lot. I also tried playing with collision detection and interpolation. None of the settings improved it.

I also tried Physics.ComputePenetration but that is extremely messy because some of the objects I'm dragging, have several colliders. The distance it calculates is per collider so it doesn't calculate the offset required to separate the entire object. I tried disabling all the colliders and then adding a single box collider sized to fit the bounds of the object. That had bad flickering problems.

The last thing I tried was box casts on each side that would find the closest point and offset the mesh in that direction. But if I moved the mouse too fast it would go inside the other mesh and would no longer register any colliders intersecting the box casts. It also suffered from flickering problems.

Ideally, I want to have fairly accurate detection. I don't want to approximate the other colliders (not the ones on the object I'm dragging). Assume the other colliders could be any type (box/capsule/sphere/mesh).

The image below shows the problem I'm having. The green dot shows approximately where the cursor was (also the hit.point from the raycast on the surface of the red cube). What I expect is that the couch should be offset so that it was close to the cursor but prioritizes not intersecting other meshes over sticking to the mouse.

sentences:
Handling different screen sizes in multiplayer games sorry if this has been asked already. I did some checking around and couldn't find any helpful advice.

I'm developing my first multiplayer game, and it'll be fullscreen when run. My issue is, how do I balance for screen sizes? It seems to me that it might be considered unfair if some players can see more of the playing field than others, and it's not an issue I'd ever considered before since all my previous projects have been single player and usually fixed resolution.

Some options I'd thought of is a zoomable map, so players can handle how much of the screen they see to give them the choice between clarity and view distance. Another was a fixed internal resolution and black bars or sidebars if it's out of the aspect ratio.

Thanks in advance for any help.

sentences:
Should Draw method calculate the element's screen location? Should Update take care of calculating the drawing position of element or should it be done exlusively in Draw method?

If I calculate the drawing position of element in Update and then store it as element property then I can reuse it in Draw method. I can only run the update if the element (or camera) moved so it seems it would be good for performance. Is this good approach? Or should I never store the draw position of an element and always calculate it in Draw method?

EDIT:

It seems my question wasn't clear enough. I'm not talking about elements Draw method but the Draw method of manager/renderer that draws them on the screen. The elements themselves do not have Draw method.

sentences: How do I override a SteamVR Controller's transforms in Unity? I'm trying to provide an illusion to the user by rotating the controller about an arbitrary axis in the LateUpdate() method. But this doesn't seem to be having any effect as the controller probably is constantly getting updated by its real world location. Is there any way to override its real world position and orientation with a transformation in script?

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:
what is the best way to eliminate grinding in games? This is a very persistent question in game design, especially in games where you need to hold/retain players like MMO or social games. (On a side note grinding can easily calculated so its easy tool for engagement and timed progression).

The question other than community building/competition are there solutions that can replace grinding and still hold your audience for certain period of time (without adding large amounts of game assets and code)?

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:
How to fix overly blurred texture / image in unity? so, I'm not sure what caused this, let image below do the explanation :

How to fix the overly blurred texture in unity? It's so frustrating, since I can't get it right, because when I tried it in LibGDX, the image looks good (Well, it's not exactly a same image, but similar).

They both screenshot from android device (Samsung Galaxy Note 3 Neo)

Thanks

P.S. It's a pixel art

Edit, here's the screenshot of my relevant inspector window

And here's the alpha ingame screenshot

sentences:
Picking cells which form a completed line between to 2d grid cells I'm using Bresenham's line algorithm to calculate a "line" of cells between a start and end point on a 2D tile grid.

However, I'm using this during terrain generation to create a visible pathway, which means I need every cell to have at least one shared border with a neighbor.

This shows how the line algorithm is picking cells:

Yet if you imagine this as a road, there's no way to drive from one "segment" to the next.

How can I calculate a line that doesn't "jump" like this?

I've thought about using pathfinding or raycasting but they both feel like overkill because they worry about things I don't need here. I won't have obstacles to route around and I don't care about calculating ray intersections.

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:
Calculating the poly vertices based on the result of Connected Component Labeling I am making a tile based game.

And now I can find all the connected area using the Connected Component Labeling algorithm.

But now the problem I am having is how to calculate the poly vertices of each connected area.

For example:

As you can see all the YELLOW tiles are of the same AREA and with the help of Connected Component Labeling algorithm I know all the (x, y) info of each tile.

And now I want is the generate a poly vertices array for the YELLOW AREA POLY (clockwise).

Is there any good algorithm for this ?

Any suggestion will be appreciated, thanks :)

sentences:
How to generate a rotation matrix or a quaternion (properly rotated in regards to texture coordinates) for each triangle of a mesh? I'm trying to build a uniform grid made of 3D points over the surface of an arbitrary mesh (we have texture-coordinates for each vertex...)

Or to reformulate: imagine a mesh textured with a texture featuring equally spaced dots: I want to obtain the 3D coordinates of these dots.

So far, I'm able to generate a normal for each triangle of the mesh but it is not enough.

If I had the right matrix, or quaternion or even orthonormal-basis for each triangle, I guess that I could transform any 2D coordinates (on the triangle's plane) to 3D coordinates (in object space...)

The problem is how to rotate properly in regards to texture coordinates?

To be more specific: for each triangle, I can define a normal. It could serve as the x,y,z part of a quaternion. But how could I generate the w part?

sentences:
Unity SceneView Positionning object with mouse position in Editor script I would like to create an editor tool who can change the position of an object in the scene view into other object in the world, based on mouse position, like in the picture bellow (the red pyramid is my object to positionnate/rotate)

I would like to do a raycast from the scene view camera to the mouse position (or something like that), to get the gameObject over the mouse, and then get the position of the verticle / normal for position and rotation of my gameObject

For now, I have tryed some code who didn't work, I have my object named "preview", and inside the methode OnSceneGUI() in a editor script i have managed to move my preview object, but now I have to know where to put it...
Thanks !

EDIT: here some of my try:

Transform previewPoint; //here my transform

void OnSceneGUI()
{
   PointCreator();
}

 private void PointCreator()
  {
  //test 1
      Camera sceneCam = SceneView.GetAllSceneCameras()[0];
      Vector3 spawnPos = sceneCam.ViewportToWorldPoint(Event.current.mousePosition);
      previewPoint.position = spawnPos;

      //test 2
      Vector3 mousePosition = Event.current.mousePosition;
      mousePosition.y = SceneView.currentDrawingSceneView.camera.pixelHeight - mousePosition.y;
      mousePosition = SceneView.currentDrawingSceneView.camera.ScreenToWorldPoint(mousePosition);
      mousePosition.y = -mousePosition.y;

      previewPoint.position = mousePosition;

  }

sentences:
How can I increase text using scale and keep the text smooth in libgdx? I found that I can use DistanceFieldShader from here and found an example
but I couldn't make it work. First my whole screen becomes white, all the other actors that I have on screen disappears. second, the text that supposed to be smooth becomes to be black squares. whats wrong with my code? Or maybe someone can give me an example that suits my needs.

This class represents score in the game. (Maybe this should be actor and needs to be Label)

public class Score extends Actor {
    private int scoreInt;
    private BitmapFont scoreBitmapFont;
    private int x, y;
    private DistanceFieldShader distanceFieldShader;

    private Texture distanceFieldTexture;
    private BitmapFont distanceFieldFont;

    float scale = 1.5f;
    float smoothing;

    public Score(int x, int y) {
        this.x = x;
        this.y = y;
        scoreInt = 0;
        scoreBitmapFont = new BitmapFont();
        scoreBitmapFont.setColor(Color.BLACK);
        scoreBitmapFont.scale(scale);

        distanceFieldTexture = new Texture(Gdx.files.internal("default.png"), true);
        distanceFieldFont = new BitmapFont(Gdx.files.internal("default.fnt"), new TextureRegion(
                distanceFieldTexture), true);
        distanceFieldFont.setColor(Color.BLACK);

        distanceFieldShader = new DistanceFieldShader();

        // set filters for each page
        Texture.TextureFilter minFilter = Texture.TextureFilter.MipMapLinearNearest;
        Texture.TextureFilter magFilter = Texture.TextureFilter.Linear;

       scoreBitmapFont.getRegion().getTexture().setFilter(Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.Linear);
    }

    public void inc(int inc) {
        scoreInt = scoreInt + inc;
        if (scoreInt < 0) scoreInt = 0;
    }

    @Override
    public void draw(Batch batch, float alpha) {
        String scoreStr = String.format("Score: %d", scoreInt);
        smoothing = scoreBitmapFont.getBounds(scoreStr).width;
        batch.setShader(distanceFieldShader);
        scoreBitmapFont.draw(batch, scoreStr, x, y/* + scale * getBaselineShift(scoreBitmapFont)*/);
        distanceFieldShader.setSmoothing(smoothing / scale);

//        y += scoreBitmapFont.getLineHeight();
    }

    public int getScoreValue() {
        return scoreInt;
    }

    private float getBaselineShift(BitmapFont font) {
        if (font == distanceFieldFont) {
            // We set -8 paddingAdvanceY in Hiero to compensate for 4 padding on each side.
            // Unfortunately the padding affects the baseline inside the font description.
            return -8;
        } else {
            return 0;
        }
    }
}

sentences:
How to derive euler angles from matrix or quaternion? Currently working on steering behavior for my AI and just hit a little mathematical bump.

I'm in the process of writing an align function, which basically tries to match the agent's orientation with a target orientation. I've got a good source material for implementing this behavior but it uses euler angles to calculate the rotational delta, acceleration, and so on. This is nice, however I store orientation as a quaternion and the math library I'm using doesn't provide any functionality for deriving the euler angles. But if it helps I also have rotational matrices at my disposal too.

What would be the best way to decompose the quaternion or rotational matrix to get the euler information?

I found one source for decomposing the matrix, but I'm not quite getting the correct results. I'm thinking it may be a difference of column/row ordering of my matrices but then again, math isn't my strong point. http://nghiaho.com/?page_id=846

sentences:
Most efficient way to get the closest point to a 3d rectangle I have a 3D rectangle, with 4 points (x,y,z)
And I have a player, who can be anywere (inside the rectangle, outside, not even in the plane, in the corner...).

I would like to get the closest point in that rectangle, to my player. The most efficient way

I have already a struct who can say the closest point to a line:

public struct ExtLine
{
    public readonly Vector3 A;
    public readonly Vector3 B;
    public readonly Vector3 Delta;
    public bool noGravityBorders;//if I want to return true only if player is in the boundary

    public ExtLine(Vector3 a, Vector3 b, bool _noGravityBorders)
    {
        A = a;
        B = b;
        Delta = b - a;
        noGravityBorders = _noGravityBorders;
    }

    public Vector3 PointAt(double t) => A + (float)t * Delta;
    public double LengthSquared => Delta.sqrMagnitude;
    public double LengthLine => Delta.magnitude;

    public Vector3 ClosestPointTo(Vector3 p)
    {
        //The normalized "distance" from a to your closest point
        double distance = Project(p);

        if (distance < 0)     //Check if P projection is over vectorAB
        {
            if (noGravityBorders)
                return (ExtUtilityFunction.GetNullVector()); //an extention who give me an "null vector", not useful here
            return A;
        }
        else if (distance > 1)
        {
            if (noGravityBorders)
                return (ExtUtilityFunction.GetNullVector());
            return B;
        }
        else
        {
            return A + Delta * (float)distance;
        }
    }

    public double GetLenght()
    {
        return (LengthLine);
    }

    public double Project(Vector3 p) => Vector3.DotProduct(Delta, p - A) / LengthSquared;
}

And a struct who can say the closest point to a plane:

public struct ExtPlane
{
    public Vector3 Point;
    public Vector3 Direction;

    public ExtPlane(Vector3 point, Vector3 direction)
    {
        Point = point;
        Direction = direction;
    }

    public bool IsAbove(Vector3 q) => Vector3.DotProduct(q - Point, Direction) > 0;

    public Vector3 Project(Vector3 randomPointInPlane, Vector3 normalPlane, Vector3 pointToProject)
    {
        Vector3 v = pointToProject - randomPointInPlane;
        Vector3 d = Vector3.Project(v, normalPlane.normalized);
        Vector3 projectedPoint = pointToProject - d;
        return (projectedPoint);
    }
}

How can I manage to find my point ?
Thanks for help !

sentences:
How do I remove the background from pixel art sprites in Gimp? I drew a pixel art tree using GIMP. My problem is, how can I cut out the white background, because if I want to build a tile map with it, in my case with tiled, it always has the white background with it.

I know you can cut it manually, but I want to know whether there is an easier way.

sentences:
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:
In Unity, on an Android device, CaptureScreenshot writing to Phone, but persistentdatapath linking to the external card I'm using CaptureScreentshot() to get an image. But when I try to access it on an Android device it's giving me:
Could not find file "/storage/emulated/0/Android/data/appname/screenshot.png"

When I go the external storage, it's not there, but rather on the phone storage. So why is persistentdatapath accessing something different?

My code is the following:
byte[] Bytes_File = System.IO.File.ReadAllBytes(currentScreenshotPathname); with thepathname obtained using:
currentScreenshotPathname = System.IO.Path.Combine(Application.persistentDataPath, currentScreenshotName);

Is there anyway to make the persistenDataPath go to the phone storage rather than emulated to read the file? I've tried changing the WriteAccess perimission to Externalas well as Internal in the player settings, but it's still the same.

Edit: Here's what's happening:
PersistentDataPath is /storage/emulated/0/Android/data/myapp/files/, but the screenshot is being saved to /mnt/sdcard/Android/data/myapp/files, despite the documentation saying that it should save to the PersistentDataPath.

sentences:
Mirror/Unet, RegisterSpawnHandler throws invalid asset Id error because assetId is 0 for dynamically loaded assetbundles Its weird how documentation literally states that

For more advanced uses, such as object pools or dynamically created
Assets, you can use the ClientScene.RegisterSpawnHandler method

But seems like its broken, because dynamically loaded objects' assetIds' are always 0:
(This is true for all other dynamically spawned objects)

My code structure:
I have a "MapLoader" script that loads objects from filesystem using its config file.
MapLoader creates vehicles and assigns them unique UIDs that are same across players.
Vehicles are added into Static dictionary with UID -> vehicle key/value pairs, and to a list of GameObjects:
        VehicleNetworking vehicleNet = spawned.AddComponent<VehicleNetworking>();
        vehicleNet.vehicleScript = vehicleScript;
        vehicleNet.uid = uid;

        spawned.tag = "vehicle";
        spawned.layer = 10;

        GameManager.vehiclesToSpawn.Add(spawned);
        GameManager.AddVehicle(vehicleNet);
    }

After vehicles have been added, I call functions on the local Player object to spawn them:
  foreach (GameObject vehicle in GameManager.vehiclesToSpawn)
    {
        if (isServer)
        {
            SpawnServerVehicles(vehicle);
        }
        else
        {
            SpawnClientVehicles(vehicle);
        }
    }

Spawn scripts:
[Server]
void SpawnServerVehicles(GameObject vehicle)
{
    Debug.Log("Server should spawn: " + vehicle.name);
    NetworkServer.Spawn(vehicle);
}

[Client]
void SpawnClientVehicles(GameObject vehicle)
{
    Debug.Log("Client should spawn: " + vehicle.name);

    MD5 md5 = MD5.Create();
    string vehicleId = vehicle.GetComponent<VehicleNetworking>().uid;
    byte[] hash = md5.ComputeHash(Encoding.Default.GetBytes(vehicleId));

    Guid result = new Guid(hash);
    Debug.Log(vehicle.name + "-" + result);
    ClientScene.RegisterSpawnHandler(result, SpawnHandler, UnSpawnHandler);
}

Spawn handlers:
private static GameObject SpawnHandler(Vector3 position, Guid vehicleGuid)
{
    Debug.Log("Called Spawn Handler");
    GameObject go = new GameObject();
    return go;
}

private static void UnSpawnHandler(GameObject gameObject)
{
    Destroy(gameObject);
    Debug.Log("Called UnSpawn Handler");
}

If I am doing everything right, and Mirror library is actually broken, then I'd like to know what could the workarounds be?
My goal is to have SyncVars on vehicles working and syncing with the server(But for this, I need to have NetworkIdentity on vehicles, and for them to work, they need to be spawned using NetworkServer or ClientScene).

sentences:
Is it appropriate approach to simulate shadowing via occlusion culling of lights? I have own deferred renderer and a scene with both closed and open spaces. I want to prevent light passing though solid objects. For example, there can be a house with a lot of point lights inside. I want to prevent lighting of objects outside the house, but it is not always possible to adjust appropriate falloff distance.
And it seems that creating shadows maps for each of them will require a lot of time and memory. So I could try another approach - create some set of bounding primitives for each light source and perform occlusion culling with all of them to determine whether some space is affected by the source.
Is this method appropriate for the described situation or maybe is there any other methods to simulate shadowing?

sentences:
Choppy edges with sub pixel movement MonoGame/XNA 4 When I move a texture slower that one pixel it moves using sub pixel movement inside but the edges jumps from pixel to pixel.

Video : https://www.youtube.com/watch?v=zcai1PUfzzA

Sorry for the low quality (Its hard to see), I'm using linear filtering. How do I fix it so everything moves smooth?

spriteBatch.Begin();
spriteBatch.Draw(texture, position, Color.White);
spriteBatch.End();

sentences:
Unity: Record real time game play in high quality using offline rendering? I'm looking to record Unity gameplay at really high quality (360 Stereo 8k 120 fps). I can't do this in real time due to the GPU resources required so I need to do offline rendering (frame perfect rendering).
The problem is offline rendering by its nature doesn't accept user input, so I can't record live gameplay footage. I'm looking for a solution that lets me record live gameplay and then render it out at this higher quality.
I considered recording the user input or the gameobjects properties and then playing them back while rendering the footage. I tried a number of assets like Ultimate Replay 2.0, Record and Play, GameObject Recorder, even tried Unity Recorder to an animation but none of them record all of the changes to components on a gameobject. I think I'll have to write my own code, although I'm not sure what the best method would be, I'm reluctant to sink to much development time into this if there's an easier solution that I've overlooked?
Initially I'm looking for a solution that works inside the Unity editor but would love to be able to give this ability to end users.

sentences:
Blurred sprite in Scene view The thread between the tree and the spider here is a LineRenderer.

When the BackgroundLandscape or the Tree objects are selected it has this blur around the thread between the tree and the spider.

When anything else is selected, it renders correctly.

It always renders correctly in the Game view.

What's causing this?

sentences:
SDL2 jagged/staircase edges I am using SDL2 and SDL2 Image to render png images.

When I rotate the textures, they turn out very ugly, like this:

This is the code responsible for the rotation and alpha mod.

SDL_Rect srcRect;
SDL_Rect destRect;
srcRect.x = width * currentFrame;
srcRect.y = height * currentRow;
srcRect.w = destRect.w = width;
srcRect.h = destRect.h = height;
destRect.x = x;
destRect.y = y;

SDL_SetTextureAlphaMod(m_textureMap[id], alpha);
SDL_RenderCopyEx(pRenderer, m_textureMap[id], &srcRect, &destRect, 10.0, 0, flip);

Do I need to set a blendmode too?

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 can I reduce a bezier curve using a slider till all points converge to it's original midpoint I am using the code from the question here to create bezier curves (I didn't think it was necessary to repost the code here since I haven't made any significant changes to it yet).

I have a symmetric bezier curve (please see image) that I want to reduce till all points converge at the midpoint of the original curve. I would like to preserve it's symmetry while it moves.
I would like achieve this using a  float slider (with values from 0 to 1) in editor mode.

sentences:
Unity 2D rigging parts order Hello I have some 2d character in sprite I've rigged to use in Unity 2D.Something like this, with separate body parts.
 Although I've used weights and geometry, these body parts are supposed to move independent of each other, so there is no stretching/blending (or whatever you call it) of the shapes/body parts. Now I've created the rig successfully, I realize that these body parts are no at the order I want, meaning some parts are overlapping others in the wrong order. How should I fix that?

sentences: I would really like to write a script for a game, but do I have a chance? I'm 18 and am very good a reading writing and storytelling. I would like to write out the concept script and scenes for a vdeogame. I have a High School diploma but at the moment no other formal schooling. I would like my dream to become a reality, a game I wrote that gets created by a big name developer and published for everyone to enjoy. Before I start writing though I want to know is this achievable from the position I stand in now?

sentences:
What is the easiest and fastest way to display an SDL_Surface in a window with SDL2? I would like to have an SDL_Surface representing the contents of the window, just like in the old days with SDL1.2. What is the best and fastest way to do it in SDL2?

What I found is that I need an SDL_Window, an SDL_Renderer for that window, an SDL_Texture to render, and an SDL_Surface to create a texture from. This seems a bit too much to me, since I just want to display a single image on the screen.

Not to mention the impact on the performance. On my machine (Lenovo Y510p laptop) this whole procedure takes 9ms, without any memory allocation, only using pre-allocated variables and totally black SDL_Surface.

Is there a way I could speed up things?

sentences:
How to design a useful scripting system? I have decided to use the Squirrel (probably doesn't matter much for this question) scripting language in my C++ project. I'm wondering how game developers usually handle scripting in their games. I've managed to run scripts, bind functions etc. - that is not the problem. I'm just not sure how a scripting system is actually implemented in a sensible way.

So far I have got a singleton ScriptManager, which owns a virtual machine and can interact with it.

Some specific questions:

Does every functionality, that you want to control with scripts, need to be bound manually or can you somehow make all functions/classes available to your scripts? (I do not intend to use scripting everywhere in the final game, but it would make the development  process a whole lot easier.)
How should squirrel scripts be structured? Should they represent some kind of library, that you load, or just a set of commands that get executed whenever a game object wants to? If the former approach is better, how would such a library look like and how would the execution of the script be triggered?

I would be great if you could point me into the right direction!
Thanks!

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:
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:
Random generation of a board So I have four "boards" made of 16 sprites (4x4). Each board is parented to an empty GameObject. I would like to randomly generate their positions but I am not sure how. However, they should still be generated at the middle of the screen not like anywhere off. So basically each board can be placed at any position but must touch at least one of the boards. The sprite of one board should line up with the sprite of the other board. For example:

So yeah any help is appreciated!

sentences:
Access alpha value of opengl texture pixels I'm trying to get the alpha values of each pixel of an image that I'm loading onto a texture so i can use it to check for per pixel collision.
I have a texture class:

struct GLTexture {
    std::string filePath = "";
    GLuint id;
    int width;
    int height;
    std::vector<std::vector<int>> alphaPixels;
};

When i bind the texture i want to do something like this:

//Generate the openGL texture object
glGenTextures(1, &(texture.id));

//Bind the texture object
glBindTexture(GL_TEXTURE_2D, texture.id);
//Upload the pixels to the texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &(out[0]));

for(int i = 0; i < width; i++)
{
    for(int j =0; j<height; j++)
    {
        alphaPixels[i][j] = getAlpha(GL_TEXTURE_2D); ///<something like this line but i don't know how to access to alpha value
    }
}

How can i get the alpha value of each pixel of the image? Is this even a feasible thing to do or is there a better way to do this?

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 count rotations or spins when using addtorque? I have a rigidbody and use 4 keys to addtorque in 4 different directions:

W adds torque positively along the X axis (pitch forward)
S adds torque negatively along the X axis (pitch backward)
A adds torque negatively along the Y axis (yaw left)
D adds torque postively along the Y axis (yaw right)

The rigidbody is able to rotate around/spin in any combination of these directions, but my issue is how can I count the number of rotations it has done in any given axis? Eg. if the player has completed 2 360 rotations to their left I would like to display "2 Left Spins" etc.

I have tried storing the eulerangles of each axis but this is no good as it resets after certain degrees.

I think the way it could work is on keydown reset a degrees counter, while the key is being held I could continue to store the change in rotation for that axis, and then on keyup I could divide this total number of degrees by 360. I'm not sure how to do this in C# though, or if this is the best way to do this.

How could I do this?

sentences:
Is Angry Birds Made Purely Using Bitmaps/Raster graphics? Being a beginner game developer I would like to start creating my own engine and graphics so I am concerned about how successful games accomplish the graphics portion.
My question is, are all the graphics (background, birds, slingshot etc) in Angry Birds made with raster images only and using something like a sprite sheet for character animations?

sentences: Return different components by name in entity component system I'm working on an entity component system but I'm having trouble with the editor. Components take the form of structs with this formula Component healthComponent; This works fine when you know what component you want but for the game editor I'm working in a dynamic way and need to be able to simple get any component of an entity by string for example auto component = GetComponent("Health", entityId); I know c++ is strongly typed so is there any work around for this?

sentences:
object smooth orbital limit around another object depending on mouse drag I am working in Unity.

I have special objects that can each be dragged freely around in 2d.

The objects cannot get too close to other objects (minimal Vector3.distance allowed is 1.5f).

I also have special connectors, which I can apply freely between 2 of any of these special objects. once 2 objects are connected, dragging them is further restricted.

The 2 objects cannot get too far between each other (max Vector3.distance allowed is 5f).

Both of these restrictions work, my issue is that once these restrictions occur, the objects are pretty much just stuck in place until dragged away from the restriction they tried to pass.

I want the object being dragged to orbit smoothly around the object it's connected to, once they reach any of the 2 restrictions.

The best example I can think of is the angry birds slingshot,

that once it reaches it's maximum pullback, you can just orbit along this max distance smoothly up or down depending on where you are trying to drag, this same smooth effect needs to occur both when too close and too far.

Hope I explained myself thoroughly I tried to find answers and try myself but could not reach any working solution.

The closest I think I got to a solution is with rays and the on point of ray function like in the video I provided below but I have no idea how could that be implemented in my sort of game.

thanks,

Remember the BBQ.

link to the sort of angry birds pulling mechanics I am talking about:
https://unity3d.com/learn/tutorials/topics/physics/making-angry-birds-style-game-part-1

Image provided is very inaccurate to the boundaries of each restriction, just to make it seem more clear.

sentences:
What component should hold the character movements in ecs and fsm? In the below code, there's a FSM for CharacterState that will be handled also in CharacterSystem. The problem was, I don't know what component should hold movements data to process in CharacterState or CharacterSystem

public class CharacterState implements State<Entity> {
    STANDING,
    WALKING,
    RUNNING,
    IN_PAIN,
    DEAD
}

public enum Movements {
    STAND_STILL,
    MOVE_UP,
    MOVE_DOWN,
    MOVE_LEFT,
    MOVE_RIGHT,
    MOVE_UP_RIGHT,
    MOVE_UP_LEFT,
    MOVE_DOWN_RIGHT,
    MOVE_DOWN_LEFT;
}

CharacterComponent implements Component {
    Movements movement
}

MovementComponent implements Component {
    Movements movement
}

AnimationComponent implements Component {
    IntMap<Animation> map = new IntMap<Animation>();
}

animation.map.put(Movements.MOVE_UP.order, ASSET.CHAR_MOVE_UP);

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: Which image format is more memory-efficient: PNG, JPEG, or GIF? Which image format is more efficient to save memory? PNG, JPEG, or GIF?

sentences: What's the recommended bitrate for Background Music in iPhone Games? What is the recommended bitrate for Background Music in iPhone Games?

sentences: Automated LAN Matchmaking I'm looking to build an automated LAN matchmaking system for games and wondering if/how it would differ from the online applications (like FaceIt, ESEA) that serve a similar function. Ideally, a user would first select the game they wanted to play (PUBG, LoL, etc) then be paired up with others on the LAN who are playing the same game. Is that possible?

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:
Persisting Player Prefs On Build in Android Can I ask for help/guide where I can build 2d game on android device includes the players prefs that I defined already, for example I have an "int" PlayerPrefs (PlayerPrefs.Getint ("mysavenumber")),
the data "mysavenumber" has already a saved integer value in it. How ever upon building my game and installing it on my android device it seems does not hold any value.
How can I build my game with the Playerprefs data that I have defined upon building and installing it on an android device?

sentences:
glDeleteBuffers causing other objects not to draw I have few objects in scene and they exist until I turn off the application. Their calls for glDeleteBuffers are in destructor. Since I don't delete anything in the middle of the game everything is fine.
But now I created one helper function for drawing lines with following body:

void DrawLine(glm::vec3 p1, glm::vec3 p2, glm::vec4 color)
{
    GLuint vao, vbo;

    glm::vec3 data[2] = { p1, p2 };

    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, 2 * sizeof(glm::vec3) * 2, data, GL_STATIC_DRAW);

    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

    glEnableVertexAttribArray(0);

    glBindVertexArray(vao);

    SimpleShader.SetAttribute("World", glm::mat4x4());
    SimpleShader.SetAttribute("UseStaticColor", true);
    SimpleShader.SetAttribute("UseLighting", false);
    SimpleShader.SetAttribute("StaticColor", color);
    glDrawArrays(GL_LINES, 0, 2);
    SimpleShader.SetAttribute("UseStaticColor", false);
    SimpleShader.SetAttribute("UseLighting", true);

    glDeleteBuffers(1, &vbo);
    glDeleteBuffers(1, &vao);
}

But as soon as glDeleteBuffers is called nothing is drawing anymore. If I comment those two lines everything is fine (except a bunch of unreleased object names of course).

Anyone know why is this happening?

sentences:
Generate random people with demographics I would like to have random people with preferences generated for an economic strategy game.
For simplicity, lets say each person has age(number), home area and its type (city,village,...) and preferences(likes ice cream,..).
The problem is, if I used uniform random generation(choose random age, home, and preference) all people would be ...uniformly distributed and there would be no demographics for player to discover. By features I mean, for example, young people like soda, in addition people living in village tend to prefer red colored packaging (=> player shipping it with different packaging to country will sell more). I would like to have the people generated so that there are always some distinctive demographic features(which does not have to be known to the game itself) present in the data.  The features does not have to and should not resemble real-world ones, the algorithm should work without requiring any 3rd party databases. Homes for people are given as input from previous generation step as array of tuples of settlement id and capacity (thus also type).
What could be general procedure for this type of procedural generation?

sentences:
Why is the ownership fixed when synching objects? I'm creating a billiard game where one white ball will be controlled by two online players.

I have set my object photonview to ownership takeover.

When a player shoots the ball in one client, it is synced on other client.
Now when I update the ball on the other client, the other client is not updated.

Why is the ownership fixed?

Only one client is sending the updates to the other client, and not vice versa.

What should I do here?

sentences:
Crusader Kings 2: How to extract character religion from saved game? I am trying to parse and interpret the Crusader Kings 2 save file. I run into problem when trying to extract character religion.
3185293=
{
    bn="Umar"
    b_d="1543.12.21"
    fat=3160797
    mot=3160268
    att={7 3 4 3 3}
    tr={195 }
    rel="norse_pagan_reformed"
    cul="andalusian_arabic"
    dnt=1000128972
    dna="xvfudvhjgxg"
    prp="ojcf0k00000000000000000000000000000000"
    fer=0.400
    health=5.100
    # ... shortened ...
}

In many cases, trait rel is missing. In the documentation, I found reference that the trait does not appear if government make it unnecessary. Can you please advise how exactly to extract character religion if the trait is missing?

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: 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:
clip space, normalized device coordinate space and window space in OpenGL I am learning OpenGL. Clip space, normalized device coordinate space and window space are confusing. I searched but still don't understand them clearly.
So, the question is- what are differences between them and how are they converted from one to another? And what coordinate do the built-in OpenGL functions (e.g.: glBufferData) take as input?

sentences:
Level selection view - similiar to Angry Bird's I am making game and need to prepare view for level selection. Could you recommend me some opensource library which could I use? I need icons to vibrate after long pressing one of them, some callbacks after choosing them, possibility to prepare custom icon's view, page control and horizontal scrolling. I was trying to use OpenSpringBoard but weirdly couldn't see scrollview and pagecontrol working in this project - it seems that there's possibility to use only one page. On the other hand, myLauncher(https://github.com/dlinsin/myLauncher) isn't so easy to include in project, as I need a seperate view with some delegate methods.

I need to be compatible with >iOS 4.2

sentences: How can I change the default New Project directory in Godot Engine? When I go to create a new project in Godot Engine (version 3.2) my Project Path is always the original default directory, no matter what path I last used. There doesn't appear to be any configuration inside the Project List window. How can I change the default project path for new projects?

sentences:
Generate Geodesic Sphere from Hex and Pentagons I have two polygonal meshes, a hexagon and a pentagon (They are tiles in a strategy game). I want to use them to construct a geodesic sphere (https://upload.wikimedia.org/wikipedia/commons/e/e7/G%C3%A9ode_V_3_1_duale.gif).

I can modify the sizes of each mesh to fit what I need, but I can't figure out how to get the radial coordinates of each face in the geodesic sphere. Is there a way to do this?

I'd like to only need two meshes for the tiles, but I can make different versions if absolutely necessary.

sentences:
Problem with C# script in 2D game I'm busy following this YouTube tutorial for a 2D game in Unity by inScope: https://www.youtube.com/watch?v=-gC1u7qHMY4&list=PLX-uZVK_0K_6VXcSajfFbXDXndb6AdBLO&index=6

I decided to not finish the attacking episode and skipped to the next episode.
But things were not working out so I deleted all my new work so everything will be back to how it was before.

But low-and-behold my attack stopped working. What should happen is whenever I press Left Shift my character should play his attack animation.

I've rechecked the videos again and again but I can't find whats wrong with my script! The script is in C#, and there are no errors in the script. I don't know whats wrong PLEASE HELP!

public class Player : MonoBehaviour
{
  private Rigidbody2D myRigidbody;

  private Animator myAnimator;

  [SerializeField]
  private float movementSpeed;

  private bool attack;

  private bool facingRight;

  // Use this for initialization
  void Start ()
  {
    facingRight = true;
    myRigidbody = GetComponent<Rigidbody2D> ();
    myAnimator = GetComponent<Animator> ();
  }

  void Update()
  {
    HandleInput ();
  }

  // Update is called once per frame
  void FixedUpdate ()
  {
    float horizontal = Input.GetAxis ("Horizontal");

    HandleMovement (horizontal);

    Flip (horizontal);

    HandleAttack ();

    ResetValues ();
  }

  private void HandleMovement(float horizontal)
  {
    myRigidbody.velocity = new Vector2 (horizontal * movementSpeed, myRigidbody.velocity.y);  // vector2 = x-axis - 1, y-axis = 0
    myAnimator.SetFloat ("speed", Mathf.Abs (horizontal));
  }

  private void HandleAttack()
  {
    if (attack)
    {
      myAnimator.SetTrigger ("Attack");
    }
  }

  private void HandleInput()
  {
    if (Input.GetKeyDown (KeyCode.LeftShift))
    {
      attack = true;
    }
  }

  private void Flip(float horizontal)
  {
    if (horizontal > 0 && !facingRight || horizontal < 0 && facingRight)
    {
      facingRight = !facingRight;

      Vector3 theScale = transform.localScale;

      theScale.x *= -1;

      transform.localScale = theScale;
    }
  }

  private void ResetValues()
  {
    attack = false;
  }
}

sentences:
Create a crosshair openGL How do I draw a white crosshair in the middle of screen in openGL, it's all well and good knowing how to render objects in 3d space, but I have literally no idea on how to draw something that sticks on the screen no matter what

Would this require a shader? one that does not take into account model view projection matrix? at what point would i draw the cross? after everything to coincide with the painters algorithm? Or do I give it a z value?

sentences:
Why there are no 3D games which allow you to move? I've tried many 3D augmented reality games animations vs. all of them were based on this concept: your head is on one reference point, standing still, they only allow you to turn your head and look around, maybe arms and legs are included but you are not allowed to walk around or change your position. Right?

Is this because of the graphic processor has enough competing power to look around but not enough power to calculate depth perception when you also move? Because when you calculated, at least 120hz*1080*1080px*3(RGB)*8bits =3359232000 bits data transfer per second is required for monitoring in 1080p resolution with 120 Hz. When you are standing still, 3+ Giga ram may be enough to store calculated datas of other direction of views to cache but when you are moving it may not be enough right? Because your processor will has more like 3 Ghz clk speed and even in most RISC processors calculating new depth perception will require minimum 2-3 assembly instruction step so the processor chip would not be able to support such calculation because even if it achieves to calculate new perception per pixel in 2 steps it will decrease the speed of construction for whole pix lower to 1.5 GHz and the monitor will require minimum 3.3 GHz(I am not counting the dimming information of BLU or RGBs). So, is this the main issue for this or am I wrong and other concerns are included? If so, what are those?

Thanks.

sentences:
Animating 2d character which can wear items? In my game the player can control a character which can wear items.
Now it is not visible but I would like to make it visible like for example in Terraria, Starbound, etc.

In my game a player can only face right or left. (right is the mirrored version of left) Only the character's feet and arms are moving during the game.

Is there a simple way in Unity to stick the sprite of the items to "bones"?
(like in 3d modelling)
Or how could I implement this "equipment on character" system?

I found some assets but I dont have much money.

Thanks in advance! :)

sentences: State of art shadowing technique for OpenGL on isometric terrain? What's the most efficient way of creating shadows for object on a isometric terrain with OpenGL and JOGL? Note that this terrain is not flat and is not heightmap generated. Think it as another model. However objects' shadows on other objects is just nice to have.Objects must drop shadows just on the terrain.

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:
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:
OpenGL Mapped Memory Shader Source Is there any way to get a pointer to a newly created shader object's source? I'd like to load a shader directly from file in to my shader object instead of loading to an intermediary variable and then using glShaderSource().

I haven't been able to find any information regarding this, only regarding buffers.

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: 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:
Limiting number of user clicks to reduce micro: best method of implementation? I'm making a client-server game where the user can select armies and move them from one place to another.

In a bid to reduce the advantage of "being able to click faster" I've decided to implement several anti-micro measures, one of which is to limit the number of clicks (or move orders) that the user may issue.

In order to discourage individual unit micro, group move orders and individual unit orders both count as one move order.

What's the best way to implement this? I've thought of 2 ways:

Have countdown-timers both on the client and server. The timers must be synchronized - perhaps by the server sending the countdown time to the client. If the client issues a move order before the countdown is finished, the order is ignored.
Have randomly generated "move tokens" issued from the server to the client every few seconds. In order for an order to be accepted it must come with a valid move token, and each "move token" is only valid for one mode order.

Which way of implementing it is better? Any other good ways?

sentences:
Is it possible to use SFML with the Android NDK? I've started using SFML recently and I absolutely love it. I'd like to make games that could be ported to android, linux, mac and windows, but it seems that SFML lacks portability.

I've searched for a while and I've only found unrelated or unanswered questions on forums.

Does anyone know of any way to use SFML with the android NDK or any plans to support it in the future?

sentences: Can I name a team with the name of their city to avoid trademark issues? I was wondering, if you want to make a NBA game on smartphones, without the license held by EA, the first solution seems to name your teams with a different name, such as "Chicragro Brulls" (this is just for the example), but would it be possible to just call your team with the name of the city, such as "Chicago vs. Dallas" ? I know the first solution was chosen by Pro Evolution Soccer, would you know any other game that don't use a license?

sentences:
How to get and change a mesh-renderer component in unity? I've been making a simple brick-breaker game using unity 4.3 (In C#). I'm currently trying to make the blocks, which are stored in an array, all start with random colour properties. The colours are working correctly, but I want the blocks to start invisible, and then be assigned the various colours. I have researched, and found similar questions on changing the mesh-renderer component, but, as yet, they haven't worked. Here is my code:

EDIT: To put it simply: how do you make objects invisible, test if they are invisble or not and make them visble again.

using UnityEngine;
using System.Collections;

public class BlockInitialiser : MonoBehaviour {
    GameObject[] blocks;
    // Use this for initialization
    void Start ()
    {
        blocks = GameObject.FindGameObjectsWithTag ("Brick");
        StartCoroutine (blockColour ());
    }

    IEnumerator blockColour()
    {
        foreach (GameObject block in blocks)
                {
                        block.renderer.material.color = new Color (Random.value, Random.value, Random.value);
                        yield return new WaitForSeconds (0.1F);
                }
    }

Thanks in advance, guys.

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:
How to Work With Arbitrarily Oriented Vectors I'm brushing up for a pending game jam and just for kicks I thought I'd let the gravity in my 2D platformer push at an arbitrary angle. Normally gravity points downward (3 PI / 2), but if I wanted it to point to the right (0) then the character would rotate accordingly and be able to walk along walls as though they were floor. In that case, pressing left would cause the player to move downward on the screen, as that would be left relative to the current angle of gravity.

The problem comes when I try to implement jumping or falling. As I'm now realizing, I lack the mental language to even properly describe my problem, but I clearly don't intuitively grasp how to handle rotated vectors.

For example: I'd like to know when the player is falling. Normally I'd just check if their velocity.y > 0, but that only makes sense if gravity is pointing downward. If it's pointing to the right, then a velocity.y > 0 implies that they're moving to the left, relative to gravity.

How do I go about understanding and working with 2D vectors that have an arbitrary global rotation applied to them?

sentences: How can I simulate tapping on touch for Android? I'm searching on Input.Touch properties to find how can I simulate tapping on touch for Android. Something like Input.getmouseButtonDown() on mobile.

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:
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:
2D Scrolling Background on XNA How do I create a scrolling X and scrolling Y background without weird things happening like the player disappearing or not getting the offset correct?

I have code at https://vanillity.kilnhg.com/Code/Repositories/Group/Aremac

Looks like this:

      var s = game.gd.Viewport.Bounds;
      var g = game.world.Bounds;
      var p = game.player.Bounds;
      var v = viewRectangle;

      var x = p.X  0 ? p.X - s.Width/2 :
              v.Right >= 1090 ?  90 :
              p.X > s.Width/2    ? p.X - s.Width/2 :
              0;

      var y = //v.Bottom >
              p.Y > s.Height/2 ? p.Y - s.Height/2:
              0;

      var w = s.Width;
      var h = s.Height;

      //view Rectangle
      Offset        = new Vector2(x , y);
      viewRectangle = new Rectangle( x, y ,w, h);

and then:

     //source rectangle
     var x = (int)0;
     var y = (int)0;
     var g = game.world.Bounds;
     var w = g.Width;
     var h = g.Height;
     var rect =  new Rectangle(x,y,w,h);

      spriteBatch.Draw(  w.boundsTexture
                        ,rect
                        ,viewRectangle
                        ,w.Color
                        ,0
                        ,Vector2.Zero
                        ,SpriteEffects.None
                        ,1
                        );

Before center, the grey guy is holding the rock in his left hand:

After center, the rock (and the white guy) drifts evermore to the right:

sentences:
Rotate a UI Image exactly 360 degrees over the course of 1 second? I have a UI Image that I want the user to click and have it rotate 360 degrees once on the z axis.  I can get it to rotate through a coroutine but I'm having trouble making it stop once it is started.

public void getInputClick()  // OnClick method for UI object
{
    foreach (Transform child in EventSystem.current.currentSelectedGameObject.GetComponentsInChildren<Transform>())
    {
        if (child.gameObject.name == "Lock")  //Making sure this is an object that should rotate becasue it has a child named "Lock"
        {
            if (rotating == false) //enable coRoutine if not already rotating
            {
                runRotationRoutine = true;
            }
            break;
        }
    }

}

void Update()
{
    if (runRotationRoutine == true)  //Listening for coRoutine execution directive during update.
    {
        StartCoroutine(rotationRoutine());
    }
}

IEnumerator rotationRoutine()
{
    runRotationRoutine = false;  // make sure update doesnt try to run the coroutine more than once!
    rotating = true;  // bool signifying that rotation is currently happening.

    while(rotating == true)
    {
        imageObject.transform.Rotate(rotationVector);
        yield return null;

        //  This works but rotates forever because the coroutine is never terminated.

        //  How do I make this stop after the object has rotated 360 degrees????

        //  Something like (when current rotation == starting rotation --->  set rotation = false
        // But how would I determine this?
    }

}

It needs to be a coroutine because there are a lot of other things executing simultaneously.  I feel like it should be pretty simple to just tell it to only rotate around once, what am I missing here?

sentences:
What is the best practice for handling touch events on different GameObjects in Unity2D? First of all I want to describe what I have in my scene.
1. Joystick.
2. Main character that has link to joystick and handles touch events from joystick.
2. Buttons.
3. Other GameObjects that must handle touch events.

But that's not all. When player is touching any part of screen (except of the above objects) main character must start fighting. The problem is in that I cant correctly handle all touch events on these game objects. When the player is touching to the joystick the main character starts moving but before this he is performing a single fight action. Can anyone give me some ideas how to correctly handle touch events on different gameobjects? Perhaps my question is confusing, I am sorry for this.

sentences:
WoW attack speed calculation Reading up on attack speed calculations for World of Warcraft I noticed that the formula for attack speed is:

  Attack_speed = "current attack speed" / (("Percent increase or
  decrease" / 100) + 1 )

So with a weapon of speed 1.8 and activating a 40% attack speed buff for example we would have:

  Attack_speed = 1.8 / ( (40 / 100) + 1 ) = 1.2857

So I am just wondering why is there a +1 in the formula. Logically I would assume that one would calculate the attack speed like this:

  Attack_speed = 1.8 - (1.8 * (40 / 100)) = 1.08

Which is just subtracting the 40% of 1.8 from 1.8, which is how one would normally calculate a percentage in math. Is this just by design or is there some logic to this?

sentences:
Are sockets required when developing a browser based MMOG? I'm in the very early phases of developing a browser based MMOG, kinda like this game but not as cartoonish and with more features.  I'm an experienced web developer, yet not once have I ever used websockets.

Are websockets required for something like this?

sentences:
How are win conditions handled in a turn based game? Turn based games sometimes have different win conditions for different maps and mission.

For example, control some structure for X turns, last X turns without losing a single soldier.

They usually also have standard win conditions across all maps like eliminate all enemy units and structures, etc.

How would I implement map/mission specific win condition checks?

My current implementation utilizes a finite state machine that loads the play state. The play state has objects and logic for gameplay. I could write custom play states for each mission, but I feel like that is not the best way to go as I would have large portions of duplicate logic and code.

Ideally I would like to tie in win conditions into my map/mission file data. When I load a map, the win conditions are loaded also, but am not sure how I would achieve that.

Any suggestions?

sentences:
ScreenToWorldPoint(Input.mousePosition) always returns 0 for X and Y coordinates I'm trying to convert the mouse position (Input.mousePosition) into world points, but for whatever reason the X and Y coordinates are always, always 0.
Here, I printed mousePosition and ScreenToWorldPoint()'s output:

The -10 in the Z is understandable, but why do I get 0s in X and Y regardless of the actual, varying mouse position?
This is inside a custom display I set inside Game View (1440x3040). I tried Free Aspect, but that didn't change anything.
I tried parenting the script to an empty game object centered on origin just in case, but that didn't do anything either.
The code:
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Debug.Log(mousePos);
Debug.Log(Input.mousePosition);

Or, more generally:
private bool hitProjectile() {
    bool hit = false;
    Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

    Debug.Log(mousePos);
    Debug.Log(Input.mousePosition);

    if ((mousePos.x >= (pt.position.x - radius) && mousePos.x <= (pt.position.x + radius)) &&
        (mousePos.y >= (pt.position.y - radius) && mousePos.y <= (pt.position.y + radius)))
        hit = true;

    return hit;
}

The game is in 2D, the camera is perspective, and I'm using URP. The script is trying to determine if the mouse clicked on a circle (/w a CircleCollider2D).
What the hell is going on? I hope this is not a URP thing. I've had nothing but bad experiences with it.

sentences:
Parts of 3D model disappear during animation I'm trying to properly play an animation done in Blender 2.8 inside my OpenGL application. When the animation is running, it happens that at some particular frames, some parts of the 3D model "disappear", by "disappear" I mean that they obviously get relocated at some incorrect position and rotation in the 3D scene.

The model is an FBX file.
Has anyone got an idea about what could be the possible reasons for that?
Maybe some wrong settings in Blender?

Thanks in advance!

sentences:
Building 2D Assets for a Game Targeting Multiple Framerates To make a real-world example, lets assume I want to build an animated sprite for an explosion. The duration of the animation should last ~1 second, and we'll say exactly one second to make the math a bit more simple. And lets assume I'm using XNA and my goal is to target both XBox (60fps), PC (60fps), and Windows Phone 7 (30fps).

My question is this, how should I build the sprite animations so that my programming is as simple as possible without simply using a timer to calculate which frame I should be on (which I feel would make the animation "choppy")?

sentences:
Using custom functions in HLSL shaders generates extra insructions? We use forward rendering so our main shader is pretty big (342 instructions). Recently I tried substituting every single custom function I call in the shader with the actual code from that function and the number of instructions generated dropped down to 311.

Am I doing something wrong with my custom functions? I tried passing variables into them with various predicates (in/inout/out/[nothing]) but it did not change the number of instructions even though Microsoft claims every instruction in HLSL is inlined.

UPDATE:
Example code:

void DirectionalLight(half4 Normal,
                half3 DirectionToCamera,
                half4 Combined,
                inout half2x3 light)
{
    half3 halfVector = normalize(DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    light[0] += DirectLight1.Color*lightParams.r;
    light[1] += DirectLight1.Color*litV.b;
}

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    DirectionalLight(Normal, input.DirectionToCamera, Combined, DirLightAccum);
    ...
}

Or this code:

half2x3 DirectionalLight(half4 Normal,
                half3 DirectionToCamera,
                half4 Combined)
{
    half2x3 light = (half2x3)0;
    half3 halfVector = normalize(DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    light[0] += DirectLight1.Color*lightParams.r;
    light[1] += DirectLight1.Color*litV.b;
    return light;
}

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    DirLightAccum += DirectionalLight(Normal, input.DirectionToCamera, Combined, );
    ...
}

Both generates 342 instructions. But the following code:

float4 MainPS(VSOutput input) : COLOR0
{
    ...
    half3 halfVector = normalize(input.DirectionToCamera + SpecLightDirection);
    half3 lightParams = saturate(half3(dot(Normal.rgb, DirectLight1.Direction), //NDL
        dot(Normal.rgb, SpecLightDirection),                                    //NDL_Spec
        dot(Normal.rgb, halfVector)));                                          //NDH

    half4 litV = lit(lightParams.g, lightParams.b, Combined.b);
    DirLightAccum [0] += DirectLight1.Color*lightParams.r;
    DirLightAccum [1] += DirectLight1.Color*litV.b;
    ...
}

Only generates 339 instructions. Heavier functions (with more variables passed) generate more instructions. As I mentioned, when substituting ALL the functions with their actuall bodies I was able to reduce instruction count by 10%.

I tried making CastShadow a float function so that I can get rid of the "inout half shadow" argument but does not help.

I am just trying to figure out if it's a norm or I am doing something wrong?

sentences:
Front Face Culling with Shadowmapping To avoid shadow acne I usualy use front face culling which works great. But for my current implementation the mesh is a quite complex terrain (depending on the lod level) and than the shading (dot product of the normals face with the negative light direction) is not always correct as some normals are actually facing the light. But still there is no information in the shadowmap to shadow these fragments in the shadowmap because of the front face culling ( like it is not exact enough).
What I end up with, is that there are some bright spots in the shadowed area.
I am not really sure why this does not work, because that would mean, that the front face culling is also culling some back faces, if the mesh has a very high level of detail, right?

In the Image with Front Face Culling (top picture) you can see these bright lines in the shadowed area where as without FF Culling (bottom image) the shadowed area is completely black.

My current workaround is, that I check the highest LOD level that is currently displaying and than according to that switch back an forth between ff culling and bias.

I use OpenGL:

The front face culling:

glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);

The shading in the fragment shader:

float shading = max(dot(normal,-lightDir), 0.0);

sentences:
Calculate aim angle dead zone range In my top down 2D shooter game the player has a shoulder mounted gun which rotates and aims automatically at enemies - that part is all working fine. Since the player can rotate as well, the gun is constantly updating it's angle to keep aim on the enemy.
But this causes a problem where the gun aims at the player's own head...! It doesn't have any practical consequences in the game, but obviously looks weird and unrealistic. So I need to create a 'dead zone' angle range where the gun cannot aim. It will have to aim as best it can at an enemy up to just before it aims at the player's head.
It seems tough to calculate since there are two angles in play. The dead zone will have to update itself as the player turns.

EDIT: This is what I had so far but I can't update the angle range since it then wouldn't work with the min max:
private float normaliseAngle(float angle) {
    return angle - (float) Math.floor(angle / 360f) * 360f;
}

private float clampAngle(float aimAngle) {
    float tempAngle = normaliseAngle(aimAngle);
    return (float) Math.min(Math.max(tempAngle, 45), 315);
}

This gives a dead zone between 315 and 45.

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:
How does Lumberyard stack up against Unity 5 and UE4? Amazon released a new game engine called Lumberyard today.

How does it compare to the other two major 3D game engines, Unity and Unreal Engine? What advantages and disadvantages does it have? What can it do that the other two can't do, and vice versa?

sentences:
how to get if a rotation/position has been completed? I've done an if / else with the final position / rotation plus they never complete, how can I check this?
stays like this

https://i.imgur.com/3cQ9AEk.gif

    if(head == false)
        cam.transform.position = Vector3.Lerp(cam.transform.position, PosicMin, Time.deltaTime * Speed);
    else {
        cam.transform.position = Vector3.Lerp(cam.transform.position, PosicMax, Time.deltaTime * Speed);
    }
    if(head == false)
        cam.transform.eulerAngles = Vector3.Lerp(cam.transform.rotation.eulerAngles, RotationMin, Time.deltaTime*Speed);
    else {
        cam.transform.eulerAngles = Vector3.Lerp(cam.transform.rotation.eulerAngles, RotationMax, Time.deltaTime*Speed);
    }

sentences:
How can I move the object back to his original position after the object reached the target? InteractableItem target;
    private void Update()
    {
        if (target != null && target.name == "kid_from_space_helmet")
            objToThrow.transform.position += (target.transform.position - objToThrow.transform.position).normalized * 2f * Time.deltaTime;

        if(Vector3.Distance(objToThrow.transform.position, target.transform.position) < 1f)
        {
            objToThrow.transform.position += (objToThrow.transform.position - target.transform.position).normalized * 2f * Time.deltaTime;
        }
    }

The object is moving to the target but never moving back.
This IF is not working good :
if(Vector3.Distance(objToThrow.transform.position, target.transform.position) < 1f)

My guess is that the problem is that when the object distance is less then 1 he try to move back but then he is not less then 1 anymore. but anyway it's not working.
I want to move the object to the target then wait 1 second at the target and then to move the object back.

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 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:
how to save data in a visual novel with shared object I've been looking for ways to save data in a visual novel, I have seen that the best way to do  is with shared object but the tutorials are usually saved scores and I want to save the history progression

how can I do it?

Which variable should be used?

What should contain the variable?

shared object works for android and ios?

Thanks  for reading

sentences:
How can I prevent small numerical advantages from dominating the balance of an encounter? I've been tinkering for some time with a game and I'm having a fair amount of trouble with something:

I have two characters, each of whom have attributes (about ten) in a range (between 1 and 20). I want to use these attributes to generate a 'roll' such that the higher roll wins that particular encounter. It's worth noting that the two characters are not damaging/defending each other. They're both rolling to see if they pass what I guess we could call a skill check. They're both rolling to pass/fail against a common value. They do not interact with one another.

However, when one of the characters has even a small numerical advantage, any formula I've come up with results in the ever-so-slightly superior one winning a huge majority of the time. This is undesirable.

I've tried weighting the 'most relevant' attribute for the test at 80% and the sum of the other attributes at 20%. I also tried comparing averages to produce a relative difference and using that to boost the weaker character. Both approaches resulted in the significant advantages I'm trying to remove (for example, if I run the encounter 5,000 times, it quite regularly produces one side winning all 5,000).

Adding a "luck" component only matters, it seems, if it's weighted somehow in favour of the lesser character, and I haven't hit a good balance there.

What approaches can I take to blunt the impact of a small numerical advantage but still preserve and increase that advantage as the relative gap in attributes increases?

Per the request, here are the specifics I have so far. Some things I haven't figured out yet so they remain generalities:

At the moment, the roll is generated as

0.8 * (mainAttribute) + 0.2 (1/3 * subAttA + 1/3 * subAttB * 1/3 subAttC)

At present, this produces numbers in the neighborhood of 4.0. Attributes are randomly generated between specified ranges. The current test uses one character with attributes from 2 to 4, and the opponent between 3 and 5. Predictably, this produce averages close to 3 and 4 respectively.

With this one-point advantage, I'd like to see the stronger of the two win in the area of 55% to 60% of the time, with this scaling up to winning about 80% of the time with an average attribute advantage of 5 or 6, 90% at advantages of 7 or 8, leaving some room for an unlikely win when the gap grows larger. I'd prefer not to ever have guaranteed wins, but perhaps things becoming very unlikely - to the tune of winning 99.5% or 99.6% of the time when the gap gets very large.

The current formula produces a non-random number. Randomness comes from the selection of which attributes are relevant. Not all of the attributes are used for each roll. It's possible for the one with the overall weaker attributes to be stronger in the areas relevant to that roll, and steal a win. But, predictably, it happens rarely.

My next attempt was to weigh their relative strengths, by taking an average of all of each's stats, dividing them against each other, and using that value to give a small boost to the lesser character. This smoothed things out a little, but still had a pronounced tendency to produce things like 5,000 wins for one guy out of 5,000 tries.

sentences: Is it good to use 24 fps animation in 60 fps game? Is it normal to use 24 fps animation in 60 fps game or it will hurt perfomance or create bugs?

sentences:
OpenGL ES 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:
Unity Cinemachine+URP : 2D pixelPerfect zoom issue? There are many PixelPerfect component that exists and it confuses me.
The CM PixelPerfect component doesn't work in my 2D Tilebased game.

So I use the Camera component named "Pixel Perfect Camera (Experimental)".

I feel that the right PixelPerfect component because it seems that it's the only one working for my project ahah.
(note : I'm aware there's another PixelPerfect component in the "2D pixel perfect" package, but it's only compatible with LWRP projects if I'm right.)
The camera :

The hierarchy :

CM vcam1 and CM vcam2 are used to make transitions between Areas.
Now, I need to make a zoom on the player.
To achieve that, I have added a 3rd "CM vcamZOOM".
But nope, it's not working at all. I mean, everything else works, the rotation, etc, everything but the zoom. Even if it's the only vcam enabled, it's not zooming.
I found out that disabling the "Pixel Perfect Camera (Experimental)" component on the Camera solved the problem.
That's not a real solution since I need to use a PixelPerfect component (with the ability to Zoom).
Am I using the right PixelPerfect component for my needs?
Is this a compatibility bug between URP camera pixelperfect component and CM zoom ?
Thanks for reading and for your answers.

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:
Problem with NGUI Unity 2D Sprite across devices I have a problem with NGUI for Unity, using the Unity 2D Sprite objects.

First, have this image:

And then create an NGUI Unity 2D Sprite object in the scene. Apply this image and you get this:

Very odd. This doesn't happen if you use an Unity UI Image object or a SpriteRenderer component. But I really need to use NGUI's Unity 2D Sprite.

Then I ran the scene in several devices. Some of them display the sprite correctly - but others do not. Look:

Top-left device: iPad Mini 1: The sprite is bad.
Top-right device: iPad Mini 3: The sprite is good.
Bottom-left device: iPhone 5c: The sprite is bad.
Bottom-right device: iPhone 6 plus: The sprite is good.

I fail to understand what is the problem.

Again, this doesn't happen with sprites rendered with SpriteRenderer or Unity's builtin UI Sprite system. However, I need to do this with NGUI.

NGUI has a "NGUI Sprite" which I believe does work. But I don't want to use that one - I need to use the "NGUI Unity 2D Sprite" option.

Any ideas?

Unity 5.0.0b20

sentences:
Dynamic pathing algorithm for tower defense game I'm making a Tower Defense and I need a good pathing algorithm for it.

I have thought about Dijkstra but I need one that can be dynamic; it must be able to update itself when one edge is removed or added without a full recalculation.

I'm coding in C# if it helps.

sentences:
How can I highlight and move to adjacent tiles in an isometric grid? I trying to create a turn-based strategy game where you move a game object from one tile of a grid to another tile near it. I have created the grid using sprites and game objects but can't sort out the movement part.

How can I highlight adjacent tiles given the 'current' tile, and then allow a game object to move to any of those highlighted tiles?

sentences:
How to synchronize actions like jump in multiplayer? I am a newbie game developer and I have been researching about multiplayer games. I observed that there's always some latency, the players always get updates from past actions. But there are techniques like dead reckoning to handle the latency. I can predict the movement and make movements smooth. But how would I make actions synchronize like jumping, stopped walking, etc.

Suppose, client A was moving, he was at 100m at 10.2 time with 100m/sec velocity and sended this information. Client B would receive this information somewhat later, let it be 10.4. So at client B, I can use prediction and place client A at 120m. But what if, client made a jump at 110m at 10.3. I can't predict that and since I have been using prediction I can't show client A jump in past.

I may deal with this problem by not sending jump action at all. But what if my game has some voids where players can fall and die. So, If I don't sync jump actions, other players will observe that one player was running then he falls in void and then again appear on the screen destroying the visual engagement.

Jump is just an example, there might many scenarios where prediction can't work. So, How do deal with them. One such example can be Multiplayer Online battle arena games like Awesomenauts.

sentences:
How to move an image back and forth with javascript I currently am trying to make a baseball game and have this code here: http://jsfiddle.net/769BK/ I have the baseballX set to a decrement, and then I try increasing the value using baseballX++; but it won't stop the baseballX--; after that so it stays in the same place. I need to somehow stop the baseballX--; and that way I can use baseballX++;

Thanks for any help at all!

sentences:
Exception in thread "LWJGL Application" I'm using libGDX for my android game in which I'm trying to use bitmap fonts. I have created .fnt and .png bitmap files using Bitmap font generator of angel code.Both .fnt and .png have been placed under same folder /asset/data in my project.

Now when I try to run my project I get exception errors. Here is my sample code -

FileHandle handle = Gdx.files.internal("data/calib.fnt");
FileHandle handle2 = Gdx.files.internal("calib_0.png");
font = new BitmapFont(handle,handle2,true);
font.draw(batchmaker, "abcdef", x,y);

The error on console looks like this (showing only relevant lines):

  Exception in thread "LWJGL Application"
  com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file:
  data/calib.fnt . . . at
  com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.(BitmapFont.java:809)
  Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid font
  file: data/calib.fnt

I do not believe this error has something to do with issue with paths, because it gives me different errors when I play around by changing the paths.

I have been trying to fix this since almost last 2 days but couldn't come up with a solution. Can someone please let me know what could be the problem or am I missing something?

Edit: Or could there be some checks in which the parameters of calib.fnt is not passing (due to upper/lower case name mismatch with libGDX lib files) ? Please help!

sentences:
Trouble with mouseover effect in SDL for square menu buttons I have a game with a menu made up of 9 'tiles'. I want the tiles to turn white when the cursor hovers over them (and play a sound), and go back to default when the mouse moves off.  My code works when the cursor is moved slowly, but when it is moved quickly the tiles don't turn back to the default colour when the mouse is moved off, resulting in multiple tiles staying white. I'm not sure if the problem is with my code or with SDL event polling. Below are the relevant code snippets, the full source can be found here

void MenuState::handleEvents(SDL_Event& e) {
    //(...)

    if (e.type == SDL_MOUSEMOTION) {
        int x; int y;
        SDL_GetMouseState(&x, &y);
        mousePos = getActiveTile(x, y);

        if (mousePos >= 0 && tiles[mousePos].tileType() != Tile::type::buttonpressed) {
            tiles[mousePos].setTileType(Tile::type::rollover);
        }
        else if (prevMousePos >= 0 && tiles[prevMousePos].tileType() != Tile::type::buttonpressed) {
            // if mouse is *no longer* inside button
            tiles[prevMousePos].setTileType(Tile::type::button);
            prevMousePos = -1;
        }
    }

    //(...)
}

int MenuState::getActiveTile(const int &x, const int &y) {
    int tilenum = -1;
    for (int i = 0; i < tiles.size(); ++i) {
        if ( !(x < tiles[i].position().x || x > tiles[i].position().x + tiles[i].position().w ||
               y < tiles[i].position().y || y > tiles[i].position().y + tiles[i].position().h) )
            tilenum = i ;
    }
    return tilenum;
}

void MenuState::update() {
    if (mousePos >= 0 && prevMousePos == -1) { // only play when mouse first touches button
        Mix_PlayChannel(-1, rollOver, 0);
        prevMousePos = mousePos;
    }
    //(...)

}

the render function (the 'buttons' are held in a vector of 'Tile's)

void Graphics::drawBoard(const std::vector<Tile>& t, const bool& drawnumber) {
    for (int i = 0; i < t.size(); ++i) {
        SDL_Rect temp = t[i].position();

        if      (t[i].tileType() == Tile::type::invisible)
            SDL_SetRenderDrawColor(renderer, 163, 118, 172, 1); // bg colour

        else if (t[i].tileType() == Tile::type::rollover || t[i].tileType() == Tile::type::buttonpressed)
            SDL_SetRenderDrawColor(renderer, 255, 255, 255, 1); // highlight colour

        else if (t[i].tileType() == Tile::type::shadow)
            SDL_SetRenderDrawColor(renderer, 100, 65, 107, 1); // shadow colour

        else
            SDL_SetRenderDrawColor(renderer, 237, 229, 239, 1); // default colour

        SDL_RenderFillRect(renderer, &temp);

        if (drawnumber){
            if (t[i].tileType() != Tile::type::invisible) {
                std::string num = std::to_string(t[i].number());
                tilenumber = renderText(num, "assets/Calibrib.ttf", fontcolour, 25);
                SDL_QueryTexture(tilenumber, NULL, NULL, &temp.w, &temp.h);
                renderTexture(tilenumber, temp.x+(TILE_SIZE/2 - temp.w/2), temp.y+(TILE_SIZE/2 - temp.h/2), nullptr);
            }
        }
    }

}

sentences:
How to display consistent background image Drawing a large background is relatively slow in PyGame.
In order to avoid drawing BG every frame, you could draw it once, then do nothing.

However, if something is overdrawn onto the surface and keeps moving, you will need to redraw the background in order to "erase" the color pixels left by moving object; otherwise, you will have "traces" of the moving object.

I have a moving object in my PyGame. However, I do not want to "clear the color buffer" by redrawing the background image. Redrawing the background image every frame is slow.

My solution :

I will "clear" only required portions (where the "traces" of moving object are left)  of the "buffer" by redrawing portions of background.

Is there any other better way to have a consistent background?

sentences: What do I need to legally use copyrighted music in my game? I asked the singer of a song I am using, and he agreed to me using his music, provided I credit him. Do I need anything else, such as an agreement or signature?

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:
Managing left and right direction buttons being pressed at the same time I am currently programming a Tetris clone. In Tetris, there is a system being used called DAS, or Delayed Auto Shift. It works similarly to the keyboard auto-repeat used in Windows. For example, if you press left, the block immediately jumps one Column to the left. Then a certain amount of time goes by till it jumps a second time, and the following jumps move at a constant rate. I have this implemented as moveHorizontal(boolean moveRight), and can call it with a boolean that determines the direction the movement is going in.

However my main problem is handling the left and right direction buttons at the same time. More specifically, the state where you hold down one button, while pressing another button. The more recently pressed button should overwrite the old one, and the DAS should be reset once it switches directions. I feel like I can't really get a grasp on how to implement this kind of logic.

How do I logically change the state so as to correctly respond to the user input as I have described?

I hope I explained the problem in enough detail. If I didn't, please let me know, so I can provide more information.

sentences:
Platformer collision detection problem - player snapping onto sides I am having problems with collision detection. I am trying to make a simple platformer but when the player is falling or moving too fast it sometimes detects the wrong collision side. I am getting the side of the collision by checking the distance between the player and the sides of a block that are exposed to the player. I also tried detecting collision one axis at a time but this glitch still occurs.

blockCollision: function(block) {
        if(this.x + this.width > block.x && this.x < block.x + block.width && this.y + this.height > block.y && this.y < block.y + block.height) {
            let distanceLeft = Math.abs(this.x + this.width - block.x)
            let distanceRight = Math.abs(this.x - (block.x + block.width))
            let distanceTop = Math.abs(this.y + this.height - block.y)
            let distanceBottom = Math.abs(this.y - (block.y + block.height))

            if(distanceLeft < distanceTop && distanceLeft < distanceBottom && !block.collisionSides.includes('L')){
                this.velX = 0
                this.x = block.x - this.width
            }
            if(distanceRight < distanceTop && distanceRight < distanceBottom && !block.collisionSides.includes('R')){
                this.velX = 0
                this.x = block.x + block.width
            }
            if(distanceTop < distanceLeft && distanceTop < distanceRight && !block.collisionSides.includes('T')){
                this.jumping = false
                this.velY = 0
                this.y = block.y - this.height
            }
            if(distanceBottom < distanceLeft && distanceBottom < distanceRight && !block.collisionSides.includes('B')){
                this.velY = 0
                this.y = block.y + block.height
            }

            if(distanceLeft == distanceTop && !block.collisionSides.includes('LT')){
                this.x = block.x - this.width
                this.y = block.y - this.height
            }
            if(distanceLeft == distanceBottom && !block.collisionSides.includes('LB')){
                this.x = block.x - this.width
                this.y = block.y + block.height
            }
            if(distanceRight == distanceTop && !block.collisionSides.includes('RT')){
                this.x = block.x + block.width
                this.y = block.y - this.height
            }
            if(distanceRight == distanceBottom && !block.collisionSides.includes('RB')){
                this.x = block.x + block.width
                this.y = block.y + block.height
            }
        }
    }

JsFiddle

sentences:
How can I make the X button in the Cardboard XDK exit VR mode? When I build a game using Unity 2017.2.0f3 and the Cardboard SDK (using XR settings) and run it on my device, I see two controls overlaid on the screen, a cross and a gear:

Currently, pressing the cross control does nothing. I'd like to make the cross exit VR mode when pressed.

sentences:
2D Ragdoll - should it collide with itself? I'm working on a ragdoll fighting game as a hobby project, but I have one dilemma. I am not sure if my ragdoll should collide with itself or not, i.e. if ragdoll's body parts should collide.

2D world is somewhat different than 3D, because there are several layers of stuff implied (for example in Super Mario you jump through a platform above you while going up).

The setup I'm currently most satisfied with is when only the parts which are joined by a joint don't collide, so head doesn't collide with neck, neck with chest, chest with upper arm etc, but the head can collide with chest, arms, legs.

I've tried every different way, but I'm not content with either. Which way would recommend me to go?

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:
How can I play user-provided music stored on the phone inside my game? I am creating a car game. Is any way to play the music stored on the phone inside the game? I'd like the player to choose files that are already on their device and hear them played in the game.

For example, in GTA Vice City game there was a folder named Music, and if we placed songs in there they would play on the car radio while we're driving around inside the game. If we want to switch the songs around, we can do so. how can I do the same in Android and iOS?

I am using unity 5.2, C#.

sentences:
Why do I get an error about being unable to change rasterizer states in this code? I'm trying to toggle between wireframe and full mode while drawing a 3d model. So far I have this

 rs = new RasterizerState();

In my update method:

  if (state.IsKeyDown(Keys.V))
        {
            rs.FillMode = FillMode.WireFrame;
        }

        if (state.IsKeyDown(Keys.C))
        {
            rs.FillMode = FillMode.Solid;
        }

and in my draw method:

  GraphicsDevice.RasterizerState = rs;

But I get the error:

 Cannot change read-only RasterizerState. State objects become read-only the first time they are bound to a GraphicsDevice. To change property values, create a new RasterizerState instance.

What am I doing wrong here?

sentences:
Find the current player instance from multiple scripts I have the following code used by multiple classes (e.g. Enemy, Scenary, EnemyProjectile etc.) in my game, which seems intrinsically wrong. What are some ways I could write this code once and use it from multiple places?
        GameObject go = GameObject.Find("Player");
        if (go == null)
        {
            Debug.Log("Failed to find Player go");
        }
        else
        {
            _player = go.GetComponent<Player>();

            if (_player == null)
            {
                Debug.Log("Failed to find player component");
            }
        }

I usually have this code in an Awake function but sometimes I do it in a collision event, e.g. for EnemyProjectile grabbing a player handle would often not be required and thus a wasted lookup. Player is a private variable in the class definition of each class.

sentences:
Multithreading/Optimisation for Random Generation in Gamemaker I have a FurGeneration() script in my game; when run, it randomly generates individual oFur objects in specified areas in the game's single Room. Each has a random depth and one of three sprites, and the script produces the impression of dense, layered fur. I've attached a screenshot.

At the moment, the script is working well, as I am using it on relatively small areas. However, my next challenge is to apply this across the single, 20,000 x 20,000 room of my game to produce a consistent field of fur.

My first attempt at this was to create a background sprite, a simple 1000x1000 grey square with its image_alpha set to 0. These would be generated in rows across the entire space of the room, and then each one would have the FurGeneration() script run on it to generate individual squares of fur flush with each other. I've applied this to one 'row' of my games' Room, and the game really slows down; it doesn't crash, but evidently there are just t0o many calculations going on at once.

My question is: is there a way to multi-thread in Gamemaker? Or does it already multi-thread, meaning that this plan is a foolish one? It would be interesting to hear your thoughts.

sentences:
Text mesh not visible on a container I have probably dumb problem with a text-mesh game object. I want to use it as a title on a top of container. I will give you all information that you need to find a problem.
I'm using pixel font Tripfive.

In game result:

In scene result:

3D:

text gameObject settings:

all other settings that can be realted to the scene:

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:
Compute Shader Memory Sharing Ok guys I have had some pretty good success on this site but I feel that this is a pretty complex question.

I am trying to do tile based deferred lighting using DirectX 11 and the compute shader.  Basically I am splitting up the screen into tiles and figuring out which lights hit the pixels in that tile.  Then once I get to the pixel shader I only calculate the lighting for the current pixel based on what lights hit that pixel.  (I'm pretty sure that I can find the lights that hit the pixel and the lighting calculations for that pixel solely in the compute shader but for now I am not doing that).  So currently I think there is two ways that I can get the information to the compute shader. The tile data needs to come in a RWStructuredBuffer so that I can write to it and then use it during other parts of the GPU pipeline in a ShaderResourceView.  The thing that I am not sure how to do is what is the best way to get all of the light data to the compute shader?  I think I could do it in a constant buffer or a groupshared buffer.  I believe the latter of the two is faster but I am not sure how it works and I cannot find much information on it.  And if I was to use a constant buffer I would need to house an array of lights in that buffer and I am not sure how I would do that either because I do not want to hard code an array size in the shader.

Here is some code samples to show you what I am doing.

struct ComputeIn
{
    uint3 DTid  : SV_DispatchThreadID;
    int index   : SV_GroupIndex;
};

struct TileData
{
    float4 position;
    float3 normal;
    float2 texCoord;
    vector<float, 8> something;
};

struct PointLightData
{
    float4 color;
    float3 pos;
    float radius;
};

//If I use a cbuffer for the light data
cbuffer LightData
{
    //How do I make an array of lights in a cbuffer
    Array of lights here!
};

RWStructuredBuffer<TileData> tileData : register(u0);

//If I use a groupshared
groupshared PointLightData pointLights : register(u1);

[numthreads(1, 1, 1)]
void CS( ComputeIn input )
{
    //How do I iterate through the groupshared buffer?
    //groupshared[?];
    //

}

One more thing.  I may be incorrect in assuming this but I assume that memory on the GPU is similar to memory outside of the GPU.  If I have a buffer that is passes to the GPU and I know how my data is lined up inside of this buffer, I should be able to traverse through this memory to get to what data I need.  My question is how do you traverse memory on the GPU.  If I have a this.

struct PointLightData
{
    float4 color;
    float3 pos;
    float radius;
};

StructuredBuffer<PointLightData> pointLights : register(u0);

[numthreads(1, 1, 1)]
void CS( ComputeIn input )
{
    //FIGURE OUT WHAT LIGHTS HIT THIS TILE!

}

I assume that pointLights is a "pointer" to the beginning of this memory.  How would I go about traversing all of the memory inside of this buffer?  Suppose I know the total size of the memory and will not go out of bounds?

If anyone can shed some light on any of these topics I would greatly appreciate it!

Thanks!

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:
XNA - move camera over tilemap I am trying to build a game based on Advance Wars in XNA.
I am so far where the tiles are placed on the screen, except here starts my problem. During the game, I ofcourse want to move the camera around over the map.

Except I got no idea on how to do this. I hope there is a way of just moving a camera around and not reposition every object on the map (thus all the tiles and units), since that is currently to only thing I might get to work, with my current knowledge.

Sorry for the short post, please let me know if I need to provide code or anything else.

sentences:
After sometime increase the speed of Instantiated object This may look similar to "increase speed after every N seconds" type question but it's different because objects are being Instantiated and getting destroyed.

In my start() method I'm calling a method called CreateObstacle() after a certain time interval using InvokeRepeating method:

InvokeRepeating("CreateObstacle", 1, 3f);

For those who don't know about the parameters of InvokeRepeating method. The first one is the method name which you want to call. The second is the number of seconds to delay these repeated calls. And the third parameter is the number of seconds between method calls.

In update() method I'm simply storing time per seconds in a float translation:

translation = Time.time;

Then finally in CreateObstacle() method I'm checking that if the seconds are less than 10 then Instantiate ((rocks), new Vector3 (11, -3, 0), Quaternion.identity); else if seconds are greater than 10 do the same Instantiate ((rocks), new Vector3 (11, -3, 0), Quaternion.identity); but with more speed.
So, how to increase speed of the object that is being Instantiated after a certain time interval say 10 seconds. On in which method I should call the InvokeRepeating to decrease it's speed?

but with more speed Explanation:
 Rocks are moving from right to left in the screen. And after every 3 seconds a new rock appears, move right to left and get destroyed. So what I want is that after sometime say 10 seconds the speed of right to left motion increase.

sentences:
Is character movement with an animated sprite controlled by the animation itself or moved manually? How is a walking animation of a given character designed? I can see two possible ways:

The first way is to draw each frame of the animation such that, if the frames are displayed at position (0,0), the character walk but does not really move (I mean: at frame 10, the character is still at the left, upper corner of the screen). This means that one needs a way to move (translate) the frames manually.

The other way is to draw each frame such that their width grows progressively. Drawing the frame i at position (0,0) will give the impression that the character is really moving (not only walking on the same point). This way is the graphic artist that do all the job, but the animation is completely controlled by him, so he can give a specific style to the walking animation.

The first one seems to be the right way to do things, but one would need a way to say: ok, frame 0 last 50 ms at (0,0), frame 1 last 30 ms at (5, 0), frame 2 last 15 ms at (13, 0) etc...

This makes things much more complicated.

What is the best practices? What way do you usually adopt/suggest?

sentences:
Setting object O2 to have the same geometric relation to P2 as O1 has to P1 I'm trying to place Object O2 with the same relation to P2 that O1 has to P1, like shown in the picture below.

This is a problem that I'm facing trying to implement portals in Unreal Engine 4, where:

O1 is the player camera
P1 is a portal
O2 is a second camera, used to render the scene from the perspective of the other portal
P2 is the portal linked to P1

// Get the player position in relation to this portal and project it in relation to the linked portal
FMatrix NewCameraWorldMatrix = LinkedPortal->GetTransform().ToMatrixWithScale() * GetTransform().ToMatrixWithScale().Inverse() * PlayerCamera->GetComponentTransform().ToMatrixWithScale();
FTransform NewCameraWorldTransform = FTransform(NewCameraWorldMatrix);
PortalCameraAnchor->SetWorldLocationAndRotation(NewCameraWorldTransform.GetTranslation(), NewCameraWorldTransform.GetRotation());

However, the above code is not solving the problem I presented and I can't figure out why.
Any ideas on what may be the issue?
Note: I've wrapped the PortalCamera with an Anchor since the PortalCamera must have a specific relative orientation at all times and using SetWorldLocationAndRotation directly on it would mess up its rotation.
Note: I have these logs (one per portal) which might be useful:
LogTemp: Warning: ---------------------------------------------------------------------------------------
LogTemp: Warning: GetTransform().ToMatrixWithScale().Inverse(): [-1 2.38419e-07 0 -0] [-2.38419e-07 -1 0 0] [0 -0 1 -0] [-1410 1570 -420 1]
LogTemp: Warning: LinkedPortal->GetTransform().ToMatrixWithScale(): [1 0 0 0] [0 1 0 0] [0 0 1 0] [820 -1410 420.238 1]
LogTemp: Warning: PlayerCamera->GetComponentTransform().ToMatrixWithScale(): [0.572059 -0.791792 0.214041 0] [0.810578 0.585631 0 0] [-0.125349 0.173497 0.976825 0] [-372.749 -65.9088 332.374 1]
LogTemp: Warning: NewCameraWorldMatrix: [-0.572059 0.791793 -0.214042 0] [-0.810578 -0.585631 -5.10315e-08 0] [-0.125349 0.173497 0.976825 0] [767.052 3445.01 -144.706 1]
LogTemp: Warning: NewCameraWorldTransform.GetTranslation(): X=767.052 Y=3445.011 Z=-144.706
LogTemp: Warning: NewCameraWorldTransform.GetRotation(): X=-0.095848404 Y=0.048997864 Z=0.885227978 W=0.452530354
LogTemp: Warning: ---------------------------------------------------------------------------------------
LogTemp: Warning: GetTransform().ToMatrixWithScale().Inverse(): [1 -0 0 -0] [-0 1 -0 0] [0 -0 1 -0] [-820 1410 -420.238 1]
LogTemp: Warning: LinkedPortal->GetTransform().ToMatrixWithScale(): [-1 -2.38419e-07 0 0] [2.38419e-07 -1 0 0] [0 0 1 0] [-1410 1570 420 1]
LogTemp: Warning: PlayerCamera->GetComponentTransform().ToMatrixWithScale(): [0.572059 -0.791792 0.214041 0] [0.810578 0.585631 0 0] [-0.125349 0.173497 0.976825 0] [-372.749 -65.9088 332.374 1]
LogTemp: Warning: NewCameraWorldMatrix: [-0.572059 0.791792 -0.214041 0] [-0.810577 -0.585631 5.10314e-08 0] [-0.125349 0.173497 0.976825 0] [767.11 3444.93 -145.171 1]
LogTemp: Warning: NewCameraWorldTransform.GetTranslation(): X=767.110 Y=3444.927 Z=-145.171
LogTemp: Warning: NewCameraWorldTransform.GetRotation(): X=-0.095848396 Y=0.048997886 Z=0.885228097 W=0.452530175
LogTemp: Warning: ---------------------------------------------------------------------------------------

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:
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:
How do I constrain a specific area of an actor to mouse X and Y? I recently watched this tutorial "Actor Constraints in GameSalad" detailing how to constrain the center of an actor to the mouse X and Y, but I would like to constrain the relative clicked pixel of the actor to the mouse X and Y, not the center of the actor.

In other words, I want to avoid the "jumping" nature of "constrain self.Position.X to game.Mouse.Position.X" when I click and drag.

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:
my movement is working good on keyboard but on android its not So basically here is what my movement is like for keys:

key down

 if (keycode == Keys.LEFT) {
                mishi.getAcceleration().x = -13;
            }

key up

if (keycode == Keys.LEFT) {
            mishi.getAcceleration().x = 0;
            mishi.getVelocity().x = 0;
            mishi.setRotation(0);
        }

touch down

            if (x >= 0 && x < 1 && y > 5 && y < 8) {
                mishi.getAcceleration().x = -13;
            }

touch up

if (x >= 0 && x < 1 && y > 5 && y < 8) {
            mishi.getAcceleration().x = 0;
            mishi.getVelocity().x = 0;
            mishi.setRotation(0);
        }

So its basically the same thing, however, on android when I move around my player doesn't stop he just keeps going. Its hard to explain but it just feels and looks wrong, you have to touch around to get it to work properly but its unplayable. I think it has to do with the fact that I am moving with 2 touches but not sure how to handle it. I tried adding 2 input processes and combining them but it produced the same results.

I saw some code online using a map to hold in the pointers but I am not sure how to utilize those pointers in this scenario where 2 keys being pressed are both for movement and they need to be combined so that I can move up/right or down/left diagonally.

sentences:
D3D9CAPS gives unusual maximum shader instructions value I'm trying to implement a vertex and pixel shader on a piece of hardware we're developing a game for which uses the DirectX 9.0c runtime.  The shaders are for boned mesh animation and is a bit more complicated than the only other shader I have gotten working so far which is a simple 2d sprite shader.  The boned mesh shader seems to work fine when developing on my PC but doesn't work when I transfer it over to the target hardware.  This lead me to checking the hardware capabilities of both machines to check for any differences and I got the following unusual results:

Development machine Dx9 cap results:

Maximum primitive count: 16777215
Device supports level 3.0 vertex shaders
Vertex shader maximum number of instructions run when using flow control 65535
Vertex shader maximum number of constant buffers 256
Vertex shader maximum number of 30 instruction slots 4096
Vertex shader instruction predication supported
Vertex shader dynamic flow control depth 24
Vertex shader number of temporary registers 32
Vertex shader static flow control depth 4
Device supports level 3.0 pixel shaders
Pixel shader maximum number of instructions run when using flow control 65535
Pixel shader maximum value of arithmetic component 65504.000000
Pixel shader maximum number of instruction slots 4096
Pixel shader instruction predication supported
Pixel shader dynamic flow control depth 24
Pixel shader number of temporary registers 32
Pixel shader static flow control depth 4
Pixel shader number of instruction slots 512

Target machine Dx9 cap results:

Maximum primitive count: 5592405
Device supports level 3.0 vertex shaders
Vertex shader maximum number of instructions run when using flow control -1
Vertex shader maximum number of constant buffers 256
Vertex shader maximum number of 30 instruction slots 32768
Vertex shader instruction predication supported
Vertex shader dynamic flow control depth 24
Vertex shader number of temporary registers 32
Vertex shader static flow control depth 4
Device supports level 3.0 pixel shaders
Pixel shader maximum number of instructions run when using flow control -1
Pixel shader maximum value of arithmetic component 340282346638528860000000000000000000000.000000
Pixel shader maximum number of instruction slots 32768
Pixel shader instruction predication supported
Pixel shader dynamic flow control depth 24
Pixel shader number of temporary registers 32
Pixel shader static flow control depth 4
Pixel shader number of instruction slots 512

What I found unusual was the maximum number of instructions during flow control was -1 for both the pixel and vertex shaders on the target machine.  Is it the case that the target hardware can only support shaders with no flow control?  i.e. no for loops, if conditions etc.

The only reason I ask is because the simple shader, with no flow control, works fine but the more complicated boned mesh shader, with for loops and if conditions, isn't working.  It just seemed like too much of a coincidence that the only major difference between the two caps seems to be the flow control based one or am I barking up the wrong tree?

In case this helps I've linked the two shaders I've written just in case there's any obvious errors in there:

2D Sprite shader:
https://pastebin.com/0G9swKu6

3D Boned Mesh shader:
https://pastebin.com/Ayd0bXWU

Any input/ideas would be greatly appreciated.

sentences:
360+ degree rotation skips back to 0 degrees when using Math.Atan2(y, x) I'm new to XNA and this is my first actual project, so forgive my noobness.

I'm using

 jointAngle = System.Math.Atan2(RightStick.Y, RightStick.X);

in order to set an angle of a joint (farseer) so that the attached body points in the direction pushed with the right joystick. This all works great and i get values from negative pi to pi which correlate with the pushed direction. The problem arises when i go from 360 degrees to 361. Instead of the continued rotation beyond 360 degrees that one might expect, it jumps back to 0 degrees (or -3.14 radians), which causes a jerking motion as the joint suddenly shifts 359 degrees back instead of 1 forward.

Is there a simple way to account for this? I came up with a few solutions, but they're all pretty messy at best and completely unreliable at worst.

Please help!

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:
Unity - Tile based river generation I have made a map generation in my tile based game. It almost exactly does what I want, except for 1 thing. The rivers look like this:

The problem with this is, the water is not realistic. It are just some spots random over the world. I want to make a realistic river generation. Which would include different sizes (between 5 and 20 block wide), branches, lakes and different depths (by changing the colour of the water). What is the best way to do that?

Here is an Simcity 4 example of what I mean with realistic rivers:

My code:

waterOffsetX = Random.Range (10f, 300000f);
waterOffsetX = Mathf.Round (waterOffsetX) + 0.5f;
waterOffsetY = Random.Range (10f, 300000f);
waterOffsetY = Mathf.Round (waterOffsetY) + 0.5f;

for (float x = -gridX; x < gridX; x += 1)
{
    for (float y = -gridY; y < gridY; y += 1)
    {
        Vector3 spawnPos = new Vector3 (x, y, 0);
        float perlinWater = Mathf.PerlinNoise (x * seedWaterX + waterOffsetX , y * seedWaterY + waterOffsetY);

        if (perlinWater > perlinThresholdWater) {
        GameObject waterTile = Instantiate (water, spawnPos, Quaternion.identity) as GameObject;
    }
    }
}

Values:
seedWater (X & Y) = 0.1
Grid (X & Y) = 50
perlinThresholdWater = 0.6

sentences:
Will I have an easier time learning OpenGL in Pygame or Pyglet? (NeHe tutorials downloaded) I'm looking between PyGame and Pyglet, Pyglet seems to be somewhat newer and more Pythony, but it's last release according to Wikipedia is January '10. PyGame seems to have more documentation, more recent updates, and more published books/tutorials on the web for learning.

I downloaded both the Pyglet and PyGame versions of the NeHe OpenGL tutorials (Lessons 1-10) which cover this material:

lesson01 - Setting up the window
lesson02 - Polygons
lesson03 - Adding color
lesson04 - Rotation
lesson05 - 3D
lesson06 - Textures
lesson07 - Filters, Lighting, input
lesson08 - Blending (transparency)
lesson09 - 2D Sprites in 3D
lesson10 - Moving in a 3D world

What do you guys think? Is my hunch that I'll be better off working with PyGame somewhat warranted?

sentences:
Pros and cons of different integrators When creating things like physics in games you need an integrator. I've seen Verlet integration mentioned several places as a great alternative to Euler integration. For instance in the famous document by Thomas Jakobsen. However in this article Glenn Fiedler writes:

  Rather than introduce you to the vast array of different integrators that exist, I’m going to cut to the chase and go straight to the best. This integrator is called the Runge Kutta order 4 integrator aka RK4.

So apparently there's no silver bullet. What is the pros and cons of different integrators? Regarding simplicity, speed, accuracy, stability, etc. Which integrators is most suitable for which types of games? When would you use Verlet, RK4 or others? Should you ever use Euler?

sentences:
Spot and area lights inconsistent Im having problems with area light and spotlight. When adjusting parameters the change is not consistent and sometimes the light grows tstronger and then dissapears and then reappears very strong, when increasong the strength.

Also i have a spotlight that only affects the 3d meshes that is the environemnt but not the ground, which is textured plane.

Wehn playing the game some area lights switch on or off depending on what angle and distance from it i am at the moment. Are the lights supposed to be able to be used dynamically ?

Im using the free version of Unity. Could this be affecting?

sentences:
How to change FoV in vertex shader? Is it possible to change the Field of View vertex shader? I zoom my camera by changing the FoV value. However this will cause the skybox also be zoomed and this is not what I wanted. Is it possible to change the FoV value of the projection matrix in vertex shader?

Specifically, I pass the projection matrix by uniform to a glsl shader. I want to change the FoV value of the projection matrix (to make a new projection matrix) in the vertex shader of the skybox.

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:
Multitexturing depending on given variables? I'm having trouble with rendering multiple textures.
Using XNA gamestudio: working with 3D meshes and texturing.
Effect.fx HLSL

I do have a map/level that loads from a heightmap. - This works

I have created an effect.fx file that renders the textures. - This works

Multitexturing shader works to a degree where I hardly can alter the function.

So I can fade from different textures if I pass a height value, would have worked fine if the world was meant to be solid/static, but that's not the case here.

I want to hold certain variables to the vertex/faces and alter them in realtime while the vertexshader and the other drawing components renders it correctly as the variables is being altered.

If I wanted to paint a vertex/face red on a Grass-textured plane then this mentioned vertex/face would then be red.

I'm having a hard time finding the problem.
Wasn't able to make a 2 dimensional for loop within the Pass technique loop
"that just made too much thinking and almost crashed the application"

Have looked trough the source codes for a few example app with no success.

I even bought a book on the subject, but all I've got so far is how to render different textures when the vertex/faces reaches a certain height value on the Y axis.

sentences:
how to center 3d camera vertically and horizontally How to center the player/camera in the middle of the window/screen , to mimic a 2.5d camera, so it looks like this game:

where I can move vertically and horizontally , and the camera still be centered on the player?
Edit: I want to center it 18 pixels in the 4 directions

sentences:
How to combine bilateral blur passes? I'm changing to bilateral blur for my SSAO  implementation, just wondering how people usually combine the two passes - do you just add them together, or average, or something else?
I happen to be using Vulkan but don't think that should affect the answer too much.

sentences:
Converting Shader to ShaderGraph for URP conversion I know there are a bunch of threads asking for help with converting old shaders to ShaderGraph, and this one is no different.
I spent a lot of time trying to get a shader to cast shadows from sprites that also works with transparency. Eventually landing on this thread
I was able to work out the following shader that did what I wanted
Shader "Custom/SpriteShadowWithAlpha"{
    Properties
    {
        [PerRendererData] _MainTex("Texture", 2D) = "white" {}
        _EffectColor1("Effect Color", Color) = (1,1,1,1)
        _Crossfade("Fade", float) = 0
        _FlashColor("Flash Color", Color) = (1,1,1,1)
        _FlashAmount("Flash Amount",Range(0.0,1.0)) = 0
        _Cutoff("Alpha Cutoff", Range(0,1)) = 0.9
        _Color ("Color", Color) = (1,1,1,1)
    [Toggle(_ALPHABLEND_ON)] ALPHABLEND_ON("Enable Dithered Shadows", Float) = 0.0

    }
    SubShader
    {
        Tags
        {
            "Queue" = "Transparent"
            "IgnoreProjector" = "True"
            "RenderType" = "TransparentCutOut"
            "PreviewType" = "Plane"
            "CanUseSpriteAtlas" = "True"
        }

        Cull Off
        Lighting Off
        ZWrite Off
        Blend SrcAlpha OneMinusSrcAlpha
        CGPROGRAM
            #pragma surface surf Lambert alpha:blend fullforwardshadows alphatest:_Cutoff
            #pragma target 3.0

            struct Input {
                fixed2 uv_MainTex;
                fixed4 color : COLOR;
            };
            sampler2D _MainTex;
            fixed4 _EffectColor1;
            fixed _Crossfade;
            fixed4 _FlashColor;
            float _FlashAmount;
            void surf(Input IN, inout SurfaceOutput o)
            {
                fixed4 col = tex2D(_MainTex, IN.uv_MainTex);
                fixed4 returnColor = lerp(col, col * _EffectColor1, _Crossfade) * _EffectColor1.a + col * (1.0 - _EffectColor1.a);
                o.Albedo = returnColor.rgb * IN.color.rgb;
                o.Alpha = col.a * IN.color.a;
                o.Albedo = lerp(o.Albedo,_FlashColor.rgb,_FlashAmount);

            }
        ENDCG
    }
    Fallback "Standard"
}

After that I found that using the built-in render pipeline was the difference between 40% and 7% GPU utilization when converted to URP using a different sprite shadow shader.
Problem is the URP shader I found did make sprites cast shadows, but all the lighting was off, and messing with the X rotation on the sprites to get them to stand off the ground would cause them to explode into balls of white light from the directional light....I don't get why.
So I set off to try and convert my old working Shader to ShaderGraph
I have been trying to deduce what parts of this code corelate to what blocks exist in ShaderGraph.
I understand when 2 variables have a * between them I need to use a multiply block
After about 3 hours of linking different blocks I was left with....nothing and a mess

I was wondering if anyone could point me in the right direction as to what blocks correspond to what variables.
Like the code
void surf(Input IN, inout SurfaceOutput o)

I am not too sure what sort of block this would be, it seems like a function, and I have no clue how to make that visually
or the block of "Tags" no idea where to start there
or the toggling of _ALPHABLEND_ON

sentences:
How to move objects in any direction by swiping with libgdx android game development first of,  I'm new to android game development so I don't know all the classes and dictionaries within android and libgdx. I'm actually following a game development tutorial for the first time (kilobolt) but I already have some ideas for games I want to make after finishing the tutorial. So here's my question:

Let's say you have a box with a small ball in it. When you touch-hold the ball, you hold the ball "in your hand". Then you swipe across the screen with the ball in hand and "let go" (release touch), the ball rolls in the direction you swiped with the speed of your swipe, decreasing in speed according to a set friction.

Is it possible to implement such a function with libgdx? If yes, could you please explain how to make it?

sentences:
Setting Krypton Light to Screen Pixels So a few days back, I started playing around with Krypton XNA for 2D lighting in my game.

I noticed in general, that spawning a light at (0,0) with Krypton causes the light to appear in, pretty much, the centre of the game screen. Is there any way to change this so a Krypton light's "starting point" at [0,0] would spawn at the top left of the screen, and thus follow the standard screen co-ordinates for position?

I ask because currently I'm busy working on my game where my spawn point is [512,512]. With hard code, the closest I've got to the light being "central" to this point is the vector position [12,-20], which makes no sense and is impossible to craft, mathematically, if I want the light to move with the camera (the position [480,512] maps roughly to [10,-20]).

So, is there any way to "normalise" the krypton lights to use standard screen co-ordinates?

If you guys can, play around with the demo from the site and please see if you can find anything out about it. Documentation on the engine is rather scarce, so it's difficult to find anything relevant to my "pixel-perfect" need. It might just also be something in the code with regards to the matrices that I'm not fully understanding.

Any help would be useful.

Thanks.

sentences:
What is actually drawn when glDrawArrays and glDrawElements are called? In my journey out of immediate mode I've come across a snag that I haven't been able to find a decent answer for in any tutorial or API, namely: Which data structures are actually invoked when I make a call to a glDraw* function in OpenGL3.3+?

For example, if I want to draw two 3D models and I've put their vertex data in two different VBO's, does invoking glDrawArrays draw everything set under the current VAO? Or does it only draw the currently bound VBO sampling from the currently bound texture?

I basically understand VAO's and VBO's conceptually but its down to implementation that I'm running into problems, it's a big jump to go from the "stability" of immediate mode to the a-synchronicity of modern OpenGL.

sentences:
How can I make this tile map correctly? I'm having the following problem creating this hexa tiled map.

this is what I wanted :

[EDIT]
Ok I've Managed to do this:

const float scaleX = ((float)tileWidth) / 10000,
    scaleY = ((float)tileHeight ) / 10000;
    const float hexagon_r = scaleY / 2;
    const float hexagon_dx = hexagon_r * cosf(30*3.14f / 180.0);
    const float hexagon_dy = hexagon_r * sinf(30*3.14f / 180.0);
    const float hexagon_gx = 2.0*hexagon_dx;
    const float hexagon_gy = 2.0*hexagon_dx*sinf(60*3.14f / 180.0);
    Vector2 auxPos;
    auxPos.x = 0;
    auxPos.y = 0;
    float j = 0;
    for (unsigned int y = 0; y < layer->layerHeight; y++, j += hexagon_gx * 2)
    {
        auxPos.y = y * (hexagon_gy * -2 );
        auxPos.x = j;
        for (unsigned int x = 0; x < layer->layerWidth; x++)
        {

            auxPos.x += hexagon_gx * 2;

            float angle =90 * 3.14f / 180;

            auxPos.y += hexagon_gy * 2;

            SetData(stack->vData, stack->vCounter + 0, auxPos.x + ((-scaleX) * cosf(angle) + (-scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 1, auxPos.y + ((-scaleX) * sinf(angle) + (-scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 2, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 3, auxPos.x + ((scaleX) * cosf(angle) + (-scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 4, auxPos.y + ((scaleX) * sinf(angle) + (-scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 5, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 6, auxPos.x + ((scaleX) * cosf(angle) + (scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 7, auxPos.y + ((scaleX) * sinf(angle) + (scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 8, layer->layerDepth);

            SetData(stack->vData, stack->vCounter + 9, auxPos.x + ((-scaleX) * cosf(angle) + (scaleY) * -sinf(angle)));
            SetData(stack->vData, stack->vCounter + 10, auxPos.y + ((-scaleX) * sinf(angle) + (scaleY) * cosf(angle)));
            SetData(stack->vData, stack->vCounter + 11, layer->layerDepth);
        }
    }

can't seem to make this work...

sentences:
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:
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:
LibGDX Shader that converts sprite to single colour with blurred edges I made a shader which turns all the colours of the texture to black but I also want it to be blurred at the edges where the opaque sprite turns transparent.
Original texture with desired output.

#ifdef GL_ES
    precision mediump float;
#endif

varying vec4 v_color;
varying vec2 v_texCoords;

uniform sampler2D u_texture;

void main() {
  vec4 c = v_color * texture2D(u_texture, v_texCoords);
  gl_FragColor = vec4(0,0,0, c.a);
}

A simple gaussian blur with good performance is what I want.
This shadertoy shader looks ideal: https://www.shadertoy.com/view/Xltfzj
I managed to convert the above mentioned shadertoy to GLSL which works fine, but I don't know how to make it first turn the texture black before blurring.
#ifdef GL_ES
    #define PRECISION mediump
    precision PRECISION float;
    precision PRECISION int;
#endif

varying vec4 v_color;
varying vec2 v_texCoords;

uniform sampler2D u_texture;
uniform vec2 resolution;

void main() {
    float Pi = 6.28318530718; // Pi*2

    // GAUSSIAN BLUR SETTINGS {{{
    float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)
    float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)
    float Size = 8.0; // BLUR SIZE (Radius)
    // GAUSSIAN BLUR SETTINGS }}}

    vec2 Radius = Size / resolution.xy;

    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = v_texCoords;
    // Pixel colour
    vec4 Color = texture2D(u_texture, uv);

    // Blur calculations
    for( float d=0.0; d<Pi; d+=Pi/Directions) {
        for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality) {
            Color += texture2D( u_texture, uv+vec2(cos(d),sin(d))*Radius*i);
        }
    }

    // Output to screen
    Color /= Quality * Directions - 15.0;
    gl_FragColor =  Color;
}

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: How to display a list of 2D arrays in the inspector Simply put, how do I make public List<bool[,]> appear in the inspector? Every 'bool[,]' is a solution to a puzzle in my game and I want to be able to view and edit them in the inspector.

sentences: Unity3D: Convert all game objects to same size irrespective of it's scale Suppose I have a reference GameObject, Cube, with scale (1,1,1). There is another GameObject with scale (1,1,1), but the size is 3 times bigger than the Cube. How do I dynamically change the scale of the Game objects to fit the size of the Cube?

sentences:
Are browser games still profitable? Back in middle school I would play games like bowman, kitten cannon, sniper assassin, etc. On sites like addictinggames.com, or crazymonkeygames.com.

I know these games would have ads run on them, which I assume was profitable for the developer. Especially titles like those that probably have 8 figure play-stats across the internet.

I was wondering if anyone has any experience with this market, and could provide some insight as to how it is doing now, and what is used to make these games: Is it financially worth developing a browser game? Do I have to use flash to be accepted on these sites?

Back then they were all flash games, but there has been a large uprising of javascript game engines since then (which I am much more familiar with.) But I'm not sure if that's something these sites would accept.

sentences:
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:
Should the main game object be static in c++ I am creating a 2d platformer using SDL and I was thinking that my game object could be static, but I wasn't sure if this was a good idea.

The pros (that I can see):

Accessing settings options (such as screen size and keyboard bindings) would be easier accessed
There should only ever be one main game loop, so this makes sure for me.

The cons:

From what I've heard, static classes in C++ are a bear to work with
I've read that this may cause problems later in development (things don't work right or can't be used properly

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 can I make the code run only once when I release the key? Im making a game in LWJGL 2 and Slick2d. Im trying to add an item to my inventory by releasing a key (the inventory system works properly, the part where I have to see if the button was RELEASED is difficult). Right now when I do...

if (Keyboard.getEventKey() == Keyboard.KEY_L) {
    if(Keyboard.getEventKeyState() == false){
        Inventory.addItem(1);
    }
}

... In my update method, Instead of it only calling the 2nd if statement once, ( because you can only release a key once) It just keeps going because the getEventKeyState variable stays false, but if Ive already released it once it should switch back to the opposite. Although I can do it by making it add an item when i hold the key, I cant exactly make it add only the 1 item, it keeps adding items while I hold it.

public static void addItem(int id){
    for(InventorySlot s : inventoryslots){
        if(s.getItem() == -1){
            s.setItem(id);
            System.out.println("Added item " + id + "!");
            break;
        }
    }
}

Thats the addItem method, and if I would approach this by making it add the item while holding, I would have to make it so that it adds it only once. Any suggestions please? Thank you

sentences:
Bloom does not work for Mobile [Unity] I've added the Mobile Bloom shader to the camera and I have Emissive HDR objects in my scene and I've set the graphics quality to the highest. I do not have anti-aliasing enabled but the bloom effect only appears in the editor play mode and not on my android mobile device.

If anybody could tell me all the setting I have to check or post screenshots of a working setup it would be very helpful.

Thanks.

sentences: Should I separate the Pathfinding info from the Tile Info class? I have implemented A* on a Tile Based Game, my Tile class contains a lot of info like Position, TileType, Items, Characters, etc on it. Right now that class has the Edges references(neighbours), movement cost, etc. Should I create a new Class like Node to just contains the Pathfinding related info?

sentences:
Transform bone absolute position to relative position I'm working on adding IK to my engine and right now I'm implementing the FABRIK algorithm to give full support to more than three bones.
The algorithm works by giving the joints positions, the start position (first joint), the target, and a threshold. I have already wrote the code and, as far as I can tell, it is correct.
When I use the algorithm I feed the world positions of each bones in the current frame and the target to reach and then the algorithm returns the position each bone should be in.
The issue is that the positions returned are also in WS and my animation library, Cal3D's setTranslation function, requires the relative translation of the bone (if I'm not wrong, this is the position relative to the father bone).
Does anybody know how I should transform the WS my bone is supposed to be at to the relative position I must give to the setTranslation method? Is that possible?

sentences:
Making knockback in c++ I want to implement a "knockback" in my 2D game, but I have no idea how to do it. I've found some tutorials on google but nothing help. (My knowledge about math is a little limited when we're talking about Cartesian plane)

Well let's just figure out, I have the player and the monster on my map (2 vectors) and when I touch the monster, BOOOM, I get "knockbacked" at the OPPOSITE direction (not left, right, top or bottom) that I touch him.

I have the following code on my project:

CollisionManager.cpp

CollisionManager::CollisionManager()
{
}

CollisionManager::~CollisionManager()
{
}

bool CollisionManager::checkCollisionWithWall(SDL_Rect box, std::vector<Tile*> tiles)
{
    return touchesWall(box, tiles);
}

void CollisionManager::checkCollisionEnemy(Player * player, GameObject * enemy)
{
    if (enemy->type() == std::string("Enemy"))
    {
        return;
    }
    if (SDL_HasIntersection(&player->getCollisionBox(), &enemy->getCollisionBox()))
    {
        player->collision(enemy);
    }
}

The player's collision function (almost nothing here):

void Player::collision(GameObject* collisionObject)
{
    isKnockbacking = true;
    hp -= 2;

}

Ahh and my moving function is inherited from my Entity class:

void Entity::checkTileCollision(std::vector<Tile*> tiles)
{
    if (isKnockbacking == false) {
        //Move the dot left or right
        v2DPosition.m_x += v2DVelocity.m_x;
        collisionBox.x = v2DPosition.m_x;

        //If the dot collided or went too far to the left or right
        if ((v2DPosition.m_x < 0) ||
        (v2DPosition.m_x + 18 > Game::Instance()->getScreenWidth()) ||
        collisionManager->checkCollisionWithWall(collisionBox, tiles))
        {
            //Move back
            v2DPosition.m_x -= v2DVelocity.m_x;
            collisionBox.x = v2DPosition.m_x;
        }

        //Move the dot up or down
        v2DPosition.m_y += v2DVelocity.m_y;
        collisionBox.y = v2DPosition.m_y;

        //If the dot collided or went too far up or down
        if ((v2DPosition.m_y < 0) ||
        (v2DPosition.m_y + 18 > Game::Instance()->getScreenHeight()) ||
        collisionManager->checkCollisionWithWall(collisionBox, tiles))
        {
            //Move back
            v2DPosition.m_y -= v2DVelocity.m_y;
            collisionBox.y = v2DPosition.m_y;
        }
    }
}

I've followed LazyFoo, SDL Game Development book and some other tutorials on YouTube to make it.

If I need to be more specific, just tell me.

sentences:
Is there a "Least Terrible Method" for sharing Entities over Network? (Preface: Using C++, Box2D, and built UDP client and server classes that are reasonable efficient for a built-from-scratch game using client-server model.)

This question is specifically in regards to an MMORPG (WoW, Rift, Maplestory) / ARPG (Diablo, Path of Exile, etc) setup. My conundrum is this: How to efficiently share only what the client needs to know, without running the server (performance) into the floor?

To elaborate, I have narrowed down to three separate approaches, but all of them feel horrifyingly inefficient and "iteration-spammy". I will detail each below as succintly as I can, though (hopefully) with enough actionable information. My concern is keeping the CPU time as short as possible as a physical server may be running 20+ zones (or "level", if that makes more sense). I will not be sending full data each time, more of full data "as needed" (ex: id, health, x/y/z, velocity), then changes as they occur (ex: [id, x/y/z], [id, new health], [id, velocity]).

To keep things consistent, I will give the following example "setup" that will be referenced with each approach.

Map size is 20 'units' by 6 'units'
Players / NPCS are 0.5 'units'
squared.
Sight Range: 1.5 'units' from player center, in a circle.
Number of Players: 3
Number of NPCs: 10

Approach A: Entity-based Checking

This consists of the server either iterating over all NPCs from each player's perspective (or all players from each NPC's perspective). This would look something like "for each player, loop through npcs and check if within n "units" of player. Once player's iteration is done, create and send payload to said player before next player's iteration" (where 'n' = sight range). This is fine in principle, until there are 10-20 players and 100+ NPCs. That ends up with 1,000+ iterations occurring each round (1-3 rounds per second). Again, not horrible by iteself, but 20+ zones could make this exceptionally slow and ruining the player experience.

Approach B: Tile-based Checking

By the use of tiles of size 'n' squared (again, 'n' = sight range), divide up the map. With the example map size, let's say it becomes 10 nearly perfectly fitting tiles. For this, the server would maintain the data per tile, then send concatenated entity data (e.g. vector) of tiles which the player is inside and adjacent tiles. This does have the advantage of breaking up the into much more managable areas, though it feels like maintaining the location checking for these tiles may become just as tedious as Approach A in that each 'round' (again, 1-3 rounds per second) the bounds checking will need to be performed against each entity multiplied by the number of tiles; 10 tiles x (10 NPCs + 3 Players) = 130 possible iterations.

Approach C: Lazy Physics-based Checking

I believe this is either the least terrible or the absolute most terrible (with no middle ground), though I cannot definitively prove which side of the fence it is standing. This would consist of creating an invisible circle around the player equal to their sight range as a radius. This has the advantage of using the Box2D collision detection and 'sensor' functionality to lazily determine what is and is not in range. Though, given what I've seen from working with Box2D, this is likely similar to simply iterating over the Entities themselves. The obvious con would be the requirement to either maintain a list of 'visible' entities or simply rebuild it each 'round'.

If you made it this far, you are a scholar and a saint. I appreciate any feedback, insight, or constructive criticism.

Again, in all seriousness and sincerity, thank you for reading!

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:
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:
Adobe Air Mobile AS3 app: challenges and how to overcome them? I made a PC flash game for LD 26 - minimalism and I am working on porting it to Android.

Some questions I'd like to ask:

Is it bad to heavily use vector graphics (ie. this.graphics.lineTo()) in Mobile Air?
Does Stencyl completely alleviate this issue?
Are there any inherit disadvantages to using Air Mobile that I'm missing?
Where is the documentation for Air mobile (I googled and found no recent books or documentation pdf so far)

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:
Java code for client-server game on Android I have developed a game on Android. Now I want to play it on wifi or 3G. I have game packets which I want to send form client (mobile) to server then to another client (mobile).

I don't know how to write code in Java to send the playPackets continuously to server and receive the playPacket continuously from the server to the clients.

I guess I have to use two thread one for sending and one for receiving.

Can someone help me with the code, or the procedure to write code for it?

sentences:
Measuring enemy "success" against player I've been toying with an idea for a game prototype where the player must defend against waves of enemies, but between each wave the enemies "evolve" to better combat whatever tactics the player is using. Essentially each enemy type has some genetic information that can be used to generate their health, speed, attack type and so on; with the more "successful" enemy types being mutated into new sub-types, while ineffective enemy types are phased out.

What I'm trying to figure out, is what is a good way of measuring "success" against the player?

EDIT: Although I don't really want to get too specific about the game mechanics, let's assume that the game world is complex enough that you cannot figure out if an enemy type will be effective against the player without testing it.

So far I've thought of two basic solutions:

Use heuristics like whether a certain
enemy deals damage to the player or survives a long time without
being killed.

The problem I have with this approach is that it can be exploited if (when) the player
figures out how the algorithm works. For example you would be able to
deliberately let the weakest enemies land a few free hits to trick
the game into creating more of them. It may be possible to improve this with better heuristics however.
Only use about half the pool of enemy types at once and
swap types in and out randomly between waves. Analysis could
then be performed on the player's performance throughout the wave and each participating enemy type would be considered equally successful/unsuccessful. After a number of waves the success of  enemy types would be varied enough to perform mutation/deletion.

This solution seems intuitively harder to exploit and it would also pick up on successful combinations of enemy types that might not be possible to detect by looking at individuals, however it might also result in anomalies where useless enemy types are considered successful because they happened to get assigned to waves with stronger enemy types backing them up.

To clarify, I'm not asking about the actual process of evolving enemies, just about how to measure which enemies are successful against the player.

sentences:
How can I create a 2D camera with zoom and parallax scrolling that works on every Windows Phone resolution? Mario game that uses parallax scrolling: http://www.youtube.com/watch?v=de5f3mvRyIY

I want to create a Windows Phone jump-and-run game with parallax scrolling. The parallax scrolling should be like in this Mario game. The character should be centered in the viewport.
I use the code of this tutorial to create the camera and parallax scrolling:
http://www.david-gouveia.com/portfolio/2d-camera-with-parallax-scrolling-in-xna/

I can zoom in and zoom out with the camera and the player(basketball) is in the center of the viewport, but parallax scrolling isn’t working correctly on every Windows Phone resolution. I get different results on every resolution. The backgrounds look different on every resolution.

For example:

WVGA emulator(resolution: 800x480pixel): http://s1.directupload.net/images/140730/ljbsolu2.png

720p emulator(resolution: 1280x720pixel): http://s1.directupload.net/images/140730/36ic4rfo.png

If you compare both pictures, you see that the backgrounds are not on the same place on both resolutions when the basketball touches the orange rectangle.

Why are the background layers not on the same place in both pictures?

I use the same sprites and same coordinates for the sprites on every Windows Phone resolution. In the WVGA picture, I just zoomed out with the camera so that you can see the entire background.
How can I create a Windows Phone game that uses parallax scrolling and looks on every resolution the same? The background layers should be on the same place on every resolution.

sentences:
TypeError: R[o5R.F6s] is not a function in changing states in phaser box2d i build my game using phaser.2.4.3.min.js and phaser.2.2.2.box2d.min.js
When trying to change states this error is being raised TypeError: R[o5R.F6s] is not a function and i can't seem to figure out the problem

PS : i took The source code of box2d plugin from the example folder in phaser , and i did not purchase the full plugin yet i was just testing it .

is there anyway to fix this issue ?

here is the game code : http://jsfiddle.net/fbdtq1tg/5/

and here where the error is raised :

SetGameOver: function () {
            this.game.state.start("TheGame");
        }

sentences:
Cinemachine third person camera movement causes misalignment I'm working on third person movement using CinemachineFreeLook as the player camera. At first I thought it was working fine but I've noticed that moving left/right actually moves the character with a curve instead of straight left/right. This behavior can be observed in the following video: https://imgur.com/sLGIia8
As you can see when trying to make the character move left/right the character doesn't stay on the grid but instead curves a bit to the left/right.
I'm inclined to believe that this occurs because of cinemachine camera but I am unsure what exactly is going on and how to fix this. I feel that this is a bit over my head and am thus asking for help in figuring this out.
The simplest form of movement code is as follows (the exact code that moves the character in the video)
private void FixedUpdate()
{
    Vector2 input = playerInput.MoveInput;

    bool hasInput = Mathf.Abs(input.x) > float.Epsilon || Mathf.Abs(input.y) > float.Epsilon;
    if (hasInput)
    {
        // get camera direction
        Transform cameraTransform = Camera.main.transform;
        Vector3 cameraForward = cameraTransform.forward;
        Vector3 cameraDirection = Vector3.Scale(cameraForward, Vector3.right + Vector3.forward);

        // transform camera direction vector to a quaternion
        Quaternion cameraRotation = Quaternion.LookRotation(cameraDirection);

        // transform input vector2 into x/z vector3
        Vector3 inputDirection = new Vector3(input.x, 0f, input.y);

        // create desired velocity from input and current camera rotation
        Vector3 desiredVelocity = cameraRotation * inputDirection * settings.Speed;
        Vector3 delta = desiredVelocity - body.velocity;
        delta.y = 0f;
        Vector3 acceleration = delta / Time.deltaTime;

        if (acceleration.sqrMagnitude > settings.SqrMaxAcceleration)
        {
            acceleration = acceleration.normalized * settings.MaxAcceleration;
        }

        body.AddForce(acceleration, ForceMode.Acceleration);
    }
}

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

This is my world so far:

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

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

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

this.mScene.setBackground(autoParallaxBackground);

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

this.mScene.registerUpdateHandler(this.mPhysicsWorld);

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

sentences:
Is there a centralized achievement system for browserbased onlinegames I plan to implement missions with achievements (or rewards/badges) in my online space browser game spacetrace.

I want somehow connect that to an existing online achievement platform for browser-based HTML5-games?

There are some online platforms that lets users show their achievements in several games they have reached like GameCenter, OpenFeint, Steam, PlaystationNetwork and Scoreloop

But is there a great community for browser-based onlinegames too?

clay.io looks quite promising.

Which is the most used platform that I should implement the achievements on?

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:
Is implementing your own scripting language viable? I am coding a beat 'em up game in C++ and the time has come to implement scripting for events, triggers, cutscenes etc.
I have read around on the internet and gotten a fair bit of information. My first choice solution would be to implement my own scripting language like the one in Cave Story.
I have seen this suggested but most poeple suggest lua but that does not seem to fit my type of programming.

Have you made your own scripting language? Why did you chose to roll your own instead of using an existing one? What resources did you consult during the development?

sentences:
Why doesn't my C#6 code compile in Unity? Why can't Unity work with C# 6 code? It always gives me compiler errors. Here are some code examples:

using static System.Convert;
using static System.Environment;

$"€{punten}{NewLine}€{Money}{NewLine}€{KilledEnemies}{NewLine}€{bonus}{NewLine}€{total}";

I use Visual Studio as my code editor and build with no errors. If I press play in Unity it won't build.

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: What is "ROAM" related to terrain rendering? I saw it mentioned on this question, but no one explained what it is.

sentences:
Are minecraft LANS and servers Filtering Enabled? Non-filtering enabled means any given client can make changes and the server will replicate them. This is faster but opens doors for hackers and exploiters. Filtering enabled means the client provides user input, and the server decided what to do accordingly. This idea came from Roblox, but I wonder if Minecraft servers are filtering enabled?

In other words: Is Minecraft Filtering Enabled?

sentences:
Visual cues in a full 3D game to help the player to identify the location of each object I am working on adding some visual cues to the player to help identify where each objects are in 3D. In many space games, there is usually an indicate on the edge of screen that reflects the direction towards that particular object. For example, an indicator in the upper middle edge of screen may indicate that particular object is straight ahead and an indicator in the lower middle of edge screen may indicate that object is directly behind.

If the game is mostly 2D, such as most FPS shooters, this would not be a difficult problem. Then the indicator is basically a top down radar. But with full 3D, Im unsure how to translate this inherently 3D information to 2D in a intuitive, yet meaningful way. If just using the 2D radar method, then I cant convey pitch/elevation information. For example, an indicator in the upper middle edge of screen can not differentiate between an object that is straight head in the same plane as the player versus something that the player needs to tilt 45 degrees upwards to see.

Is there something better than the top down radar method?

sentences:
Should I shade models before or after importing them into Unity? Is it better to shade a model inside the 3D modeling software or inside Unity?

As an example, if I need to use a transparent model, should it be made transparent inside the modeling application or inside Unity?

sentences:
Rotating an Object Around an 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;

Main Game Loop:

  Object.increaseRotation(dxf,dyf,dzf);

But, it's not rotating along it's own axis. What am I missing here? I want something like this. Please Help

sentences:
How could an XNA game close with no exception being thrown? I've been messing with my game's network code recently (TCP/UDP sockets) and my game keeps shutting down with no exceptions being thrown at all.

It runs fine until the disconnection of a client, so I already know that it has to be related to the network.

My real problem is that no exception is thrown and the game silently exits on both the client and server sides. How's that even possible? What could end the runtime of an XNA game?

sentences:
How to change pixel color of Texture with Fragment Shader I want to change the pixel color of a texture. I don't know where to start and what to add. Really need help, I only find useless snippets in the internet.

My current Code:

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
...
GLES20.glAttachShader(riGraphicTools.sp_SolidColor, vertexShader);
GLES20.glAttachShader(riGraphicTools.sp_SolidColor, fragmentShader);
GLES20.glLinkProgram(riGraphicTools.sp_SolidColor);

vertexShader = riGraphicTools.loadShader(GLES20.GL_VERTEX_SHADER, riGraphicTools.vs_Image);
fragmentShader = riGraphicTools.loadShader(GLES20.GL_FRAGMENT_SHADER, riGraphicTools.test_Image);

riGraphicTools.sp_Image = GLES20.glCreateProgram();
GLES20.glAttachShader(riGraphicTools.sp_Image, fragmentShader);
...
}

The riGraphicTools Class:

public class riGraphicTools {

public static final String test_Image =
        "precision mediump float;" +
        "varying vec2 v_texCoord;" +
        "uniform sampler2D s_texture;" +
        "void main() {" +
        "  gl_FragColor = texture2D( s_texture, v_texCoord );" +
        "}";

public static final String vs_Image =
    "uniform mat4 uMVPMatrix;" +
    "attribute vec4 vPosition;" +
    "attribute vec2 a_texCoord;" +
    "varying vec2 v_texCoord;" +
    "void main() {" +
    "  gl_Position = uMVPMatrix * vPosition;" +
    "  v_texCoord = a_texCoord;" +
    "}";
}

sentences:
How do I combine matrix transformation with non-uniform screen scaling in Flash? I'm using a Flash transformation matrix for affine transformation.

I have a rectangular image being rotated and scaled (in 2D). There are two sets of scaling variables, ScreenScaleX and ScreenScaleY, and ScaleX and ScaleY, as well as a counter-clockwise rotation angle, theta. ScreenScaleX and ScreenScaleY are the scaling factors of the window; they should be applied in directions of the original X and Y axes after rotating the image. ScaleX and ScaleY should be applied in the new X and Y directions after rotating the image.

For example: if theta is 90 degrees, ScreenScaleX and ScreenScaleY will still stretch in the direction of the original X/Y axes, but now ScaleY will stretch in the screen's X direction, and ScaleX will stretch in the screen's Y direction.

I think I can accomplish this with some combination of scaling, rotation, and skewing, but I'm struggling to figure out what the matrix would look like. How would I construct a matrix from these variables in order to perform this transformation?

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:
Destructible tiles in unity's tilemap I'm creating a 2d game and I want to make it so that tiles are destructible whenever a projectile collides with a tile, the problem is I don't know how to get the tile that the projectile is colliding with, I would like to make it so that it area of damage.

However for now I want to make it so that once the projectile reaches the ground it destroys the tile it's sitting on I've made a collider2d to help me with that but I still have no idea how to get the tile that's the projectile is sitting on.

IEnumerator OnCollisionEnter2D(Collision2D x)
    {
    Vector2 hit = gameObject.transform.position;
    Debug.Log("y" + hit.y);
    hit.y =- 3; // What y should i put here in order to make sure its the same as the tile the projectile is sitting on
        if (x.gameObject.tag != "Player")
        {
        Collider2D[] collidedwith = Physics2D.OverlapCircleAll(this.gameObject.transform.position, radius);
        tilemap.SetTile(tilemap.WorldToCell(hit), null);
    }

A screenshot for better explanation (I would like to get rid of the blue tile):

sentences:
Using a state pattern across multiple controllers / general architecture advice I'm trying to implement a state pattern - having skated by with enums forever - and have hit a bit of a wall when it comes to it's implementation in my game. It's a grid based strategy game with an MVC hierarchy.

The general flow is InputManager -> CursorManager -> GridManager. So if the player presses "Up", the InputManager will translate that to the appropriate action and notify the CursorManager. The CursorManager will then update the cursor's world position and then then prompt the GridManager to find what's in the hex in order to update the UI with terrain/unit info.

My new addition is thus having the GridManager change the cursor's state depending on what's in the tile. You pressed up? Let's let the cursor state dictate what happens to the grid. So naturally I created a cursor state object in the CursorManager, but suddenly realized each state needed decent amount of shared information across different the two controllers.

For instance,

public class FreeCursor : CursorState
{
    public override void ActionPressed()
    {
        currState = gridManager.selectTile(cursor.position);
    }
}

So this means the FreeCursor state would need reference to the GridManager object, reference to the cursor GameObject, and also a reference to the current state itself. All 3 of those are already in the CursorManager, so it's no problem, just throw them all in a constructor: FreeCursor(CursorState context, GridManager gridManager, GameObject goCursor)

But d'oh, when gridManager.tileSelected() completes, it should return the new state. So the GridManager should be saying

public CursorState selectTile(Vector3 position) {
     //...
     return new FreeCursor(this);
}

...Except now we're missing the GameObject and the current cursor state, which aren't accessible in the GridManager.

So I could go one or two ways - make the GridManager also contain a reference to the context, so it becomes return new SelectedUnitState(this, CursorManager) and changes our flow to be InputManager -> CursorManager <--> GridManager. Or I could say screw it, throw the cursor state and GameObject into the GridManager and call it day.

...But both feel just wrong? The latter through combining two somewhat distinct controllers - the former by making the state be passed it's own containing object like a poor man's reflection or something. Because if I do that, I might as well just use Unity's GameObject.Find(Cursor). Am I wrong to think this? And if so, is the problem with my implementation of the state pattern or the way I've laid out my 'architecture'?

tl;dr: How do you handle a state pattern with data from multiple controllers?

Thanks!

sentences:
How do I make the screen shake when the player takes damage? I am making a 2D game and I'd like a visual cue when the player gets hurt. Currently, I have a simple blinking red dot that shows up for 2 seconds after damage, but it's not very immersive.

Many games shake the screen to indicate damage. How could I implement such an effect?

sentences:
Why large builder classes rather than separate clases in component-based entity systems? I was reading about component-based entity systems and I was wondering why there is usually a large EntityBuilder class with methods like CreatePlayer(), CreateEnemySpaceship(), and CreatePowerup(), all creating an entity, attaching some components, and returning the entity.

The class has the potential to get quite large given enough different entities and having to search this large code-file can eventually become quite cumbersome. Also, with this system, since all entities are of type Entity, to determine what something actually is, you would have to add some sort of TypeComponent to the entity which may contain a string like "Player", "Enemy", and "Powerup". Now you lose some benefits of strong typing and have to rely on personal memory more (bad in my opinion).

Another problem with this setup is the inability to use function overloads based on what type the entity is. Instead one would have to use hashtables based on some identifying component which is a bit ugly.

I was wondering, instead of having these large builder classes and cumbersome ways of determining what an entity really is, why not just have separate classes for each entity? Well, that is what we were doing but they resulted in large and complex hierarchies, right? Well, I'm not advocating large hierarchies. Rather, move every method from this monolithic builder class to a separate class deriving from Entity and place that code in the constructor. No multiple-inheritance. No large trees. Example: Both Ship, Spaceship, and EnemySpaceship would all derive from Entity and only Entity.

This could be useful for determining the types of entities when a collision occurs and how to proceed with handling the event. The classes themselves would basically be empty except for the constructor logic in how to construct the entity (attaching components and whatnot). This solution seems to be a lot more extendable as well, considering if one would ever need to modify the creation process of an EnemyEliteFighterSpaceship, rather than searching through some large builder class, just go to that class file.

Am I missing something here? I suppose, if all else, my real question would be of an elegant way to determine what an entity is when it collides with another entity so some action could be taken (increase score, play sound, etc.). I initially tried setting up some sort of TypeComponent but it just seems a bit hackish as opposed to simply deriving from the base Entity class. Also, deriving from a base entity class gives strong-typing and type-safety support, gets rid of the public static builder class, and allows for polymorphic behavior and ease of determining an entity's type.

So I'm wondering, with all these positives and no perceivable negatives (other than .. more files? organization trumps file count in my opinion), why do most component systems favor these large builder/factory classes rather than my proposed approach?

sentences:
How can I find multiple starting areas on a procedural map? I'm using perlin noise to generate a 2d map, with ground types and natural resources.

When you start a new game I need to place your town hall as well as your opponents in such a way they are on grassland and near natural resources.

For an oversimplification, I have a 2d array of integers where a block of 0s and a couple 1s would be great for starting but anything lower than a 0 would be bad. How can I isolate a few blocks of what I'm looking for, ideally with a distance threshold so town halls aren't next to each other.

How does civilization do this for example?

sentences: How to use blender files in your own engine? It is not trivial to use your own shader on blender, so I've created a good-looking webgl shader. Now, what do I need to use the things I made in blender on it? An obvious first idea would be to parse the blender format. For that, I need to know it's specification: what does it include? Meshes? Bones? Animations? Vertex colors? What else? But I guess there could be easier paths, though. Maybe an exporter from Blender to an easy-to-understand JSON format exists? So that is my question, what is the fastest path to use blender files with my webgl renderer?

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:
Android Game Slows Down I had been developing a Maze Game which is dragging a bitmap down on the maze going on the finish line. on first my game response quickly on my onTouch and dragging and after couples of
adding toast message, generate random mazes, changing character from drawCircle into a bitmap and a background from a solid color into a customize PNG file my game seems to Slows Down.

Can anyone explain why could this happen?

And what should I do to make my game to response more quickly?

Tnx for the help and godbless.

UPDATE: I found out that it all started when i change my solid color background to a bitmap background.

here's my code:

From this:

protected void onDraw(Canvas canvas)
canvas.drawRect(0, 0, width, height, background);

To this:

protected void onDraw(Canvas canvas) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.menu_bg);
//Set Rectangle Size and Coordinates
RectF rect = new RectF(0,0,width,height);
//Maze with Background
canvas.drawBitmap(bitmap, null, rect, null);

sentences:
How do I download audio resources and save them in cache? I am developing a game in Unity3d 2019, the instructions of the game must be translated into several languages. Right now, they are part of the compilation, but this makes the compilation very large.

I would like, according to the selected language, to be able to download the corresponding audio and save it in the cache.

sentences:
Transparent texture over colored polygon? Let's say I have a cube with each face having a different colour. I want them all to look like brick walls, but I don't want to have to recreate the same brick texture for every colour.

Is it possible to create a greyscale semi-transparent brick texture that I can overlay overtop of the polygon colour?

This scene will eventually be used in Unity, but I also have access to 3DS Max and Blender. So, whatever works.

sentences:
Plugin system with AssemblyLoadContext and unloading I'm building a game engine from scratch and trying to implement a basic plugin system within my engine.
Using AssemblyLoadContext to load the target dll dynamicly and unloading it with AssemblyLoadContext.Unload()
However it seems even if there is a one class instance created from this assembly hanging somewhere in the whole app domain AssemblyLoadContext.Unload() does not unload it until the all the instances are dereferenced.
This is where my problem begins.
There are infinite number of scenarios whether a class which belongs to the plugin can be instantiated and used across the whole appdomain right?.
So how do i keep track of the plugin instances across the whole AppDomain.
(How unity unloads the user scripts and cleans every last one of the instances i wonder)
My engine system is nearly identical to both unreal and unity.
I have entities and the components just like unity.
My current unload workflow is like this.

Loop through every component via reflection and check if one the assembly classes instantiated then set that field/property null
Loop through every assembly and check for static fields/properties which might contain some instance
Now unload it.

However the approach above seems well idiotic and sluggish not to mention it should be slow as hell.
It seems i have a desing problem within my plugin system and i fear if i overcomplicated things.
Are there better way to cleanup assembly instances or am i missing something? (Please tell me im missing something obvious)

sentences:
Handling touch input with Event Trigger I wrote a simple script to control my 'Player' object:

using UnityEngine;
 using System.Collections;

 public class PlayerMovement : MonoBehaviour {

     public float jumpVelocity = 10;

     private Transform groundCheck;
     private Animator anim;
     private Rigidbody2D rigidbody2D;
     private bool grounded;
     private Physics2D gravity;

     [SerializeField] private LayerMask whatIsGround;

     const float groundedRadius = .2f;

     void Awake () {

         // Setting up references.
         groundCheck = transform.Find("GroundCheck");
         anim = GetComponent<Animator>();
         rigidbody2D = GetComponent<Rigidbody2D>();

     }

     // Use it for Graphic & Input
     void Update () {

     }

     //Physics and ground check
     void FixedUpdate () {

         grounded = false;

         Collider2D[] colliders = Physics2D.OverlapCircleAll(groundCheck.position, groundedRadius, whatIsGround);
         for (int i = 0; i < colliders.Length; i++)
         {
             if (colliders[i].gameObject != gameObject)
                 grounded = true;
         }

     }

     //Jump function
     public void Jump () {

         if (grounded)
             rigidbody2D.velocity = jumpVelocity * Vector2.up;
     }

     //Gliding function
     public void GlideON () {

         rigidbody2D.gravityScale = 1;
         Debug.Log ("Graviti is on");
     }

     public void GlideOFF () {

         rigidbody2D.gravityScale = 0;
         Debug.Log ("Graviti is off");

         if (!grounded) {
             rigidbody2D.velocity = ( -jumpVelocity / 10 ) * Vector2.up;
         }
     }

 }

To operate touch screen I used GUI function like this:

What I want to achieve:

One click - Player jump
Hold button - Player starts glide.
Player can not glide when he's grounded.
It does not matter whether I start from 'PointerClick' or 'PointerDown'. If player is grounded the first action should be 'Jump' always.
If we start with 'PointerDown', Player should jump and after reaching the maximum height he starts glide.
If we start with 'PointerClick' Player should jump.
If Player is not grounded and we want to start glide - we have to touch screen and hold it.

Where is the problem:

When I start with 'PointerDown', my Player begins infinite jump until 'PointerUp'.

I would be grateful for your help and suggestions.

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 I mod a game to render only certain pixels during pixel shader stage? I am a gamer and hobbyist programmer in game dev and deep learning algorithms.

I want to train a deep learning algorithm like DLSS from NVIDIA, which can render a complete frame by taking certain pixels of the frame. The logic is that since all the pixels are not rendered, it gives higher frame rate.

But first, I want to know how I can mod an already created game to force it to render only certain pixels.

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:
How can I determine which tiles in a tilemap an oriented bounding box (OBB) overlaps? I need to detect collisions between an oriented bounding box and a static tile map. My tile map class looks something like this:

function Tilemap(width, height, tiles) {
    this.width = width;        // Width of the map in tiles
    this.height = height;      // Height of the map in tiles
    this.tiles = tiles;        // 1D array containing tiles, grouped by row
}

Tilemap.prototype.getTile = function (x, y) {
    return this.tiles[y * this.width + x];
};

Tilemap.prototype.setTile = function (x, y, value) {
    this.tiles[y * this.width + x] = value;
};

My question is this: How can I determine which tiles an OBB, represented as an array of vertices, overlaps?

(I am writing in JavaScript but answers for any language would be appreciated.)

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:
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:
Do the predefined HLSL semantics carry any meaning? I'd say there are 3 kinds of HLSL semantics:

SV_* group - these are "system value" semantics which DO carry special meanings (e.g. assign special input/output data to/from shader stages)
predefined semantics - e.g. NORMAL, POSITION and so on... They are mentioned in the docs but I failed to find any special meaning assigned to them
semantics defined be the user - which can be anything (e.g. MY_AWESOME_TEXTURE_SEMANTIC) which apparently have no special meaning either

In addition, the docs say that more than one input/output value can have the same semantic assigned (e.g. 'NORMAL2 and NORMAL2). I guess that it doesn't include the SV_* group, though.

So besides the first group - do semantics carry any meaning at all? Do they even serve any purpose at all? :P

sentences:
Effect culling on uneven terrain I'm trying to integrate a "ground particle" effect (like a fire-circle or similar) in Unity3d, however since i'm using uneven terrain as my terrain mesh, the effect gets culled behind terrain parts that above it.

To better ilustrate it I created an image as attachment :
I want for the effect to always be displayed regardless of it's "depth".
How can this undesired effect be avoided/resolved properly ?

sentences:
How do games handle rendering Asian unicode text? I'm currently in the process of implementing text rendering in my game engine, and I decided to utilize AngelCode's BMfont to generate font textures, and then have OpenGL render textured quads for each character.  This worked great, even when rendering every single glyph supported by FreeFont (FreeMono in particular), until I tried to render Japanese (My Japanese font of choice is Noto, provided by Google).

Rendering every single glyph supported by FreeMono at 16px resulted in a single 1024x1024 8bit texture, perfectly reasonable considering how many languages are covered by it.  Rendering everything supported by Noto Japanese, at the same size, resulted in 13 times as many textures, and at this size most of the glyphs are too cramped to be readable (I can't read Japanese, but if I could I think I would still have a lot of trouble reading this text).

My question is twofold:

1) How do games, or mobile apps, handle small Japanese text?  Do they stick to a subset of the kanji, use a special font, or is there a minimum font size?

2) How do games typically handle the absurdly massive number of glyphs required by Japanese, Chinese, Korean, and other languages?  Do they use FreeType (or something similar) to render the text on-the-fly?

Note:  I tried Meiryo (which I do not have the license to use in my game) and the result was far more readable at 16px (still cramped though), but still required 14 textures to fit everything.

sentences:
What single word could be used to describe city adventures? I am developing an urban racing simulator in a very "underground" stylized setting. It's name is The Underground King and you have the ability to either:

A) Race in a 2d side view.
B) Do something in the city.

Doing either of A or B will pass the day since it's assumed it takes all day to perform that action.
My issue is that while racing levels are caled Racing, the city action/adventure is called Event which is both too generic, and conflicts with my game engine's internal event systems.

I have tried to find a relevant replacement that is descriptive enough on what it is, whithout relying to medieval fantasy type tropes such as "Adventure" or cyberpunk's very own "Run".

What I could think of / narrow down are: Buisness or Biz, Happening, Venture, Risk, Encounter.
Here are some examples of the kind of things you can find:

You accidentally bump into a drunk thug who wants to start a fight.
A dog has something shiny and valuble looking in its bouth and wants to run away to bury it.
A suspicious-looking woman dropped a package in a trash can.
You get a tip about an abandoned but heavily locked garrage.
A rich businessman wants to put a bet on your next race but wants a guarantee.
While driving with your crew, you smell something burning (with random consequences):

Somebody is playing with matches.
The engine is burning.
Somebody tried to sabotage your car for the next race but it shortcircuited.
A rusted part finally started spinning again. The car has higher stats now.

I am looking for a single word term that can apply to any sort of event as written above which is generic enough to encompass anything you can potentially gain from, but specific enough to represent its something you can pursue or happen to you while you are present in the city.

Thanks!

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:
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:
How can I create a patch of ocean that blends seamlessly into the horizon? The tagline pretty much says it, but here's a picture to show the problem:

The darker gradient of blue on the horizon comes from the Godot WorldEnvironment, while the lighter shade results from a half-transparent plane that will later be animated with waves.
How can I make the ocean plane blend into the horizon?

sentences:
NAT punchthrough failed I finished my game while I was unaware of this error since it only shows up when I disable "WIFI" on my phone and testing it with 3G and 4G. Otherwise, when both devices are on my personal network (and I believe the same network in general) the game works perfectly fine.

Whenever two players connect via my own MasterServer I have setup on Amazon AWS services I get this error Receiving NAT punchthrough attempt from target "XXXXXXXXXXXXX" failed in the Unity console for both players. I am running both the Unity MasterServer and Facilitator on the server.

There are many question around the internet like this but not a single one with a answer. If this is really not easily fixable Unity should at least mention it's flaws where it provides the MasterServer. I would love to have an answer or at least some insight since now I have my own Linux server on Amazon I'd like to use it too. Currently it looks like my best alternative is using the multi-player options from Google Play Services.

This is the log I get from the server. Looks perfectly fine but it might help answering.

03-02-2015 02:28:31     INFO    New connection established to 24.XXX.XXX.X:62501
03-02-2015 02:28:31     INFO    Query request from 24.XXX.XXX.X:62501
03-02-2015 02:28:31     DEBUG   Version 2.0.0 connected
03-02-2015 02:28:31     INFO    Table Buckrider_Studio_FourInARow3D not found during query or row removal from 24.XXX.XXX.X:62501
03-02-2015 02:28:41     INFO    Connection with 24.XXX.XXX.X:62501 closed
03-02-2015 02:28:41     INFO    Removing rows for IP 24.XXX.XXX.X:62501
03-02-2015 02:28:41     INFO    24.132.7.159:62501 has diconnected
03-02-2015 02:28:41     INFO    New connection established to 24.XXX.XXX.X:61335 (166633197962428130)
03-02-2015 02:28:41     INFO    New connection established to 24.XXX.XXX.X:61336
03-02-2015 02:28:41     INFO    Update row request from 24.XXX.XXX.X:61336
03-02-2015 02:28:41     DEBUG   Version 2.0.0 connected
03-02-2015 02:28:41     DEBUG   Table Buckrider_Studio_FourInARow3D created.
03-02-2015 02:28:41     INFO    Sent row ID 0 in Buckrider_Studio_FourInARow3D to host at 24.XXX.XXX.X:61336
03-02-2015 02:28:41     DEBUG   Updating, inserting 4 at column 4
03-02-2015 02:28:41     DEBUG   Updating, inserting public at column 5
03-02-2015 02:28:41     DEBUG   Updating, inserting 6 at column 6
03-02-2015 02:28:41     DEBUG   Updating, inserting 7 at column 7
03-02-2015 02:28:41     DEBUG   Updating, inserting 8 at column 8
03-02-2015 02:28:41     DEBUG   Updating, injecting 24.XXX.XXX.X at column 9
03-02-2015 02:28:41     DEBUG   Updating, injecting 61336 at column 10
03-02-2015 02:28:41     DEBUG   Updating, inserting Welcome to Connect four 3D! at column 11
03-02-2015 02:28:41     DEBUG   Updating, inserting 166633197962428130 at column 12
03-02-2015 02:28:41     DEBUG   Internal port is 23466 IPs set as 192.XXX.XXX.X
03-02-2015 02:28:50     INFO    New connection established to 188.XXX.XXX.X:46374
03-02-2015 02:28:50     INFO    Query request from 188.XXX.XXX.X:46374
03-02-2015 02:28:50     DEBUG   Version 2.0.0 connected
03-02-2015 02:28:50     INFO    Fetching existing table Buckrider_Studio_FourInARow3D
03-02-2015 02:28:51     INFO    Connection with 188.XXX.XXX.X closed
03-02-2015 02:28:51     INFO    Removing rows for IP 188.XXX.XXX.X:46374
03-02-2015 02:28:51     INFO    188.XXX.XXX.X:46374 has diconnected
03-02-2015 02:28:51     INFO    New connection established to 188.XXX.XXX.X:46375 (300946669)

sentences:
Understanding DeviceContext and Shaders in Direct3D/SlimDX I've been working through this tutorial about drawing triangles with SlimDX, and while it works, I've been trying to structure my program differently than in the tutorial.

The tutorial just has everything in the main method, I'm trying to separate components into their own classes. But I'm not sure where certain components belong: namely, contexts and shaders.

The tutorial (as it's just rendering one triangle) has one device, one swapchain, one device context and one set of shaders. intuition says that there is only one device/swapchain for one game, but with contexts I don't know.

I made a Triangle class and put the vertex stuff in there. Should it also create a context? Should it load its own shaders? Or should I pass some global context and shaders to the triangle class when it is constructed? Or pass the shaders and construct a new context?

I'm just getting started with 3D programming, so in addition to answering this question, if anyone knows of a tutorial or article or something about the larger-scale structure of a game, I'd be interested in seeing that as well.

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:
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:
What is the best method to share the projection matrix and view matrix with all graphic entity shaders in a custom game engine? What is the best method to share the projection matrix and view matrix with all graphic entity shaders in a custom game engine? The refer graphic entities have glUseProgram({shader_program_id}); glDrawArrays(GL_XXXX, x);

One of my ideas is to have a camera object that manages the current view and projection matrix. Then, I pass a reference of that camera object to all the entities. However, my issue with that approach is syncing the current camera across all the entities/objects when switching views.

I could make the Camera global, however, that could have many issues.

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:
Sticking the Rigidbody2D player to a moving platform without parenting & transform fiddling I have a player entity with Rigidbody2D component and I have a moving platform which is a kinematic Rigidbody2D. Player movement is done by setting it's velocity (body.velocity = newVelocity) and platform is moved via body.MovePosition.
I've made it so that the platform has a sensor which, when triggered, catches the Rigidbody2D of the entity that is on (currently only does that for player) and then I tried the following:

Moving the player along the platform with caughtRigidbody.MovePosition. This keeps the player on the platform but the player is unable to move. It seems that MovePosition overrides any velocity change on the player and keeps him on the platform indefinitely. This would be ideal if I could have this behavior but keeping player movement.

Moving the caught rigidbody by adding platform velocity to the body but it seems jittery and also happens to behave strangely when platform direction changes.

I got the player movement how I want it so I'm not willing to tear out the whole movement code and change the player to kinematic or something like that.
This is the relevant platform code:
public class MovingPlatform
{
    private void FixedUpdate()
    {
        // Only one node (initial position). Nowhere to move to
        if (worldNodes.Length == 1)
        {
            return;
        }

        // Target position reached?
        if (body.position == worldNodes[index])
        {
            // Is last (or first in backwards direction) target?
            if (direction == Direction.Forwards && index == worldNodes.Length - 1 ||
                direction == Direction.Backwards && index == 0)
            {
                // Change direction (forwards = 1, backwards = -1)
                direction = (Direction) ((int) direction * -1);
            }

            // set next target index
            index += (int) direction;
        }

        // Get target
        Vector2 target = worldNodes[index];
        // Get current platform position
        Vector2 position = body.position;
        // Calculate single-frame movement towards target
        Vector2 movementThisFrame = Vector2.MoveTowards(position, target, settings.Speed * Time.deltaTime);
        // Move platform by calculated movement
        body.MovePosition(movementThisFrame);
        // Calculate platform movement velocity (displacement / time delta)
        velocity = (movementThisFrame - position) / Time.deltaTime;
        MoveCaughtRigidbodies();
    }

    private void MoveCaughtRigidbodies()
    {
        foreach (Rigidbody2D caughtRigidbody in caughtRigidbodies)
        {
            // This keeps the player on the platform without jittering, but the player cant move
            //caughtRigidbody.MovePosition(caughtRigidbody.position + body.position - lastPosition);

            // This is spotty. It launches the player off the platform sometime when the platform changes direction
            // if (caughtRigidbody.velocity != velocity)
            // {
            //     caughtRigidbody.velocity += velocity;
            // }
        }

        lastPosition = body.position;
    }
}

sentences:
Why is the player not resting in the center of the camera? Is it possible to create a combination of the following two cameras described in Andrew Russell's answer? XNA Platformer Sample: Supporting multiple resolutions?

I want to implement a scrolling camera that is focused on the player. In addition, I want to scale the viewport, so that the game looks on every resolution the same.

I already tried to combine the two cameras, but the player is not resting in the center of the screen. Currently scaling the viewport to any resolution higher than 800×480 de-centers the character. The character moves out of the viewport after a while.

My code:

Vector2 vp, gameWorldSize = new Vector2(800, 480);
Matrix camera;
float ScaleX, ScaleY, Scale;
float TranslateX, TranslateY;

ScaleX = vp.X / gameWorldSize.X;
ScaleY = vp.Y / gameWorldSize.Y;
Scale = Math.Min(ScaleX, ScaleY);

TranslateX = (vp.X - (gameWorldSize.X * Scale)) / 2f - player.Playerposition.X + gameWorldSize.X / 2;
TranslateY = (vp.Y - (gameWorldSize.Y * Scale)) / 2f - player.Playerposition.Y + gameWorldSize.Y / 2;

camera = Matrix.CreateScale(Scale, Scale, 1) * Matrix.CreateTranslation(TranslateX, TranslateY, 0);

What is wrong? Is it not possible to combine the two cameras?

sentences: What do I need to consider before making any class singleton? I am sure most of my classes like for rendering text, sprite, shapes are not going to need more than one instance. Is it adequate to consider only this fact that its only going to need one instance? Should i also consider other things?

sentences:
Detecting on which side did the objects collided unity 2d I have a ball and a rectangle in my game.

The rectangle has a box collider 2d attached to it. How can I calculate or check when the ball hits the top of my collider, when it hits the bottom, left and right, so basically any side of the collider and also a corner of the collider, I have searched over the internet and not one answer that I found helped me into solving my problem. If anyone can help I would appreciate it.

sentences:
Method to fake 3d in 2d top down game I'm relatively new to game development and its terminology and I was wondering how to achieve the effect that is being used on the main character in this game:

http://youtu.be/XK7whzmywno?t=2m38s

To me, it looks like they animated at least 32 directions.
How do they do this? Is it simply creating 2-3 frames for each direction and animation or is there somekind of skewing/distortion technique involved?

sentences:
How do I get basic collision, in Unity, for an imported sketchup model? How do I get basic collision, in Unity, for an imported sketchup model?

My friend and me are new to game development, and we have to submit the game within a week. Please help me.

I downloaded an airport model from 3D Warehouse, and we imported it in to Unity 5.1.2, but our character is going through all the objects in the airport. Please find us find a solution.

sentences:
Why does Ads (Rewarded Video or Intersititals) in games skips when you press home and tap on games icon in Android? I have stumbled upon an issue wherein Android when I play rewarded video or any interstitial and do following steps:

In the middle of a video Ad I press the home button
Resume back from background tray the ad plays where I left off.

BUT if,

In the middle of a video Ad I press the home button
Tap on the game icon to resume back then it skips the ad and game continues without getting any reward.

I thought this might be anything specific to my code but then I tried playing many other games including Mr. Bullet, Hospital Inc, Idle LumberJack, Super Salon and the list goes on and all had the same issue.
Is this some android thing? As for iOS, this doesn't happen.
I would like to have some information on why this happens and can we prevent it from happening.
I am using Unity 3D for my game development and AppLovin MAX for ads.

sentences:
Slots Machine Matching feature I'm designing a slot machine.

I need to find the number of combinations that two matching icons will appear side-by-side in a 3X5 window (3 rows, 5 reels (columns))

A match gives the user some payout.

Having the following assumptions: Icons: H1, H2, X (all the rest). Matching Icons: should meet on the same row (side by side) (wild doesn't count here)

Window is as follows:

|   |   |   |   |   |
---------------------
|   |   |   |   |   |
---------------------
|   |   |   |   |   |

I have listed all possible options, and now I would like to get the exact number of combinations per each option.

Example of what I need:

The number of possibilities for this kind of scenario (1 of 72 possible ones):

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | X | X |

Number of H1 icons on reels 1-5: R1_H1, R2_H1, R3_H1, R4_H1, R5_H1

Number of H2 icons on reels 1-5: R1_H2, R2_H2, R3_H2, R4_H2, R5_H2

Number of all icons on reels 1-5: RL1, RL2, RL3, RL4, RL5 (respectively)

Some more examples:

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | H1| H2|

| H1| H2| H2| H1| X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | X | X |

And so on.. the only limitation I put is that H1 and H2 icons on the same reel have distance between them so I won't have kind of the following scenario:

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | H1| H2| X | X |

sentences:
What algorithms are used for force dispersal between rigid objects attached by joints? I have in mind a 2d, side-scrolling game which requires the construction of vehicles and/or structures built of conjoined rigid structures, like beams or platforms.  These structures will be impacted from various angles.

What algorithms and data structures are used typically in, say, bridge-building games, to determine the force dispersal between such attached, rigid objects, and at what point the joints bend or break?

sentences:
How to get UV coordinates for sphere (Cylindrical Projection) I have created one sphere and I want to map onto it a texture map. But I want first to project my map texture to cylinder and then to sphere.

So I want to create a function which takes as parameter a 3D point from sphere and calculate a uv coordinate of this point using cylindrical coordinates. My guess is that I have to transform the spherical coordinates to cylindrical but I am not sure.

Is this possible and how can I implement it ?

sentences:
Pygame 2D Vector Math Mouse Input The following code is supposed to move a player sprite (in this case it's an 8x8 red square) to the coordinates of where the mouse is clicked. I'm able to move the square in the general direction of the click but the sprites path does not always pass precisely through the point. I'd love someone to analyse the code and show me where I'm going wrong with this.

from __future__ import division
import math
import pygame

SCREEN = pygame.display.set_mode([700, 700])
SCREEN_HEIGHT = pygame.display.Info().current_h
SCREEN_WIDTH = pygame.display.Info().current_w
pygame.display.set_caption('Window Caption')
clock = pygame.time.Clock()

class Player(pygame.sprite.Sprite):
    def __init__(self, color=(255,0,0), dims=[8,8], (originx, originy)=(100,100)):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.Surface(dims)
        self.image.fill(color)
        self.rect = self.image.get_rect()
        self.rect.centerx = originx
        self.rect.centery = originy
        self.speed = 10
        self.vx = 0
        self.vy = 0

    def normalize(self, (p1x, p1y), (p2x, p2y)):
        dx = p2x - p1x
        dy = p2y - p1y
        vlength = math.hypot(dx, dy)
        vnorm = (dx / vlength, dy / vlength)
        self.vx = vnorm[0]
        self.vy = vnorm[1]

    def update(self):
        self.rect.centerx += (self.vx * self.speed)
        self.rect.centery += (self.vy * self.speed)
        print self.rect.centerx, self.rect.centery, self.vx, self.vy # verify calculations

pygame.init()

sprites = pygame.sprite.Group()
player = Player()
sprites.add(player)

looping = True
while looping:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            print "Exiting..."
            looping = False
        if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    print "Exiting..."
                    looping = False
        if event.type == pygame.MOUSEBUTTONDOWN:
            (left_click, middle_click, right_click) = pygame.mouse.get_pressed()
            mouse_pos = pygame.mouse.get_pos()
            if left_click:
                print "left click", (player.rect.centerx, player.rect.centery), mouse_pos
                player.normalize((player.rect.centerx, player.rect.centery), mouse_pos)
            if middle_click:
                print "middle click", mouse_pos
            if right_click:
                print "right click", mouse_pos

    SCREEN.fill((0,0,0))
    sprites.update()
    sprites.draw(SCREEN)

    # Redraw everything we've asked pygame to draw
    pygame.display.flip()

    # Set frames per second to 60
    clock.tick(60)

# Quit gracefully if we exit the main loop
pygame.quit()

sentences:
How to make smooth 2-d zooming in Processing I am making a 2d game with camera zooming using Processing. Currently, my program reduces the size of each block by one. This works very well when there are only a few blocks on-screen, but not when there are hundreds. The camera zooms out on an exponential scale, and looks very jittery.

I know that some game engines have systems to overcome this, by distorting some of the blocks, but I am making this game from scratch. I want to know if there is a different trick or system that will achieve a smoother zooming.

sentences:
Restrict A* pathfinding to overlapping "safe zones" within map I've been bashing my head against this idea for a few days without luck, I'm hoping someone sees something I don't.
So I have a 2D map containing walls and obstacles, and I have a unit that navigates through it (A* and funnel algorithm). So far so good. Now, for gameplay purposes, I need to limit the movement of this unit to circular safe zones that I can place on the map. Think of them like cell towers, the unit has to stay within range of at least one tower, with the max range dictated by the tower (possibly different for each tower). Effectively, imagine drawing a set of interlocking circles over the map, and the unit must remain within that.
Now for the complicated part. The map is a constrained Delaunay triangulation, not a grid, so the triangles that A* is using can vary in size and shape. With a grid, I could imagine limiting individual grid cells by circle distances, but in my case these triangles could be larger than any one circle. There could even be cases where the start and end points of a path are within the same triangle, but because of the network of circles, an indirect path would have to be chosen to stay within the circles.
The only option I can think of involves adding these circles into the triangulation as additional edges, altering the map. This would mean rebuilding the map triangulation each time a player adds or removes these circles, and would require that I maintain a separate copy of that triangulation per player. And since these circles don't care about map walls, I'd have to alter my triangulation method to allow edge splitting and removal, to prevent overlapping lines from rendering the triangulation invalid.
I feel like there has to be another way to do this. I've considered:

Running A* purely on the circles first, then placing that intermediate path on the map and re-pathing it to avoid obstacles.
Finding all of the circle intersections between the start and end points, and treat those lines as portals that I must pass through, somehow altering the A* pathing to prioritize passing through them.
Performing a regular path search on the triangulation, but forcing a dead-end whenever entering a triangle that is too far from a circle. Then refining that path to conform to the circles themselves.

Each of these have issues, or scenarios where they fall apart.
Has this been done before? Any input on how this might possibly be achieved would be appreciated.
Edit: Adding an image to show what I'm trying to accomplish. The red lines show the path that A* would generate using just the map triangulation. The green lines show the desired path, taking the circle bounds into account.

sentences:
i need suggestion animation technique for 3d? firstly you need to now i am beginner :)

i am using opengl and for display vertex buffer object(vbo).

i made 2000 frames animation model with blender and i export with (.obj) files and i upload all these 2000 obj files to my opengl project.

But upload process is taking too much time. like 7-8min and this method use too much vram around 2-3gb.

Despite all this i'm glad draw performance because when i draw 100 animation(same model) at the same time my pc using %1-2 cpu and %70-80gpu.

Now i want to learn is there another method of good draw performance and low system consumption ? (i want to draw 100 and much more animation model at the same time)

sentences:
How to encapsulate game objects (entities) in Box2d I am currently learning Box2d, a 2D physics engine within libgdx. But Box2d seems to be in every game framework these days so I am not really talking about libgdx.

I understand Box2d comes with lots of new concepts such as shape, bodydef, body, fixture, sprite, joint. But I think I can slowly but surely manage to learn about them.

My question, however, is how to organize them into a game object for better maintenance of code. Naturally, I am thinking about following fields in the game object class.

GameArea gameArea
Body body
BodyDef bodyDef;
FixtureDef fixtureDef
Shape shape;
Sprite sprite;

As for its methods, it has constructor, update, and display. But I am talking without experience. For example, I don't know how I can organize joints - maybe in GameArea. Any thought from experienced would be appreciated.

sentences:
Where can I find tutorials for LWJGL? I don't know if this is against the FAQ so if you close this, it'll be no surprise.
I have done research but all the tutorials I have seen have been to hard to follow; I reckon there are better ones out there.
If you could tell me, that would be great but if you close it, I understand.
Thank you

sentences:
Writing a basic shader for large input files I started writing a shader for my iOS app and instead of starting from scratch i used this tutorial here:
http://www.raywenderlich.com/3664/opengl-es-2-0-for-iphone-tutorial

I wrote an import function, first to import wavefront .obj models. My problem is that with I can't handle larger inputs (with a simple cube it was working). I realized that the indices array is an array of GLubyte values, which is unsigned char, so as a result i cant have more than 256 indexes. I modified it to GLuint, but then only get a blank screen.

What else needs to me modified?

p.s.: the source can be downloaded from here: http://d1xzuxjlafny7l.cloudfront.net/downloads/HelloOpenGL.zip

sentences:
Shimmering, scrolling/panning a texture Shimmering

I understand shimmering in textures is caused by sub-pixel accuracy aliasing against the regular grid of pixels on the screen when drawn.  I have a good example of it here, whereby I'm attempting to scroll/pan a 2d texture by modifying the texture coordinates rather than by moving some actual geometry.  The texture is "wrapped" and my idea was to fill in the bit falling off the left (or right), filling it in on the other side, to effect a single scrolling/panning surface of (almost) infinite size.

Unfortunately with random noise on the texture, when I'm zoomed all the way out the shimmering is kind-of horrific.  When I zoom in a bit it seems OK, which is kind-of confusing to me.

But anyway, is there a filter of some kind I can put into my shader to prevent this shimmering?  I'm at something of a loss here.

(To complicate matters my texture is actually just L16 luminance and I'm palettising it in the shader - the L16 is sampled with LINEAR, the palette texture is POINT, though I'm pretty sure this makes little difference to the shimmering).

Please note that with the video, YouTube has done its absolute best to remove any detail from it, meaning it's difficult to see the shimmer under the encoding artifacts.

sentences:
Is there is IO text files in actionscript2 or 3? i tried actionscript recently,am little scared
i want to make a game that input a word from about 3000 randomly,
do actionscript support that,or
should i try another language?

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:
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:
Android Opengl: Alternate values for gl_FragColor I'm writing an Android application that utilizes opengl to perform some changes to the camera output.  I've written my code in such a way that I finally figured out what is causing the performance issue.

#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES sTexture;
uniform vec4 vColor;
const int MAX_COLORS = 6;
uniform float vHues[MAX_COLORS];
uniform float vOffsets[MAX_COLORS];
varying vec2 v_CamTexCoordinate;

float rgb2hue(vec4 c) {
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return abs(q.z + (q.w - q.y) / (6.0 * d + e));
}

bool isInRange(float a1,float a2, float vOffset) {
    if(a2 < 0.0) {
        return false;
    } else if(abs(a1-a2) < vOffset) {
        return true;
    } else if( a1 > a2) {
        return (1.0 - a1 + a2) < vOffset;
    } else {
        return (1.0 + a1 - a2) < vOffset;
    }
}

vec4 getGrey(vec4 c) {
    float grey = (c.r + c.g + c.b) / 3.0;
    return vec4(grey, grey, grey, c.a);
}

void main() {
    vec4 c = texture2D(sTexture, v_CamTexCoordinate);
    bool hasColor = vHues[0] >= 0.0;
    float hue = rgb2hue(c);
    vec4 test = getGrey(c);
    for(int i=0; i < MAX_COLORS; i++) {
       if(isInRange(hue, vHues[i], vOffsets[i])) {
          //If I uncomment this line the performance gets terrible
          //test = c;
       }
    }
    gl_FragColor = test;
}

There is a significant hit to performance (a lot of frames are skipped) when I uncomment the line above.  I basically want to use the original color sometimes and a different color depending on some condition.  It works but is there a more efficient way to do this?  Also, why does this perform so poorly?

sentences:
Mini Game Platform for PC - similar to Warcraft III Custom Games I think it would be fun to make a game for pc that has an online community like Warcraft III (the RTS, not the MMORPG), aka there's lobbies and chat rooms and users can host games to play with eachother. And there's no seriousness, just fun mini games that last on average 30-60 minutes, more or less depending on the game.

I searched google but it's really hard to find anything. Is there anything similar to this idea that's already out there? Or is this a first?

Also, in making this, any recommendations, flaming, or random comments? (yes I know it is hard to make an online game and such, especially since I have no experience with networking. I do have 2-3 years of programming experience, however).

Some more info on what I want to create.

I want it to be easy for users to create games and play with friends. All of us game creators have ideas, and we probably draw them out on paper (graph paper for me). Wouldn't it be amazing if it was a matter of a couple hours to transfer that idea to a fully working game, even if it is in 3d?

sentences:
Tools to generate convex collision geometry Does anyone know tools to generate convex collision geometry from given 3D model?

For example, UDK's Static Mesh Editor can do this; Valve instead recommends to use smoothing in 3D editor.

Desired features:

The tool could convert concave geometry into convex shape automatically and remove unnecessary model data.
Could allow us to specify number of vertices/triangles in generated collision shape.
Could export that shape to some interchange file format (like COLLADA or FDX).

Does that tool exist? (it even can be commercial, not free, but could be obtained separately, without particular engine/SDK/bundle...)

sentences:
Scene2D viewport affects all other cameras despite having a separate one I have two cameras initialized as such:

val mainCamera: OrthographicCamera by lazy { OrthographicCamera(WIDTH * ZOOM, HEIGHT * ZOOM) }
val guiCamera: OrthographicCamera by lazy { OrthographicCamera(WIDTH, HEIGHT) }

override fun initialize() {
    mainCamera.setToOrtho(false, WIDTH * ZOOM, HEIGHT * ZOOM)
    mainCamera.update()

    guiCamera.setToOrtho(false, WIDTH, HEIGHT)
    guiCamera.update()
}

Where WIDTH and HEIGHT values are 960f and 640f respectively and zoom is 0.5f for mainCamera.

mainCamera is used for showing everything game related (following the player mainly) and doesn't use Scene2D, while guiCamera is used for displaying the GUI and is exclusively used within a Scene2D stage and is set in stages constructor like this:

private val stage: Stage by lazy { Stage(StretchViewport(WIDTH, HEIGHT, cameraSystem.guiCamera), batch) }

However when I change the viewport of the stage to FitViewport it seems that everything is shrunk and letterboxed, even the mainCamera.

I expected that using FitViewport with a specific camera would only perform scaling on entities using that camera, not on the whole scene.

Is this how it should work or am I doing something wrong? Sprite and map rendering systems render to the mainCamera and all rendering systems use the same batch, however I've also tried instantiating the stage with it's own dedicated batch so it had both it's own camera and a batch and still everything was shrunk.

P.S: The language used is Kotlin so the syntax is a little different from Java however most of the concepts are the same and straightforward. I'd only like to explain the by lazy syntax to those not familiar with Kotlin. by lazy means that the property won't be initialized until it's accessed for the first time. It allows me to define a final/constant (val) property but delay it's initialization until libgdx context is properly initialized and until artemis-odb system dependencies are injected.

sentences:
Polygons and actionlisteners Libgdx I've been browsing these forums for a while now and I nearly always am able to find an answer without having to ask my own question! Such a great community!

This is the first time I've been stumped so I hope that someone can help me, I'm just learning libgdx so any help is appreciated I know the code is rough but please be gentle as I'm learning everyday!!! :)

I'm trying to create 6 shapes with inputlisteners which eventually will return the index of the shape which will correspond to an answer, but I can only seem to get the last input listener I create to actually fire...

    public Panel(final int count){
    this.count = count;

    img = new Texture("badlogic.jpg");

    handlerShapeVertices = new float[]{128,30,0,256,256,256};
    handlerShape = new Polygon(handlerShapeVertices);

    triangle = new PolygonRegion(new TextureRegion(img), handlerShapeVertices,new short[]{0, 1, 2});

    triangleSprite = new PolygonSprite(triangle);

    triangleSprite.setOrigin(img.getWidth()/2,30);
    triangleSprite.setX(x);
    triangleSprite.setY(y);
    triangleSprite.setRotation(count * 60);

    handlerShape.setOrigin(triangleSprite.getOriginX(), triangleSprite.getOriginY());
    handlerShape.setPosition(x, y);
    handlerShape.rotate(count * 60);

    setBounds(x,y, 256, 256);

    addListener(new InputListener(){
        public boolean touchDown (InputEvent event, float xP, float yP, int pointer, int button) {
            //float [] temp = handlerShape.getTransformedVertices();

            if(resourceManager.getInstance().interSector.isPointInPolygon(handlerShape.getVertices(),0,6,xP,yP)) {
                System.out.println("CLICK INSIDE : " + count);
            }
            return true;
        }
    });

}

I figured the polygon.getTransformedVertices() should work and to check they were correct I drew them in as you can see by the white lines surrounding the polygonsprites however it doesn't seem to and none of the listeners are actually fired when I use that... I'm completely stumped and hope someone has some insight or can point me in the right direction? I don't want someone to write my code for me but a pointer would be greatly appreciated!

sentences:
Cocos2dx - Create the friction of the ground I'm writing a game, it a pool game.
I've read about cocos2dx + physics library, however the document is really poor to understand.

Material has 3 attributes (http://www.cocos2d-x.org/wiki/Physics#) :
- Density (?)
- Friction (?)
- Restitution (scale from 0 to 1)

Execept the restitution has limitation value from 0 to 1. I don't know what's density and the limitation of friction value?

If i want to create a ball and when it collide to the bound/wall, it bounce back, and the ground has friction to slow down the ball during running, how can i do it?

sentences:
How to model the double jump in Super Mario using projectile motion So the single jump in Super mario games follows a curved trajectory of the formula s = s0 + v0t + ½ at2. The double jump in mario consists of two different parabolas combined. I know that the max height of the first jump is the beginning of the second jump and the gravity doubles by the end of the second jump making a faster landing than the first. Would it be a piece-wise function or how would it work?
*Could anyone guide me through/ explain what equation would that result in? Any help would be very much appreciated!
If anyone needs me to explain more, please let me know.
Here is a link to explain my question https://www.youtube.com/watch?time_continue=1096&v=hG9SzQxaCm8&feature=emb_title
@ 17:58
I would be very grateful for any help :) Even if it is only ideas, thanks

sentences:
Show world space UI object on top of the Mesh I want to show object name whenever mouse over happens on a certain object and here is my code snippet that trying to place World space UI image object on top of the object.

private void OnMouseEnter()
{
    if (!EventSystem.current.IsPointerOverGameObject())
    {
        Vector3 topPosition = MeshTopPoint.GetMeshTopPoint(this.gameObject);
        partNameImage.transform.position = topPosition;
    }
}

but the problem is it is not placing the object on center top of the object instead of it like this (placing UI on the corner):

And here is my mesh top position get function:

public class MeshTopPoint : MonoBehaviour
{

    // Update is called once per frame
    public static Vector3 GetMeshTopPoint(GameObject go)
    {
        Vector3 worldUp = go.transform.InverseTransformDirection(Vector3.up).normalized;
        Plane p = new Plane(worldUp, Vector3.zero);
        Vector3[] verts = go.transform.GetComponent<MeshFilter>().sharedMesh.vertices;
        Vector3 topVertex = Vector3.zero;
        float maxDist = float.NegativeInfinity;
        for (int i = 0; i < verts.Length; i++)
        {
            float dist = p.GetDistanceToPoint(verts[i]);
            if (dist > maxDist)
            {
                maxDist = dist;
                topVertex = verts[i];
            }
        }

        topVertex = go.transform.TransformPoint(topVertex);
        return topVertex;

    }
}

Here is my UI Image:

sentences:
How can I access the translation part of a skinned Model object's bone transformation? I have an animated Model, which I process with the SkinnedEffectProcessor.
How I can access translations of that model during animation?

It's always a BoneTransform I am working with, but I'd like to know which X, Y and Z values are currently changing.

So, during the update I added this line

Debug.WriteLine(_model.GetBoneTransform("RootNode").Translation.ToString());

but all it outputs is

{X:0 Y:0 Z:0}

when I trigger the jump-animation. I'm expecting the Y value to go up, since the model is jumping in that animation.

sentences:
How hard is it to edit an xml based database in a Unity3D game? I want to make an item database in xml for my game.

I was thinking about encrypting it, but I don't know how hard is it to edit the database.

I want my database to be moddable, but hard to screw up for average users.

(~I don't want kids to make the game unplayable, then unable to fix it)

Should I encrypt the database? Or will it just annoy the "modders", while the average players wouldn't find the database even when it isn't encrypted?

TL;DR How hard is it to get a raw xml file from a standalone build?

sentences: Smoothing found path on grid I implemented several approaches such as A* and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is extremly slow. I found nice video showing an RTS demo where paths are found on big grid but units dont move from each cell's center to center. How do I implement such behavior? Some examples would be great.

sentences: How do I render my DirectX C++ engine to a C# Panel? The title pretty much sums it up. I'd like to know how I can get the HWND of my C# Panel object to my DirectX engine so I can render to it. I know it involves making a C++/CLI wrapper, but I'm not quite sure what to do beyond that.

sentences:
Unity new UI - Dynamically change the functions called by GUI elements Looking to dynamically change the value in the button OnClick and slider On Value Changed

.

If I had to guess on how this was done, get a reference to the button/gui element. Next get the Button script component and access that list of function calls. However I'm not sure how to modify that list. Anyone have any ideas?

More Details that might help:

The function being called is apart of a custom script component
Using the 'dynamic' variable option for the sliders
Could be used to create dynamic buttons

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:
3dsMax to Mudbox - Import Warning: UV not a complete set I'm exporting my 3dsMax model to Mudbox. The import gives me a warning that the UV set is incomplete.

First, what does this mean?  That I haven't got all the UVs unwrapped?  Web searches have brought nothing.

Also if this is the problem, is there a way to check if all UVs are unwrapped?

I'll post my map if you need it.

sentences:
Exclusive mouse movement with WM_INPUT Microsoft seems to recommend using WM_INPUT for input. I want to only get relative mouse input and hide the mouse cursor all together for a short while (For gesture based input). However, using RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY while registering the input device only prevents the mouse clicks to other windows, but the mouse cursor is still visible and not constrained to my window. How can I hide it and make it reappear exactly where I left off when my input capture began after the short while?

I know this has been asked before in the context of FPS controls, but it always seemed to be in a different context, mostly with APIs that already implement a mouse grab like this.

It was also mentioned that you could hide the cursor and reset it to its window's center after every move. However, AFAIR, DirectInput let you grab the mouse cursor exclusively. So since that was deprecated in favor of WM_INPUT, is the "old way" without DX the way to go again, or is there something new that works well with WM_INPUT?

Thank you!

sentences:
Geometry Shader input vertices order MSDN specifies (link) that when using triangleadj type of input to the GS, it should provide me with 6 vertices in specific order: 1st vertex of the triangle processed, vertex of an adjacent triangle, 2nd vertex of the triangle processed, another vertex of an adjacent triangle and so on... So if I wanted to create a pass-through shader (i.e. output the same triangle I got on input and nothing else) I should return vertices 0, 2 and 4. Is that correct?

Well, apparently it isn't because I did just that and when I ran my app the vertices were flickering (like changing positions/disappearing/showing again or sth like that). But when I instead output vertices 0, 1 and 2 the app rendered the mesh correctly.

I could provide some code but it seems like the problem is in the input vertices order, not the code itself.

So what order do input vertices to the GS come in?

sentences:
How do I get a list of all available entities in a Source engine game? How do I get a list of all available entities in a Source engine game?

There is only one exported function in the server DLL - CreateInterface - so it's not an option. In GoldSrc games, the server DLL features all entities as exported functions.

sentences:
Appropriate level representation / data stucture for a 2D platfrom game? I'm about to program a copy of Mario in Java. I'm thinking on 2 representations/data structures for the levels but I'm not sure which one should I choose:

A 2D integer array.
A quadtree to divide the level in pieces.

What are its advantages and disadvantages?

sentences:
Does my 2D OpenGL renderer need optimized? I've started a game engine for learning purposes. I have successfully gotten an opengl renderer working and I can draw textures of varying sizes to the screen. The way I have done this is by creating a hard coded array of vertices that are just a box.

float Renderer2D::vertices[30] = {
        0.f,  1.f, 0.0f, 0.0f, 0.0f, // Top-left
        0.f, 0.f, 0.0f, 0.0f, 1.0f,  // Bottom-left
        1.f, 1.f, 0.0f, 1.0f, 0.0f, // Top-right
        1.f, 1.f, 0.0f, 1.0f, 0.0f, // Top-right
        0.f, 0.f, 0.0f, 0.0f, 1.0f,  // Bottom-left
        1.f, 0.f, 0.0f, 1.0f, 1.0f // Bottom-right
};

(The first three are xyz - The fourth and fifth floats are texture coords)

I send this to the GPU at the beginning of my program. For every sprite I draw, I create a transformation matrix like this:

void Renderer2D::draw(int x, int y, int w, int h)
{
    float posX = 2.0f * x / m_screenWidth - 1.0f;
    float posY = 1.0f - 2.0f * y / m_screenHeight - 2.0f*h/m_screenHeight;

    glm::mat4 translation, scale;
    translation = glm::translate(glm::mat4(1.0f), glm::vec3(posX, posY, 0));

    scale = glm::scale(glm::mat4(1.0f), glm::vec3(2.0f * w /   m_screenWidth,2.0f*h/m_screenHeight, 1.f));
    transformation = translation * scale;
    glUniformMatrix4fv(m_shaderProgram.getMVPLocation(), 1, GL_FALSE, &transformation[0][0]);
    glUniform1i(m_shaderProgram.getSamplerLocation(), 0);

    m_shaderProgram.enableVertexAttribArray();

    glActiveTexture(GL_TEXTURE0);
    glDrawArrays(GL_TRIANGLES, 0, 6);

    m_shaderProgram.disableVertexAttribArray();
}

I started looking up other questions on here about sprite batches, so I could optimize my draw calls. But in all of these questions it was suggested that a vertex array should be built up, with vertex's for every sprite.

In my code, I send vertices to the gpu once, and call glDrawArrays for every sprite. If I built the vertex array every frame, I'd send the vertices every frame (not every sprite) and call glDrawArrays once per frame. I would still have to calculate the matrices for every sprite.

Is glDrawArrays much more computationally expensive than sending a vertex buffer? Does this definitely need fixing?

If I build a vertex buffer dynamically, how could I allocate the space if I don't know how many sprites are going to be drawn? Do you just put a hard limit on it?

sentences:
How can I create a 3D model in Java without using modeling software? I am a lightly experienced game developer and this is my first time trying 3D objects in Java for the first time. I have been recently creating and updating games using AWT, Swing, and Graphics, but I want to delve farther into Java.

I have looked into Java3D, but it's not what I want. I want to use Images and then crop the Image and place the respective textures in their respective places. I already know how to do the cropping and 2D Image editing, but how do I go 3D?

sentences:
Anybody know how I can write a game for the dualshock 3 or other gampad in python? I am a new developer and want to write a game that uses a gamepad like the dualshock 3 I want to write it in python although am willing to learn a little C/C++

I need to identify the buttons and rotaters and send feedback like haptics not to mention the motion control

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:
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 get more than 2 lines of log height Unity does only display 2 lines in height for each log, at least with the default settings. I couldn't find a menu, where I could change this.

I want to display a matrix, and I need to see the log live, so it's no option for me to click on each log separately. Has unity no option to increase the height of a log line? And additionally is there no option to hide the "source" of the log like the line "UnityEngine.Debug:Log(Object)" I mean I can hide it if I click "collapse" but I don't want to collapse the entries, since it stacks the same entries which is not what I want....

Edit: I just saw, that there exist some plugins, which would do the job I guess. But I wonder if there is a way to solve this with the Unity console, since I don't want to pack my project full of utility stuff for developing...

sentences:
Executing Components in an Entity Component System Ok so I am just starting to grasp the whole ECS paradigm right now and I need clarification on a few things. For the record, I am trying to develop a game using C++ and OpenGL and I'm relatively new to game programming. First of all, lets say I have an Entity class which may have several components such as a MeshRenderer,Collider etc. From what I have read, I understand that each "system" carries out a specific task such as calculating physics and rendering and may use more that one component if needed. So for example, I would have a MeshRendererSystem act on all entities with a MeshRenderer component. Looking at Unity, I see that each Gameobject has, by default, got components such as a renderer, camera, collider and rigidbody etc. From what I understand, an entity should start out as an empty "container" and should be filled with components to create a certain type of game object. So what I dont understand is how the "system" works in an entity component system.

http://docs.unity3d.com/ScriptReference/GameObject.html

So I have a GameObject(The Entity) class like

class GameObject
{
public:
    GameObject(std::string objectName);
    ~GameObject(void);
    Component AddComponent(std::string name);
    Component AddComponent(Component componentType);
};

So if I had a GameObject to model a warship and I wanted to add a MeshRenderer component, I would do the following:

warship->AddComponent(new MeshRenderer());

In the MeshRenderers constructor, should I call on the MeshRendererSystem and "subscribe" the warship object to this system? In that case, the MeshRendererSystem should probably be a Singleton("shudder").  From looking at unity's GameObject, if each object potentially has a renderer or any of the components in the default GameObject class, then Unity would iterate over all objects available. To me, this seems kind of unnecessary since some objects might not need to be rendered for example. How, in practice, should these systems be implemented?

sentences:
What is a good length for looping background music in a Tower Defense game? We know that the soundtrack is important and expensive for an indie's budget.
I requested a looping background track for for my Tower Defense game, where zombie/monsters attack the player. So, for the entire level, the player will keep hearing this music.
In this kind of game, is 30 seconds good for a looping music track, or I need to increase it?

sentences:
XNA arcball camera steering issue I have an arcball set up to follow my model in XNA. It rotates around the target correctly when holding in the left mouse button and moving the mouse. It zooms in and our correctly with the mouse wheel. It turns  so it's orientation is always the same as the character turns left and right.
The one part that's missing: I want the player direction to snap to the camera direction if I press the right mouse button, so I can then steer the player with the mouse. This refuses to work, I just can't seem to get the player facing in the correct direction.

The camera update class:

      public Matrix UpdateCamera(GameTime gameTime, HeightMapInfo heightMapInfo, float playerFacingDirection, Vector3 playerPosition)
    {
        float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds;

        Matrix cameraFacingMatrix = Matrix.CreateRotationY(playerFacingDirection);

        Vector3 targetOffset = Vector3.Transform(cameraTargetOffset,
            cameraFacingMatrix);

        Vector3 cameraTarget = playerPosition + targetOffset;

        Matrix orientation = Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(cameraRotation),
                MathHelper.ToRadians(cameraArc), MathHelper.ToRadians(cameraDistance));

        view = Matrix.CreateLookAt(cameraTarget + (orientation.Backward * cameraPositionOffset.Z), cameraTarget, Vector3.Up);

        return view;
    }

And a snippet of the player class (based upon the XNA heightmap collision demo off MSDN):

        Matrix playerFacingMatrix = Matrix.CreateRotationY(playerFacingDirection);
            Vector3 velocity = Vector3.Transform(movement, playerFacingMatrix);
        velocity *= playerVelocity;

        Vector3 newplayerPosition = GetPlayerPosition() + velocity;
        if (heightMapInfo.IsOnHeightmap(newplayerPosition))
        {
            newplayerPosition.Y = heightMapInfo.GetHeight(newplayerPosition) +
                SphereRadius;
        }
        else
        {
            newplayerPosition = playerPosition;
        }
        float distanceMoved = Vector3.Distance(playerPosition, newplayerPosition);

        int rollDirection = movement.Z > 0 ? 1 : -1;

        sphereRollingMatrix *= Matrix.CreateFromAxisAngle(playerFacingMatrix.Right,
            theta * rollDirection);

        playerPosition = newplayerPosition;

and then the Draw for the player model

            DrawModel(sphere, camera.ReturnSphereRollingMatrix() *
            Matrix.CreateTranslation(camera.GetPlayerPosition()));

Basically, from what's above, what do I need to set as what to make the player direction point in the same direction as the camera direction? (not vice versa)

sentences:
Drawing UI using density pixels I have a question about proper ways to draw UI, since I've learned what I know from the internet and by experimenting I often dont code the "proper" way, instead I do it my own way, not knowing if it will have consequenses that Im unaware of. So, Is it "wrong" to draw your UI using density pixels?

For Example:

canvas.drawText(bullets, this.getWidth() - 134 * dp, 32 * dp, paint);

I try to use getWidth() and getHeight() as much as possible but sometimes I just need to use constants in my code to place stuff where I want it, is this ok as long as I use dp? or will this effect the layout on screens with different resolutions/performance? (Don't have anything except my own to run the game on)

sentences:
Why do so many game websites end in game.com? This is my first question here, so please tell me if I'm doing something wrong :)

I've recently noticed that many game websites end in 'game.com' (www.helloneighborgame.com, www.gunpointgame.com, etc). Is there a specific reason for this, or is it just a coincidence?

I've also noticed that many of these titles are usually indie games. Is it a common thing to do?

sentences:
My Directional light lights the floor of my cave but not the ceiling (concave mesh) I am developing a small demo with Meshes created from a vertex map.

When i put a hole in the mesh (making it concave) the physics work fine but the directional lightning only lights one part of the concave park.

All of my mesh can receive and and cast shadow (so i should have self-shadowing) but it does not seem to work.

my directional light creation:

            var dirLight = new THREE.DirectionalLight( 0xffffff, 1 );
            dirLight.position.set( -50, 50, 1 );
            dirLight.position.multiplyScalar( 50);
            dirLight.name = "dirlight";
   dirLight.castShadow = true;
            dirLight.shadowCameraVisible = true;
   dirLight.shadowDarkness = 1.0;

my shadow settings:

   renderer.setSize( window.innerWidth/1, window.innerHeight/1 );
   renderer.shadowMapEnabled = true;
   renderer.shadowMapSoft = true;

   renderer.shadowCameraNear = 3;
   renderer.shadowCameraFar = camera.far;
   renderer.shadowCameraFov = 50;

   renderer.shadowMapBias = 0.0039;
   renderer.shadowMapDarkness = 0.5;
   renderer.shadowMapWidth = 1024;
   renderer.shadowMapHeight = 1024;

Finally my mesh creation code:

var newGeometry = new THREE.Geometry();
for (var i = 0; i < rawGeometry.vertices.length; i++) {
  newGeometry.vertices.push(new THREE.Vector3(rawGeometry.vertices[i][0], rawGeometry.vertices[i][1], rawGeometry.vertices[i][2]))
}
for (var i = 0; i < rawGeometry.faces.length; i++) {
  newGeometry.faces.push(new THREE.Face3(rawGeometry.faces[i][0], rawGeometry.faces[i][1], rawGeometry.faces[i][2]))
}

newGeometry.computeFaceNormals();
;

var color = rawGeometry.color;
var newMesh = new Physijs.ConcaveMesh(newGeometry, new THREE.MeshLambertMaterial({
  color: color
}), 0, 50, 50);
newMesh.position.x = location[0];
newMesh.position.y = location[1];
newMesh.position.z = location[2];

newMesh.castShadow = true;
newMesh.receiveShadow = true;

this.Chunks[chunkIndex[0]][chunkIndex[1]][chunkIndex[2]][typeIndex] = newMesh;

scene.add(newMesh);

sentences:
Why do these quaterion multiplications produce different results? I am trying to use quaterions to modify the camera direction vector.

This code works perfectly:

glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x  * mouse_sens * time_step), glm::vec3(0.0, 1.0, 0.0)) );
glm::quat temp2 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.y  * mouse_sens * time_step), dir_norm) );

Camera1.SetCameraDirection(temp2 * (temp1 * Camera1.GetCameraDirection() * glm::inverse(temp1)) * glm::inverse(temp2));

This code does not:

glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x  * mouse_sens * time_step), glm::vec3(0.0, 1.0, 0.0)) );
glm::quat temp2 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.y  * mouse_sens * time_step), dir_norm) );

glm::quat temp3 = temp2 * temp1;
Camera1.SetCameraDirection(temp3 * Camera1.GetCameraDirection() * glm::inverse(temp3));

Why can I not multiply quaterions successfully?
Am I using GLM wrong?

sentences:
Aligning pathfinding to the center of tiles? I'm looking to achieve tile by tile movement in a project I'm working on. I employed the use of the asset Simply A* Path-finding to allow a unit to navigate the terrain.

Since the tiles are simply made out of 32x32 sprites, I set the tilesize of the pathfinder to 0.32 to produce the above grid.

However when tested out with a unit, the unit often does not align itself to the center of the sprite as shown in the image below.

I am pretty new to unity and would appreciate if someone could input on how I can fix this or advise on an alternate method to allow this "tile to tile" path finding to work.

sentences:
How do I portray characters with a bum leg properly in an action game like Devil May Cry, without making him a liability? Right now, I'm designing a character for a 2D action platformer game. The problem is that said character has a bum leg due to an accident a few years prior to the game's setting, but was the first one to be dragged into a dungeon formed by the newly developing incident, and had to escape on his own.

What I've thought about until now about this:

The character will move slower than the normal movement speed, cannot double jump, and have a lower jump height than the normal jump height.
However, he would use a sword that doubles as a retractable whip, allowing his melee attacks to have a wide coverage. Said sword-whip has low damage by default, however.
There's also that his melee attacks are less focused on launching enemies upwards and more focused on knocking them back - and maybe apply bleeding (non-elemental damage over time).
He would also have a shotgun that can be 'charged' to maximize the damage output, very much like the Gunslinger Style Shotgun in DMC3 and 4.

My problem is that this character will be one from around eight (for now), and the other seven characters don't have such a disability - two of them I intend to have the ability to glide mid-air.

The game will have a feature of switching between three characters chosen to engage the other dungeons, so he can be switched out for sections that require double jumping, but I'm not sure that's an optimal solution, especially considering the lower damage his weapon deals (making him a non-optimal pick for boss battles).

Should I just make each character fulfill a specific niche in terms of mobility options, melee attack options, and ranged attack options? How does one design the map and bosses for these cases, without making it seem like giving him too much of a break?

P.S. Can a grappling hook be involved, without ending up making him the best option to navigate the map (like refreshing it only after landing)?

EDIT: I also have a thought of integrating this grappling hook into the sword-whip, being able to pull enemies towards him, or him towards them. Is it possible to use this as a melee charge attack? Because I still think that it doesn't feel right.

sentences:
Baked Lightmaps never finish baking in Unity - what is a minimum "test bake" light setting? Tried a number of different configurations. It seems lightmaps never finish baking?
How does one get the light maps to bake?
What is a minimum "test bake" light setting?

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:
How do you convert angle with velocity to x velocity and y velocity? This question can be simplified to:  If you lean a pencil of a certain length at a certain angle what is the x and y position of the tip?
So, basically, I am making a game that plots a balls path through the air as it travels.  I want the user to enter an angle and velocity to launch a ball at and get the program to convert that to an x and y velocity so that it can work out how to plot the balls movement across the screen.  The x velocity doesn't change through the simulation but the y velocity will decrease constantly until the ball touches the ground again.  This is why I referenced to a pencil because it relates to turtle graphics calculations.

sentences:
Rotate around the centre of the screen I want my camera to rotate around the centre of screen and I'm not sure how to achieve that. I have a rotation in the camera but I'm not sure what its rotating around. (I think it might be rotating around the position.X of camera, not sure)
If you look at these two images: http://imgur.com/E9qoAM7,5qzyhGD#0

http://imgur.com/E9qoAM7,5qzyhGD#1

The first one shows how the camera is normally, and the second shows how I want the level to look when I would rotate the camera 90 degrees left or right.
My camera:

public class Camera
{
    private Matrix transform;
    public Matrix Transform
    {
        get { return transform; }
    }

    private Vector2 position;
    public Vector2 Position
    {
        get { return position; }
        set { position = value; }
    }

    private float rotation;
    public float Rotation
    {
        get { return rotation; }
        set { rotation = value; }
    }

    private Viewport viewPort;

    public Camera(Viewport newView)
    {
        viewPort = newView;
    }

    public void Update(Player player)
    {

        position.X = player.PlayerPos.X + (player.PlayerRect.Width / 2) - viewPort.Width / 4;

        if (position.X < 0)
            position.X = 0;

        transform = Matrix.CreateTranslation(new Vector3(-position, 0)) *
            Matrix.CreateRotationZ(Rotation);

        if (Keyboard.GetState().IsKeyDown(Keys.D))
        {
            rotation += 0.01f;
        }
        if (Keyboard.GetState().IsKeyDown(Keys.A))
        {
            rotation -= 0.01f;
        }
    }
}

(I'm assuming you would need to rotate around the centre of the screen to achieve this)

sentences: Is it a bad idea to have several audio sources on the same object in unity? The title is actually self-explanatory. I would like to know if there are any drawbacks (performance-wise, good-practice wise, etc.) for having multiple audio sources on the same GameObject. My initial intuition is that it gives me more freedom to have specific audio settings (volume, pitch, etc.) for each audio clip I want to play, but I want to know if this setup is advisable.

sentences:
Rendering three-dimentional array of tiles (as a tilemap) I'm trying to create 2d game engine in C++ using SDL2 (actually some code was migrated from SFML). I want to have a flexible multilayer tilemap that can store different types of tiles. My current version of this kind of map uses three-dimensional array of pointers to base class of tiles ("tilemap").

First of all - is it even a good approach?

I'm using pointers to make tiles polymorphic (eg. ground tile (tile_basic) has it's act number and texture id, but chest tile (tile_chest) has also a list of items in it). However scanning trough this array every time when I'm rendering my map would take a lot of time. So I'm scanning trough three-dimensional array of sprites (drawable objects) which is generated from the tilemap every time when new sprites are meant to be shown on the screen.

std::vector<std::vector<std::vector<mg::CompactSprite> > > sprites;

The first two dimensions are quite constant, they depend on the size of the application window. When moving the camera sprites move up to their size (width, heght) and when they are about to exceed this limit, their coordinates reset (x, or y, depending on which direction the camera is moving), getting it into simple words - I'm using modulo.

The problem is that this is terribly slow (~43ms with 23x18 map with only few layered tiles; using SDL2, similar results with SFML). I know I could render the whole visible area to the one image and just move that image and then render only new areas, but then I won't be able to make animated tiles without listing their coordinates, checking if they are in the visible area and then rerendering them which sounds bit overcomplicated, and I'm not quite sure if it'll really boost the rendering process.

So is there any better way to do this? Or I should change my approach?

sentences: Calculate mipmap level in a loop with varying iteration? How can I calculate the correct mipmap level in a shader?  It needs to be used in a loop which runs a variable number of times so the compiler will not allow me to use Sample or the derivative functions, instead I have to use SampleLevel and manually specify a level.  I tried a simple distance based one but that doesn't look very good and doesn't fix all the problems (such as looking at them at a sharp angle), I thought I could use the dot product of the normal with the direction the pixel is going but I'm still not sure on the correct thresholds etc or if there's a better way.

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:
up vector for quaternion First, I know there's a question exactly like mine, and some ohter really close, but my implementation of the solutions didn't work at all. Ok, now to the question.

I created some forms of camera based on quaternions, however, for my orbit/chase camera every quaternion I create will roll the camera in an uncontrollable manner. What I want is a function like Unity's Quaternion.LookRotation where you can pass an up vector.
This is a simplification current attempt of implementation:

Vector3 target = -Position; //Because we're looking at the origin
target.Normalize();

float cosine = Vector3.Dot(Vector3.Forward, target);
Vector3 axis = Vector3.Cross(Vector3.Forward, target);
Rotation = Quaternion.CreateFromAxisAngle(axis, (float)Math.Acos(cosine));

//Trying to unroll up vector to Vector3.Up
//based on the other answer but results were unchanged
Vector3 rolledUp = Vector3.Transform(Vector3.Up, Rotation);
Vector3 right = Vector3.Cross(target, Vector3.Up);
Vector3 newUp = Vector3.Cross(right, target);

Vector3 axis2 = Vector3.Cross(rolledUp, newUp);
float angle2 = (float) Math.Acos(Vector3.Dot(rolledUp,newUp));

Rotation = Quaternion.CreateFromAxisAngle(axis2, angle2) * Rotation;

return Matrix.CreateLookAt(
    cameraPosition: Position,
    cameraTarget: Vector3.Transform(Vector3.Forward, Rotation),
    cameraUpVector: Vector3.Transform(Vector3.Up, Rotation));

If my sleepiness got in the way of my clarity, here's what I have:

and here's what I want:

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:
Instantiating Prefabs at run time I'm trying to move my project to Addressables and upload assets, prefabs and screens to an archive on the server.
I'm a new in Unity and this a bit challenging for me.
I've prepared all prefabs for addressable usage and now I'm trying load them.

All my prefabs have loads throw GameObject.Instantiate
For example:

    public class PlatformObject : LocationObject
        {
//other properties and methods
            public PlatformObject Clone()
            {
                var clone = ((Runner.PlatformObject)GameObject.Instantiate(this));
                clone.Id = this.Id;
                clone.NextPlatforms = this.NextPlatforms;
                clone.IsStartPlatform = this.IsStartPlatform;
                clone.Level = this.Level;
                clone.Type = this.Type;
                clone.MinimumDistance = this.MinimumDistance;
                clone.AllowDispose = false;
                clone.Size = this.Size;
                return clone;
            }
    }

I've tried change this code for usage Addressables.

public async Task<PlatformObject> Clone()
        {
            var handle = Addressables.LoadAssetAsync<GameObject>(this.name);
            var clone = (await handle.Task).GetComponent<PlatformObject>();
            clone.Id = this.Id;
            clone.NextPlatforms = this.NextPlatforms;
            clone.IsStartPlatform = this.IsStartPlatform;
            clone.Level = this.Level;
            clone.Type = this.Type;
            clone.MinimumDistance = this.MinimumDistance;
            clone.AllowDispose = false;
            clone.Size = this.Size;
            return clone;
        }

I've got a cloned object successfully, but object doesn't appears on the scene. Looks like object not initialized properly, bcouz I've got a lot of warnings like that:

  Setting the parent of a transform which resides in a Prefab Asset is
  disabled to prevent data corruption (GameObject: 'Mid_Town_07').
  UnityEngine.Transform:set_parent(Transform)

I've googled and have found a few solution related with parent location.
Made changed but it didn't help. I'm still getting those warnings.

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:
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:
How to avoid overwriting a value in Unity? I'm working on a Tower Defence style game, and wondering how best to handle the "resources" part. I have multiple enemies on screen at a time, and when an enemy dies, it updates a resource that allows the player to build more towers
var tower = Instantiate(buildables[0], center, Quaternion.identity);
var controller = tower.GetComponent<TowerController>();
controller.OnKilledEnemy += (sender, args) =>
{
    int.TryParse(goldAmount.text.Replace(",", ""), out var curr);
    curr += args.gold;
    goldAmount.text = $"{curr:n0}";
};

But if 2 enemies die in the same frame, wouldn't the value there miss an update?
What ways are there in Unity/C# to mitigate this problem?

sentences:
Rendering to Texture with Transparency in Monogame? Please forgive me if I'm asking a question that has been answered before, but for the life of me, search as I might, I couldn't find a problem exactly like this anywhere.

I'm trying to render a series of sprites, all sourced from transparent PNGs, to a texture. Each of these rendered textures would be layers in a 2D environment which could be subjected to shaders/effects before being placed on the screen.

My problem is that when I try this, the screen fills with black, and only the last texture rendered is visible.

I have tried:
 * clearing the graphics device after setting my render target, using color.transparent.
 * every surface format (those formats mean nothing to me at this interim)

I am new to this particular environment, so I am probably missing something that I can't easily look up.

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 - Fire bullet using AddForce is very slow This is a top-down view but in 3D coordinates, I would like to instantiate and fire a bullet from the player's gun. This script is on a spawner object at the end of the barrel.

void Fire () {

        float speed = 80;

        GameObject projectile = Instantiate (bullet, transform.position, transform.rotation) as GameObject;

        projectile.GetComponent<Rigidbody>().AddForce(transform.forward * speed);
        coolDown += Time.time;
    }

I also tried this but in this case the bullet always moves in a fixed direction (North) :

projectile.GetComponent<Rigidbody>().velocity = Vector3.forward * speed;

Bullet is an empty object and the actual bullet is it's child ( did that to overcome a rotation issue ), the problem is nomatter how high I turn up the speed the bullet travels very very slow.
Both the parent and the bullet have Rigidbody.

sentences:
Whats the general method developers to implement FPS multiple weapon handling animations? I'm trying to create a first person shooter and I'm lost on what's a good, efficient methodology to implement the whole weapon handling animation system.

Now, I know that I could have a unique animation for every weapon, but this sounds very expensive. Do people use IK to modify hand positions so that they can reuse the same animations for similar weapons?

Also, How does recoil work? Is it baked into the animation? Or is it applied via script? In counterstrike it looks like it's baked into the animation (since they use hip firing), however, in COD it looks like

Id really appreciate any opinions because I am lost!

Thank you

sentences:
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:
Client Side Game Local Storage I'm coding (or at least trying to code) a single player game in pure JS. I was wondering how I was gonna be able to write data without having the user setting up a server or a database, only way I found is local storage.

I'm aware that this kind of data is attached to the browser but I don't think someone would swap between browser, IMHO people start with one and stick to it. What I'm more concerned about is what else in the local system can modify this storage?

For instance, can cleaning up applications remove the JSON I put in there?

sentences:
How should i have the key/mouse input in an advanced java game? I am a self taught programmer, so I do not know the proper ways to do things. I have made simple games like asteroids and snake, but in those games, you can easily modify the variables within the keyevent functions. Here is how I did it in my simple Asteroids game:

/*
* key listener events
*/
public void keyReleased(KeyEvent k){
    int keyCode = k.getKeyCode();

    switch(keyCode){

        case KeyEvent.VK_LEFT:
            turnLeft = false;
            break;

        case KeyEvent.VK_RIGHT:
            turnRight = false;
            break;

        case KeyEvent.VK_UP:
            accel = false;
            break;

        case KeyEvent.VK_1:
            cls = true;
            break;
        case KeyEvent.VK_ENTER:
            break;
        case KeyEvent.VK_SPACE:
            fire = false;
    }
}
public void keyTyped(KeyEvent K){}
public void keyPressed(KeyEvent k){
    int keyCode = k.getKeyCode();

    switch(keyCode){

        case KeyEvent.VK_LEFT:
            turnLeft = true;
            break;

        case KeyEvent.VK_RIGHT:
            turnRight = true;
            break;

        case KeyEvent.VK_UP:
            accel = true;
            break;

        case KeyEvent.VK_1:
            cls = false;
            break;
        case KeyEvent.VK_ENTER:
            clearAllBullets();
            break;
        case KeyEvent.VK_SPACE:
            fire = true;
    }
}

If I were to make a more advanced game (with a main menu, options, main game, etc.), how should I do the key/mouse input?

Also, if I were to go into the single-player, should i put all of the gameplay code into one class? Is there a way to put the single player code into a separate class and somehow have the key input still modify the variables and such?

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:
Calculate combat result between 2 units I need to know the best way to calculate an outcome between 2 types of units. Each unit has 3 factors: Health, AttackPower, Defense

There is also a last factor of anti-troop which says that one trooper is better against a certain type. So this factor must be taken accounted for.

Can someone help me with this  ?

Kind regards

Example

Unit1(attacker):

 Amount: 40
 Health/Unit: 10
 AP/Unit: 5
 Defense/Unit: 2

Unit2(defender):

Amount: 20
Health/Unit: 10
AP/Unit: 5
Defense/Unit: 2

How can I get a right outcome of who wins and with how many units left.

sentences:
offset texture attached to frameBuffer to render panorama I would like to pre-render horizon of large landscape to texture and than paste it as cylindrical screen around the camera (to accelerate rendering of distant details)

Easiest would be make 8-gon screen uv-mapped to 4096x512 pixel frambuffer texture and render from 8 angles of camera with frustum 360/8=45 degrees wide (each angle mapped to different tile of framebuffer texture).

like this

But as far as I know output framebuffer texture is always mapped to whole framebuffer i.e. to whole camera frustrum. Is that right? Is there a way how to choose mapping for frambuffer output texture?

sentences:
Subtract a circle on a rectangle - OpenGL I am writing a game using GLFW, GLEW, GLM and Bullet3 in C++. Its a Maze with holes. I am doing the floor with rectangles (wich is 2 GL_TRIANGLES).

I want to make some woles (circles), to the ball fall out of the board. What the best way to do that? How can I subtract a circle to the floor? And add the shape to the Bullet3?

Thanks

sentences:
What are the techniques used to save space with very large levels? Some days ago I was thinking "how would I store the real world into a continuous game level ?".

I guess it must have been some challenge for RockStar engineers (for GTA 4 or Red Dead Redemption) or when developing RAGE (the ID game, not the rockstar engine), and I wonder how they solved it.

Of course current RAM and hard disk capacities don't allow it if you don't use high definition content, so you simplify by abusing the reuse of objects:

Use doodads for trees, barriers, bushes, benches, trashbins, etc
Use palettes instead of textures for the ground and walls and buildings
Use heightmaps for altitude
Use procedural method for modeling roads, houses, buildings, sidewalk, pavement
Also use procedural methods to model the insides of buildings: walls, ceiling, stairs, doodads.

These are the only things which make sense to me, but I want to know if they are other methods I'm missing, like for example reducing vertex precision while storing models, but requiring to make an exporter.

sentences:
How to make two keys pressed to make an action? Hey i am beginner gamedev. I couldn't find answer to this or I am bad articulating my problem. But really would like an answer to this. How can i make function to press two keys like A and D at the same time to make a jump animation if A and D are already taken separately to A = walk left and D = to walk right? Without them overlapping.
func _input(event):

if event.is_action_pressed("left") && event.is_action_pressed("right"):
    $DancerSprite.play("bluedouble")

if event.is_action_pressed("left"):
    $DancerSprite.play("blueleft")
    return

elif event.is_action_pressed("right"):
    $DancerSprite.play("blueright")
    return

sentences:
Game Server Mechanic Hey guys :) Im currently developing a little rpg duengon crawler.
I really want to implement a local and an online multiplayer function, i know how servers are working and how to make them using sockets or kryonet.

But heres my question, i want that when someone, starts a local server in my game, that it starts an runnable jar file which includes the server, is that recommend or just stupid ? Should the server be included in the game or outside in an extra file ? What should i obverse ? :)

sentences:
Additional Entity ID for networking instead of general EID? http://t-machine.org/index.php/2015/06/09/entity-ids-how-big-using-uuids-or-not-why-etc/

I see this one article that proposes specific IDs just for the networking side of the game. If you are already employing IDs for your entities, is there any benefit on adding IDs just for client-server communication instead of reusing the original local ID (one that you know is not subject to collisions)?

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:
Tile Based Engine: Storing Tiles and Levels I've worked with tile-based engines before (a few years ago when I was pretty green).  Now that I know a bit more, I want to revisit tile-based engines but I want to approach it correctly.  I want to know two things: what is the best way to store the tiles, and what is the best way to store the levels?

For the first question: The tiles should be stored in sets, like a 10x10 grid of 40x40 tiles stored in a 400x400 image.  Right?  So when it's displayed, do you just place the entire image on the screen and only show the part of the image you want?  And in that case, wouldn't it create a significant amount of overhead for a bunch of unused image?  Or do multiple copies of the same image use the same cache?

For the second question: Should the levels be stored as two dimensional arrays?  Serialized in a database?  Or what?

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:
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:
2D HUD overlay drawing based on 3D coordinates and camera azimuth and elevation Assume you have the 3d coordinates of the player and another unit N as well as the azimuth and elevation of a camera always looking at the player. In the following illustration the sun would be the camera of course:

(source: permetix.com)
Let's say one wants to draw something on a different transparent window (not using the game window or any hooks) that is always displayed on top of the unit. An example would be TurboHUD for Diablo. In the linked video you can see that it displays affixes using textboxes right on top of the blue elite mobs.
In Diablo doing this is much simpler since the camera cannot be rotated and moved thus only simple projections depending on the distance are necessary, but what about situations with more degrees of freedom? How can one estimate 2d coordinates to draw at that match the position of the 3d units on the screen without access to more than described in the first paragraph? What is the mathematical background and what are the necessary computations?

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:
Good game engine to fork? I am a student C++ developer, and while I like game development, I don't like making games. Instead, I like developing the "tech" behind the games, like game engines, tools etc. The reason for this is because it enables me to code without having to worry about creating art resources, sounds, storylines, etc.

I started working on a game engine, but I am having a hard time starting from scratch. I would much rather be given a template to work off of and modify/add as I go. What are some good open source game engine I can fork?

I would rather fork an engine, as I truly want to make it my own, but I need a base to start from.

Please let me know.

Thanks

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:
Game Object, components priority? So, my first attempt to create a component based game object is this:

class GameObject;

class GameObjectComponent
{
public:
    virtual ~GameObjectComponent();
    virtual void Update(GameObject* obj, const sf::Time& deltaTime) = 0;
};

class GameObject
{
public:
    GameObject();
    virtual ~GameObject();

    virtual void Update(const sf::Time& deltaTime);
    virtual void AddComponent(
      std::unique_ptr<GameObjectComponent> component,
      std::string componentName);
    virtual GameObjectComponent* GetComponent(std::string componentName);

    float GetVelocity();
    float AddVelocity(float velocity);
    void SetVelocity(float velocity);
    sf::Vector2f GetPosition();
    sf::Vector2f MovePosition(sf::Vector2f movement);
    void SetPosition(sf::Vector2f position);

private:
    float mVelocity;
    sf::Vector2f mPosition;
    std::unordered_map<std::string, std::unique_ptr<GameObjectComponent>> mComponents;
};

The cpp

#include "GameObject.h"

namespace Engine{
GameObjectComponent::~GameObjectComponent()
{
}

GameObject::GameObject()
{
    mVelocity = 0.f;
    mPosition = sf::Vector2f(0.f,0.f);
}

GameObject::~GameObject()
{
}

void GameObject::Update(const sf::Time& deltaTime)
{
    for (
      auto iterator = mComponents.begin();
      iterator != mComponents.end();
      ++iterator)
    {
        iterator->second->Update(this, deltaTime);
    }
}

void GameObject::AddComponent(
  std::unique_ptr<GameObjectComponent> component,
  std::string componentName)
{
    mComponents[componentName] = std::move(component);
}

GameObjectComponent* GameObject::GetComponent(std::string componentName)
{
    return mComponents[componentName].get();
}

float GameObject::GetVelocity()
{
    return mVelocity;
}
float GameObject::AddVelocity(float velocity)
{
    mVelocity += velocity;
    return mVelocity;
}
void GameObject::SetVelocity(float velocity)
{
    mVelocity = velocity;
}
sf::Vector2f GameObject::GetPosition()
{
    return mPosition;
}
sf::Vector2f GameObject::MovePosition(sf::Vector2f movement)
{
    mPosition += movement;
    return mPosition;
}
void GameObject::SetPosition(sf::Vector2f position)
{
    mPosition = position;
}
}

and it works, but now I'm worried about priority.

Let's say I have these components: Movement, Phyisic, Renderer, NetworkSync
then they should run in order, otherwise the player could be rendered in the wrong spot, make a movement they should be able to do, or don't sync correctly with other players.

I'm not sure how to handle this without tanking the performance, and without losing too much flexibility.

Any suggestions?

Thank you.

sentences: What 3D engine should I use for the browser, iPhone, and Android platforms? I have a C++ game that has a 3D engine that works only in Windows. I'm wondering which engine I should use so that it can be used in a browser or in iPad (iPhone) and Android environments? Does anyone have an idea of the size of the task to migrate from one 3D engine to another?

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:
How do I make a GameObject carry across only 2 specific scenes? I have a GameObject in my main menu and help scenes that I want to carry across both scenes but be destroyed on all other scenes. I am having multiple issues with it such as it wont destroy on other scenes or when I go back to the previous scene it will generate 2 GameObjects and so on. Here is the script:

public class DestroyObject : MonoBehaviour
{
    void Awake()
    {
        DontDestroyOnLoad(gameObject);
        SceneManager.sceneLoaded += OnSceneLoaded;
    }

    void OnSceneLoaded(UnityEngine.SceneManagement.Scene scene, UnityEngine.SceneManagement.LoadSceneMode mode)
    {
        if ((scene.name == "Help") || (scene.name == "Main Menu"))
        {
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
}

sentences:
Problem Rendering TTF_Font Textures to one Texture with SDL2 I'm trying to render multiple lines of text to one texture so I only have to render one texture to the screen. However, when I use a dstrect argument in SDL_RenderCopy the text doesn't show up and when I use NULL for the dstrect argument it does work, but it is stretch to the entire texture which I don't want. I've checked the values of the dstrect (x,y,w,h) and they all seem to be at the right values when I try to render.

Here is the creation of the "Font Texture"

void Font::setMessage(std::string textureMessage, SDL_Color textColour){

if(text != NULL){
    SDL_DestroyTexture( text );
    text = NULL;
}

//contents is a string
contents = textureMessage;

//Render text surface
SDL_Surface* loadedSurface = TTF_RenderText_Blended( fontType, contents.c_str(), textColour );

if( loadedSurface == NULL ){
    std::cout << TTF_GetError() << std::endl;
}

if( loadedSurface == NULL ){
    //Error Check
    std::cout << "COULDN'T RENDER TEXT." << std::endl;
}
else
{

    //Create texture from surface pixels
    //text is of type SDL_Texture
    text = SDL_CreateTextureFromSurface( rendererPtr, loadedSurface );
    if( text == NULL ){
        //Error Check
        std::cout << "COULDN'T LOAD FONT TO TEXTURE." << SDL_GetError() << std::endl;
    }
    else{
        //w and h are int pointers to the SDL_Rect "textBox" offsets
        w = &textBox.w;
        h = &textBox.h;
        if( TTF_SizeText(fontType, contents.c_str(), w, h) != 0){
            std::cout << "COULDN'T SIZE FONT." << SDL_GetError() << std::endl;
        }
    }

}

//Get rid of old loaded surface
SDL_FreeSurface( loadedSurface );
loadedSurface = NULL;

}

And here is where I'm trying to render it to another texture:

    dstRect->x = xTemp;
    dstRect->y = yTemp;
    dstRect->w = messageLog.at(placeCount)->getW();
    dstRect->h = messageLog.at(placeCount)->getH();

    std::cout << dstRect->x << " " << dstRect->y << " " << dstRect->w << " " << dstRect->h << std::endl;

    if (messageLog.at(placeCount)->getSelf() != NULL){
        if ( SDL_RenderCopy(rendererPtr, messageLog.at(placeCount)->getSelf(), NULL, dstRect) != 0){
            std::cout << SDL_GetError() << std::endl;
        }
    }

Any ideas why giving an argument would make it not work but using NULL would?

sentences:
Constant size geometries for glDrawArraysInstanced calls In my application I can keep the objects constant sized
            const Graphics::VectorDouble diffVec(dTranslateX - m_CameraTransformOffset.x,
                                                 dTranslateY - m_CameraTransformOffset.y,
                                                 dTranslateZ - m_CameraTransformOffset.z);

            camScaleInv = Graphics::Lenght(diffVec) * 2.0f * tan(fov * 0.5f * PI / 180.0f);

Than I scale my view matrix with  camScaleInv and I think that is very common to do but ,
I have some objects which I draw with glDrawArraysInstanced. I pass the parent surface only once and another array for duplicating the parent surface in different positions.
That causes my "diffVec" to be different and causes me to not being able to use keep same distance logic in CPU side.
Is there any way for me to keep the objects which are being drawn with glDrawArraysInstanced same size either in CPU or GPU(glsl) side.

sentences:
QT SFML Integration Trouble I have been having trouble linking sfml to qt creator I have downloaded the pre-compiled libraries and headers for MINGW on the sfml website here : http://www.sfml-dev.org/download/sfml/2.3.2/

This is my .pro file

QT       += core gui opengl

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = SFML_MapEditor
TEMPLATE = app

SOURCES += main.cpp\
        MainWindow.cpp

HEADERS  += MainWindow.h

FORMS    += MainWindow.ui

INCLUDEPATH += "C:\VsIncludes\SFML\SFML-2.3.2\include"
DEPENDPATH += "C:\VsIncludes\SFML\SFML-2.3.2\include"

LIBS += -LC:\VsIncludes\SFML\SFML_QT\SFMLLIBS\

CONFIG(debug, release|debug): LIBS += -lsfml-window-d -lsfml-audio-d -lsfml-graphics-d -lsfml-main-d -lsfml-system-d -lsfml-network-d
CONFIG(release, release|debug): LIBS += -lsfml-window -lsfml-audio -lsfml-graphics -lsfml-main -lsfml-system -lsfml-network

Here is the project files where the binaries are read

Now my problem lies in the loadFromFile() function.
When I do run the program with the loadFromFile() function
it will immediately give me this error:

C:\Users\Alex\Documents\QT_Projects\SFML_MapEditor\main.cpp:14: error: undefined reference to `_imp___ZN2sf7Texture12loadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_4RectIiEE'

However when I run the program without loadFromFile()
it will run without a hitch

My main.cpp file

#include "MainWindow.h"
#include <iostream>
#include <QApplication>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <QDebug>

void SFML_Test()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "HELLO SFML");

    sf::Texture tex;

    if (!tex.loadFromFile("Default_Texture.png"))
    {
        return;
    }

    sf::Sprite sprite(tex);

    while (window.isOpen())
    {
        sf::Event e;

        while (window.pollEvent(e))
        {
            if (e.type == sf::Event::Closed)
            {
                window.close();
            }
        }

        window.clear();
        window.draw(sprite);
        window.display();
    }
}

int main(int argc, char *argv[])
{
    /*
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
    */

    SFML_Test();

    return 0;
}

sentences: Animated Models in XNA I've been using XNA for 2D games for awhile, and I am just learning 3D now. I have a question, which seems like it should be fairly basic. As I understand it, I make a model in Maya (or whatever) and have some animations in it (walk, jump, etc.). How do I take that model, and put it in my game, and have it run the animation to walk? Thanks!

sentences:
How can I randomly generate achievements? Novice programmer here.
To challenge my self i want to create an achievement system that randomly generates achievements for me based on a set of trackable metrics within my game.

To keep it as abstract as possible my game is a turn based highscore chaser. Each game has 13 turns. Each turn consists of placing 4 tiles, each tile can have an individual score which together form the turn score. There are 5 different tile types that can be individually combined to raise each tile's score differently. Each turn one of the 5 tiles gets a bonus making it worth double points. Also in each turn you can form "hands" similar to poker where for example two tiles of the same type next to each other are a pair, which nets a hand bonus for individual turns.

Here's what my generated achievements should look like:

Get a turn score of 15 and create a pair using tile type x.
Create a tile type y that has 5 points.
Create 5 hands of type x and use tile type x or y.
Get a total score of 50 without creating more than 3 hands of type x.

Obviously this seems kind of complicated and i'm kind of asking myself how to create such "complex" achievements. Seems like i need to establish some kind of syntax that i can feed the system to produce these kinds of requirements. But i'm kind of stuck since i couldn't find any info on this issue yet.

Maybe you have done something similar?

sentences:
How are red dot/reflex/holographic sights implemented? In first-person-shooters like Call of Duty, the hologram only appears when it is behind the glass portion of the sight.

In OpenGL, would it be implemented by rendering the glass to the stencil buffer and then rendering the hologram, but masked by the stencil buffer?

sentences:
Find shortest path (quickly) on the surface of a 3d model? Imagine this scenario:
we have a 3d model, for instance a doughnut, apple or an orange (possibly something more complex). There's an insect (let's say an ant) on the surface of that food item. Now that ant wishes to reach a certain specific coordinate embedded on the surface of the 3d object in the shortest time possible (using the shortest path, ignoring physics).

Now the ant AI could use Dijkstra on the original mesh but that might be low-res so the ant will zig-zag on the surface, outlining the shapes of blocky faces. You could split the faces but the angular nature of the edges, making up the structure of the mesh will continue to drive the ant to more in ziggy-zaggy like manner (imagine a rougelike with very small squares, you can still only move in 8 directions at any given point).

What we did is split the edges (of the model) to evenly-sized pieces and embedded "navigation vertices" between these pieces, we then connected the vertices of each edge with vertices of other edges sharing a face with it (4 other edges because faces are triangular). This works pretty well cause it means the any can travel freely between faces, ignoring their shape almost completely (unless they are very small and were not split).

We also have the ant "pulled" (dragged even) by an imaginary ant that is a few steps ahead to completely eliminate the more rigid areas in the path (think sharp corners). Sounds great right?

But this is not terribly fast. Any advice about that is appreciated.

sentences:
Unity - Light and sprite collision I'm a beginner in Unity and i'm facing a little problem / question.
The main purpose of my 2D game is based on the mouvment of a specific light and the player have to avoid getting inside his rays. My actual game got different type of layers :

Z = -5 : A front light (don't pay attention of this one)
Z = 0 : The main scene, where the player move and interact with collider (2D based, player is a sprite with rigidbody2d and circlecollider2d
Z = 1 : Some elements to avoid the light to go through and give the player a chance to hide
Z = 10 : The main light that the player have to avoid

My problem is the following one, i don't know how to interact a Point Light (so a 3d object) and a sprite (2D). I tried to do some "OnTriggerEnter / Stay" in the Point Light but it never trigger.
I heard about "Raycast" but i prefer to ask some solution before learning this.
If anyone can give me tips, it would be very good :)

Thanks !

[EDIT SOLUTION, THANKS TO Géry Arduino]

#pragma strict

public var moon : Component;

function Start () {

}

function Update () {
var radiusMoon = moon.transform.light.range;
var zMoon = moon.transform.position.z;
var zPlayer = transform.position.z;
if(zMoon - radiusMoon <= zPlayer) {
    var zDirection = transform.position.z - zMoon;
    var xDirection = transform.position.x - moon.transform.position.x;
    var yDirection = transform.position.y - moon.transform.position.y;
    var direction = Vector3(xDirection, yDirection, zDirection);
    Debug.DrawRay(moon.transform.position, direction, Color.red, 10);
    if(Physics.Raycast(moon.transform.position, direction, radiusMoon)) {
        Debug.Log("there is something between me and the object....");
    }
    else {
        Debug.Log("i'm free");
    }
}
}

sentences:
Domain distortion on a spherical texture (planetary surface) I am experimenting with procedural techniques to generate planetary terrain. I have close to zero knowledge so I started with something simple, using perlin noise and domain distortion.
My goal is to wrap these textures on a sphere model (using openGL) so I tried to use spherical coordinates and it was partially successful (I learned from https://ronvalstar.nl/creating-tileable-noise-maps).
As long as I don't apply domain distortion I obtain the expected result with no discontinuity at the poles or anywhere:

But when I do apply the domain distortion, I get this:

You can see there are discontinuities at the poles, and also at a meridian.
I'm not sure to understand why the domain distortion is breaking my spherical mapping, I tried to apply a modified formula from here: https://iquilezles.org/www/articles/warp/warp.htm but it looks like the way I define the position vector is wrong in this case.
I do not know if spherical coordinates are adapted to this kind of problem. Can you please confirm this is the most efficient way to go?
If you have something else to suggest, please share. I have been reading a lot of things about cubemaps, (u, v) texture mapping, procedural texturing etc but did not really understand everything and how it might help me, also for the most part it looked quite sophisticated (intimidating for me).
Here is my code (the buggy part I guess is under the "# --- WARP (domain distortion) ---" line:
import numpy as np
from noise import pnoise3 as perlin3
from noise import pnoise2 as perlin2
import matplotlib.pyplot as plt
import noise
from PIL import Image
import time

# --- transformation X, Y (cartesian) -> a, b, c (spherical) ---
def spherical(x, y, naxis):

  fNx = (x + 0.5) / naxis
  fNy = (y + 0.5) / naxis

  fRdx= fNx * 2 * np.pi
  fRdy = fNy * np.pi
  fYsin = np.sin(fRdy + np.pi)

  a = naxis * np.sin(fRdx) * fYsin
  b = naxis * np.cos(fRdx) * fYsin
  c = naxis * np.cos(fRdy)

  return a, b, c

# --- MAIN ---
def procedural(naxis, WARP, octaves, persistence, lacunarity):

  t0 = time.time()
  M = []

  for i in range(len(WARP) + 1):
    M.append(np.zeros((naxis, naxis)))
  M = np.array(M)

  # --- perlin noise on spherical coordinates ---
  M[0] = np.array([[perlin3(float((spherical(i, j, naxis)[0]) / naxis),
                            float((spherical(i, j, naxis)[1]) / naxis),
                            float((spherical(i, j, naxis)[2]) / naxis),
                            persistence = persistence, lacunarity = lacunarity, octaves = octaves)
                            for i in range(naxis)] for j in range(naxis)])

  # --- WARP (domain distortion) ---
  # f( p + f(p) )
  # p: spherical(i, j) -> a, b, c
  # components:  f( a + M[w-1] )
  #              f( b + M[w-1] )
  #              f( c + M[w-1] )

  for w in range(1, len(WARP) + 1):
    M[w] += np.array([[perlin3(float((M[w-1][i, j] * naxis * WARP[w-1] + spherical(i, j, naxis)[0]) / naxis),
                               float((M[w-1][i, j] * naxis * WARP[w-1] + spherical(i, j, naxis)[1]) / naxis),
                               float((M[w-1][i, j] * naxis * WARP[w-1] + spherical(i, j, naxis)[2]) / naxis),
                               persistence = persistence, lacunarity = lacunarity, octaves = octaves)
                               for i in range(naxis)] for j in range(naxis)])

  # --- normalization [0, 1] ---
  for n in range(len(WARP) + 1):
    M[n] = (M[n] - np.min(M[n])) / (np.max(M[n]) - np.min(M[n]))

  return M

cm = 'coolwarm'

naxis = 1024
WARP = [0.5, 1, 0.5]
#WARP = []
octaves = 24
persistence = 0.5
lacunarity = 2

R = procedural(naxis, WARP, octaves, persistence, lacunarity)

# --- save jpeg ---

im = Image.fromarray(R[-1] * 255)
im = im.convert('RGB')
im.save("your_file.jpeg")

fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow(R[-1], cmap = cm)
plt.show()

sentences:
How to inspect child nodes in IDE debugger? Consider an enemy with this node hierarchy:
* KinematicBody2D (Enemey)
|- Sprite
|- CollisionShape
|- Area2D (StompDetector)
   |- CollisionShape2D

With signal from StompDetector to Enemy:
func _on_StompDetector_body_entered(body: Node) -> void:
    if body.global_position.y < $StompDetector.global_position.y:
        die() ## >> BREAKPOINT <<

That does not work as exepcted. How to inspect $StompDetector from the debugger at BREAKPOINT?

sentences: Turn based game - HTTP or WebSocket? My game will be a turn based game which will need a server gateway in order to send requests. What would be better for the server: using REST HTTP GET for making the requests? Or using WebSocket which enables you to have an active connection?

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

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

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

sentences:
Models loaded with Assimp have messed up UVs/normals I've been trying to use Assimp to load models and so far I got it to load a few obj models, but all of them have messed up UVs (and maybe normals).

Here's what it looks like :

I tried several combinations of Assimp's loading flags, but to no avail.

Here are the used flags :

const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_FlipUVs|aiProcess_GenSmoothNormals|aiProcess_ImproveCacheLocality|aiProcess_FixInfacingNormals|aiProcess_FindDegenerates|aiProcess_FindInvalidData|aiProcess_GenUVCoords|aiProcess_TransformUVCoords);

I'm only loading already triangulated (with Blender) obj models with no submeshes.

Thanks in advance for any help.

sentences:
Script causes scene to load very slowly So I have this script (pasting the entire thing in it's current state) :

using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Events;
using ooparts.dungen;
using UnityEngine.UI;

    public class RoomMapManager : MonoBehaviour
    {
        public Map mapPrefap;
        private Map mapInstance;

        public int MapSizeX;
        public int MapSizeZ;
        public int MaxRooms;
        public int MinRoomSize;
        public int MaxRoomSize;
        public Image coverPanel;
        public int TileSizeFactor = 1;
        public static int TileSize;
        private UnityAction mapGenerationListener;
        private void Awake()
        {
            //  mapGenerationListener = new UnityAction(FadeCover);
        }
        private void OnEnable()
        {
            // EventManager.StartListening("GenerationComplete", mapGenerationListener);
        }
        private void OnDisable()
        {
            // EventManager.StopListening("GenerationComplete", mapGenerationListener);
        }
        void FadeCover()
        {
            Time.timeScale = 1;
            coverPanel.color = new Color(0, 0, 0, 0);
            coverPanel.raycastTarget = false;
        }
        void Start()
        {
            //TileSize = TileSizeFactor;
            //BeginGame();
        }

        void Update()
        {
            if (Input.GetKeyDown(KeyCode.R))
            {
                RestartGame();
            }
        }

        private void BeginGame()
        {
            mapInstance = Instantiate(mapPrefap);
            mapInstance.RoomCount = MaxRooms;
            mapInstance.MapSize = new IntVector2(MapSizeX, MapSizeZ);
            mapInstance.RoomSize.Min = MinRoomSize;
            mapInstance.RoomSize.Max = MaxRoomSize;
            TileSize = TileSizeFactor;
            //coverPanel.color = new Color(0, 0, 0, 1);
            //coverPanel.raycastTarget = false;
            //Time.timeScale = 0;
            mapInstance.Generate();
        }

        private void RestartGame()
        {
            EventManager.TriggerEvent("GameRestarted");
            StopAllCoroutines();
            for (int i = 0; i < mapInstance._rooms.Count; i++)
            {
                foreach (GameObject g in mapInstance._rooms[i].Monsters)
                {
                    Destroy(g);
                }
            }
            Destroy(mapInstance.gameObject);

            //BeginGame();
            SceneManager.LoadScene("Prototype2");
        }
    }

Notice how Awake, OnEnable and Start do nothing. When this script is attachet as a component to a gameObject the scene where this gameObject is loads very slowly. I mean it takes like 30s to 1 min for it to load even in the editor. THe behaviour is the same when I build the project both to PC and Android. When I start the scene itself from the editor there is no delay. I have no idea what might be causing this.

sentences:
Why use this equation to get a percentage? In an XNA book I read that this code does an action with a 0.2% of probability
but I don't' understand why:

float chance = 0.2f;

if((float)rand.Next(0,1000) / 10 <= chance)
{
...
}

I understand the statement, but not the reasoning for that equation. Can anyone explain me, please?

sentences:
Exporting prefab includes a lot of unneccessary asset dependencies I just exported one of my assets into a unitypackage.
It included all dependencies very nicely so I can use them.

Then I tried another prefab, but it included a lot of unrelated assets from all over the project. This is a very simple prefab and I don't know how the clutter is considered to be dependencies.

When I click "show dependencies" it brings up the clutter in the project menu. There should be no clutter dependencies whatsoever. It really isn't that complex of a prefab.

I also double checked the prefab elements to see if any of them are somehow using the said clutter, they aren't.

How can this happen? Is there a way to solve it (other than selective clicking in export menu)?

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:
At what point of Game Dev pipeline it is good idea to start adding Oculus Rift Support? I am still in pre-dev phase - creating Assets, editing storyline, doing OOP analysis.
I plan to make game in UE 4 and would like for game to have VR support.
Would it be good idea to start right away with Oculus Rift(like "mobile first" approach) or add it when I have working game prototype?
Thanks

sentences:
Voxel river flow simulation I am making a Voxel game and I'd like to add rivers that can be redirected. So I thought that if a player replaces a river block or digs up a block next to a river block the river would repath itself to the sea. The rivers path would have a direction and a speed in that direction.

The rivers path would be determined by these rules:
If the river can go down in its direction it will and then pick up speed.
or if it has a speed under 2 and it can go sideways and down it will and keep its direction. Otherwise it will keep going in its direction until blocked, where it will pick a new direction. If the river can't go anywhere it will fill up the layer its on like a bathtub and go up.
Repeat until it reaches the ocean.

However I can't figure out how you can know what to fill. The data would be stored in some sort of height map. 1 = same level, 0 = down a level, 2 = up a level

For example:

222222
211112
211112
211112
211112
222222

I can tell that the 2s completely surround the 1s meaning that all the 1s should get filled with water if the river goes up. But how can a computer tell?

sentences:
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:
"Optimal" game loop for 2D side-scroller Is it possible to describe an "optimal" (in terms of performance) layout for a 2D side-scroller's game loop?  In this context the "game loop" takes user input, updates the states of game objects and draws the game objects.

For example having a GameObject base class with a deep inheritance hierarchy could be good for maintenance... you can do something like the following:

foreach(GameObject g in gameObjects) g.update();

However I think this approach can create performance issues.

On the other hand all game objects' data and functions could be global.  Which would be a maintenance headache but might be closer to an optimally performing game loop.

Any thoughts?  I'm interested in practical applications of near optimal game loop structure... even if I get a maintenance headache in exchange for great performance.

sentences:
How to calculate area to fill in this Snake/Qix game variant? I have a game which is a Snake/Qix variant.

The player controls a line which is moving on an island. Player has possibility to leave the island in order to connect that island to itself. Once the connection is made, the new area formed by the connection becomes part of the island (see picture: red line is the path the snake has made while outside the island, dark red pixels are the area/island).

I am trying to find a algorithm (even bruteforce) how to fill the new area (in other words how to do transition between first and second line on the picture).

What I have in mind is to run a path finding algorithm between the enter/exit points. If there is a path, it means the snake connect the island to itself. The path (in green) and red line together forms a closed polygon which can then be filled (how ?)

As it is now, the data is simply defined a 2D array of pixels (eg : 0 = empty, 1 = island, 2 = player snake)

sentences:
Calculate mesh normals with added noise I'm creating a procedurally generated planet object in Unity. I start with a cube which is created from 6 meshes (6 sides) and normalize the vertices to get a standard sphere. The problem is that there are visible seams between the meshes. I know if I set the vertex normals to the direction from the center of the sphere to the current vertex then seams will gone but my next step is to add noise to the meshes to generate terrain on the sphere.
What I already tried to remove the seams:

Generating an extra strip around the mesh

Generating an extra strip around the mesh which is located on the adjacent sides

The second solution is almost perfect but seams are still visible a little bit.

When I create the mesh object:

call the built-in RecalculateNormals on the mesh (including the borders)
remove the border vertices, indices and normals
reassign the vertices, indices and normals to the mesh object (excluding the borders)

I use libnoisedotnet to create simplex Perlin noise on the surface:
private MeshData CalculateMeshData()
{
    MeshData meshData = new MeshData();
    meshData.ChunkSize = CHUNK_SIZE;
    meshData.BorderSize = BORDER_SIZE;

    int borderedResolution = meshData.BorderedResolution;
    int vertexIndex = -1;
    float faceWidth = _radius * 2 / CHUNK_SIZE;
    float currentYPosition = -_radius - faceWidth * BORDER_SIZE;

    for (int y = 0; y < borderedResolution; y++)
    {
        float currentXPosition = -_radius - faceWidth * BORDER_SIZE;
        for (int x = 0; x < borderedResolution; x++)
        {
            bool isMeshVertex = !IsBorderVertex(x, y, borderedResolution);
            Vector3 axisAOffset = _axisA * currentXPosition;
            Vector3 axisbOffset = _axisB * currentYPosition;
            Vector3 pointOnUnitCube = _center + axisAOffset + axisbOffset;
            Vector3 vertex = pointOnUnitCube.normalized;
            vertex = vertex * GetElevation(vertex);

            vertexIndex++;
            meshData.AddVertex(vertex, isMeshVertex);

            // Prevents to create more two triangles next to the edge of the mesh.
            if (x != borderedResolution - 1 && y != borderedResolution - 1)
            {
                bool isMeshTriangle = IsMeshTriangle(x, y, borderedResolution);
                meshData.AddTriangle(vertexIndex,
                                     vertexIndex + borderedResolution + 1,
                                     vertexIndex + borderedResolution,
                                     isMeshTriangle);

                meshData.AddTriangle(vertexIndex,
                                 vertexIndex + 1,
                                 vertexIndex + borderedResolution + 1,
                                 isMeshTriangle);
            }

            currentXPosition += faceWidth;
        }

        currentYPosition += faceWidth;
    }

    return meshData;
}

private float GetElevation(Vector3 position)
{
    return 1 + _noise.Evaluate(position) / 10f;
}

Here is the noise library what I tried to use:
https://github.com/SebLague/Procedural-Planets/blob/master/Procedural%20Planet%20E03/Assets/Noise.cs
Is it possible to remove the seams fully?

sentences:
Implementing a multilanguage AI contest platform This is a followup to this question. To sum: I'm implementing an AI contest site, where each user may submit several AI implementations for different games. Think about Google AI Challenge
but instead of just having a big event once a year, I would like it more on a league fashion, with all virtual players playing with each other every some close period of time.

I want to support as many programming languages as possible. I've seen that contest sites (like codeforces) ask you to submit a source code and interact through stdin and stdout. The first question is: what is the best way of supporting multiple languages?

As I see it, I can either ask people to upload some binary/script, and interact either through stdin/stdout, or sockets, or the file system; or ask people to submit source code, and wrap it with whatever is necessary for the interaction. I would like to skip the need to compile the code by myself (in the server, I mean), but I am willing to do it if its the "best" choice. I need to comunicate virtual players with each other, or even better, with some intermediary arbiter.

The second question is regarding security. If I'm going to be running user code in my server, I want to ensure strict security conditions, like no file system access, no networking, etc. Otherwise it would be a safe heaven for hackers.

I will be implementing the engine/arbiter in .NET. I would like to support at least C#, C++, Java and Python for the user's implementations. I'm willing to write interfaces for each of these languages to simplify the user interaction with the system.

Thanks in advance.

sentences: UE4 - Cloth collision How is collision working in UE4 Free Asset Paragon-Kallari? It seems like the body of the character and the cape is somehow colliding but I wasnt able to find any physics asset or any setting. Could someone help me with this?

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:
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:
Frame Skips in MonoGame I'm developing a 2D game using MonoGame. I've got a square on the screen I can move around. The problem is that about once a second, the square jumps a bit. Using a frame counter I found here I've concluded that my FPS drops from 59.9988 to either 59.3988 or 59.6988. It's skipping frames.

I've tried googling and searching forums for hours but can't find a solution. I've commented out everything in the Draw method of the Game class except for the frame counter and it still happens. I even tried creating an entirely new MonoGame project with nothing in it except the frame counter and still I would get the frame skips.

Setting IsFixedTimeStep = true does not fix the issue. I do get higher frame rate, but also not as high as I would expect (not higher than ~100). I've looked at the diagnostic tools and there is no garbage collection going on (no yellow triangles).

I am completely at a loss. If anyone has any insights to offer, it would be much appreciated.

sentences:
Finding the endpoint of a named bone in Irrlicht I'm making a tank game that will have multiple tanks.  I want to be able to define the weapon placements using bones that I can add right inside the modelling program (Blender to be exact).

All tanks will have a bone called Body and a bone called Turret, and then names like Cannon0 and PickupGun for where the shots will be fired from that are attached to the Turret bone.  Is there some way to find the absolute end position of a bone that I choose by name?

sentences:
How can I make a Unity Animation (interpolation from A to B) "procedural", by varying A and B? Goal
One might use a coroutine to interpolate an object's position from point A to point B.
What I'm trying to do is store that interpolation as a Unity Animation file, but have the ability to manually enter points A and B each time it plays.
Description
I have a simple Animation — a "jump", if you will — which I want to chain with the aforementioned interpolation:

the object does a little jump;
mid-air, the object moves/interpolates to another position.

Of course, I could do this by playing the coroutine after the first animation is done, but it'd be cleaner to store both as Animation files and use an Animator Controller to manage them, especially since the 2 animations are technically parts of one whole.
Is that possible?
If so, how could I record/create it? If not, what's a clean alternative?

sentences:
How is load balancing achieved in MMOs? I believe it's a common requirement of MMOs that processing for a single shard or realm can be done over several servers to ease the load. I'm curious as to how this can be done whilst maintaining a unified consistent world where all the players, and all the NPCs can interact.

My question is how is load balancing achieved in MMOs?

Any links, books or general information on how to improve my knowledge on this subject is also appreciated.

sentences:
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 do I set up the microphone for an Android device in Unity? I'm developing a simple android app that needs to use the microphone. I'm able to load my app on my Android phone using developer mode, but I do not understand how to enable the mic. How can I enable the microphone and use the input?

I started with a brand new Unity 2D project. I created a TextMeshPro Text object to display logs and set this reference on the script via the inspector. I have attached the following script to the Main Camera.

using UnityEngine;
using UnityEngine.Android;
using TMPro;

public class RequestPermissionScript : MonoBehaviour
{
    public TextMeshProUGUI logs;

    void Start()
    {
        if (Permission.HasUserAuthorizedPermission(Permission.Microphone))
        {
            // The user authorized use of the microphone.
            logs.text = "has authorized";
        }
        else
        {
            // We do not have permission to use the microphone.
            // Ask for permission or proceed without the functionality enabled.
            logs.text = "has not authorized";
            Permission.RequestUserPermission(Permission.Microphone);

        }
    }
}

I then Build and Run this as Android and the app is loading on my Android phone attached via USB.

I expect a pop-up to appear asking for permissions to the mic, but this does not happen and the logs says "has not authorized". What am I missing or doing wrong?

sentences:
Minecraft Bukkit Rename world and use in Java Plugin I run a Minecraft server (Bukkit 1.7.9) and would like to have a second overworld-like world, into which I can teleport players from my plugin.
I did some testing with the "world" folder:

tried to simply rename the folder, but then a new world is generated on server start (into folder "world")
moved another world with different folder name into the server directory (in addition the original world folder)
tried to change the "level-name" value in server.properties but that does just generate new nether and end folders containing the new name

But in all cases the additional world is not listed when

Bukkit.getWorlds()

is called from the plugin (of course I restarted the server after adding the world).
So now the question is how do I properly rename a world?
I was not able to find something via a search engine nor could I find a file in the world folder that contains the world's name to change it there.

I know that I could use Multiverse or a similar plugin to do what I want but I hope that there is an easier way (like the one i tried).

I hope you can understand everything, sorry that it's not the best English but I'm not a native speaker ^^ .
If I missed to tell you something you need to know please ask :)
If anything else is wrong with this post please tell me as this is my first question posted here.
Any idea or help is appreciated!

sentences:
DirectX function calls' duration Today I downloaded Nvidia Nsight in order to profe my game GPU side and I came across some doubts:

I can't find only any resource of what are the average times for the
different DirectX functions (such as map/unmap, clear the target
view, draw (even if is strongly dependant on shader and similar my
are really basic), ...) and so I can't know if my values are normal
or not. For example for the map function (with write_discard) I've
got an average of 0.8-1 microseconds.
There are always peaks in each function: map() for example goes up to
200 microseconds (randomly and rarely).

Here's a screenshot:

Is it normal?

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:
Unity HDRP transparent material back-face rendering/front face culling I try to render an object with 2 different transparent materials. One should only render the back faces (higher opacity/more color) and one only the front faces (lower opacity/less color). The purpose is to show another object inside the mesh better, while keeping the more saturated color on the back faces.
I tried to only render the back faces using a  shader graph, but it seems to be impossible to only render back faces with TRANSPARENT material. With opaque materials, it was not a problem to isolate the back faces.
Is there a way to only render back faces of a transparent material, and overlap them with another material that only renders front faces?
(btw. this is the model, I need it for. The bones should pretty much preserve their details/color, while the jello is a rich green (screenshot from blender))

Any help is very appreciated!
Thank you!

sentences:
how to make a continuous machine gun sound-effect I am trying to make an entity fire one or more machine-guns.

For each gun I store the time between shots (1.0 / firing rate) and the time since the last shot.

Also I've loaded ~10 different gun-shot sound-effects.

Now, for each gun I do the following:

function update(deltatime):
    timeSinceLastShot += deltatime

    if timeSinceLastShot >= timeBetweenShots + verySmallRandomValue():
        timeSinceLastShot -= timeBetweenShots

        if gunIsFiring:
            displayMuzzleFlash()
            spawnBullet()
            selectRandomSound().play()

But now I often get a crackling noise (which I assume is when two or more guns are firing at the same time and confuse the sound-device).

My question is whether

A) This a common problem and there is a well-known solution, maybe to do with the channels or something, or

B) I am using a completely wrong approach to the task. I had a look at some sound-assets for other games and they used complete burst with multiple shots. I suppose I could try that, but I would like to have organic little hickups in the gun-fire (that's what the random value is for) to make the game more gritty and dirty.

I am using Panda3D, but I had the exact same problem in PyGame and SDL.

[edit]

Thanks a lot for the answers so far! One more problem with faking it though: Now how do I stop the sound? Let's say I have an effect with 5 bangs...

*bang* *bang* *bang* *bang* *bang*

And I magically manage to loop it so that there's no gap or overlap if the player fires more than 5 shots. Now, what do I do if the player stops firing halfway through the third bang? How do I know how long to keep playing the sample so that the third bang is completed and I can start playing the rumbling echo of the last shot?

Of course I can look up the shot/pause timing of that sound-sample and code accordingly, but it feels extremely hacky.

sentences:
Multiple buffering in OpenGL on Windows What is the most common way modern games perform triple buffering ?
What does the SwapBuffers exactly do in terms of OpenGL states ?
Is it possible to perform double and triple buffering independently of window system (for example, by manipulating with glDrawBuffer or by using FBO/PBO) ? If so, any hints ?
Does 3. even make sense in terms of performance and flexibility ?

sentences:
How Can I Fix Where The Tile Spawns? I am making a 3D game in Unity and C#. I want to spawn another tile when the player is at the end of the current tile. But when I spawn the next tile it doesn't spawn at the right place(just after the current tile). How can I fix this?

Thanks

Old Code:

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

public class Terrain : MonoBehaviour
{
    public List<GameObject> objs = new List<GameObject>();
    public GameObject terrain;
    public GameObject player;
    private float z = 4130.875f;
    private float safeZone = 260.0f;
    private float tileLength = 260.0f;
    private int animTilesCount = 2;
    void Start()
    {
        for (int i = 0; i < animTilesCount; i++)
        {
            spawnTile();
        }
    }
    void Update()
    {
        if (player.transform.position.z - safeZone >= (z - objs.Count * tileLength))
        {
            spawnTile();
            DeleteTile();
        }
    }

    public void spawnTile()
    {
        GameObject go;
        go = Instantiate(terrain) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * z;
        Debug.Log(z);
        Debug.Log(Vector3.forward * z);
        Debug.Log(go.transform.position);
        go.transform.rotation = terrain.transform.rotation;
        objs.Add(go);
        z += tileLength;
    }

    public void DeleteTile()
    {
        Destroy(objs[0]);
        objs.RemoveAt(0);
    }
}

That's the position of the current tile.

The correct position for the next tiles would be (6.103516e-05, 3.051758e-05, z).
They have to spawn after the current tile.

sentences:
Conceptual - What is the optimal way to combine steering behaviors with rigid body physics? I am working on a simple 3D space simulator that makes use of the Bullet physics engine. The spaceships are rigid bodies that have a mass and hitbox so that they can be considered for collisions. At the same time, I am trying to implement simple steering A.I. as detailed in numerous tutorials across the web. However, all of these tutorials assume zero-size points in 2D space with no orientation.

For the most part, I have succeeded in implementing the behaviors by applying a force to the rigid body in the direction of desired steering. The spaceship moves, turns, and accelerates smoothly and correctly navigates to the desired position in 3D space:

currentVelocity = body.getLinearVelocity();
tempVector = body.getWorldTransform().getTranslation();
desiredVelocity = targetPosition.sub(tempVector).normalize().scale(maxVelocity);
steeringForce = desiredVelocity.sub(currentVelocity);

body.setGravity(steeringForce); *[see footnote]

However, the spaceship does not change its orientation at all. The problem I am trying to solve is simple - to make the spaceship face in the direction that it is currently travelling.

From my research, it seems that simply setting the orientation of the object to face the direction of its velocity is really bad when using a physics engine because it may cause a rigid body to become stuck inside another one. On the other hand, using a more realistic navigation system based on thrusters is prohibitively (and needlessly) complex because the number of spaceships will be very high.

What is the best way of overcoming this problem?

Edit: Also of note is that the Bullet physics library does not allow setting the orientation of a body.

**Note: I used the function setGravity() instead of applyForce() as suggested by an admin at the Bullet physics forums because applying a force is dependent upon frame-rate. On the other hand, gravity is applied evenly according to Bullet's simulation steps, not to mention that gravity otherwise unused in a space simulator.*

sentences:
Unity UI Animation Transition So I'm fine with gameplay coding, but menus are something I'm still very new to.

I was watching Unity's own video on how to deal with Buttons and I thought I'd try mock up my own button animation much like they had. It works wonderfully, there's just one minor issue.

So a Button can go from 'any state', so either pressed, highlighted or normal (or disabled but I'm not using that). When I hover it works but it'll go straight back to normal once it's 'time'/'cycle' has completed. I figured that to fix this, I ought to add a transition between Highlighted and Normal.

This does work, providing I say that 'Normal' must be true before transitioning between the 2. Here's my issue however - when I click, the button hits pressed fine, then goes back to highlighted, and won't go back to normal unless I just click the background/anything that isn't the Button.

How can I get it to go straight to normal once the mouse is no longer on the button? I thought maybe a trigger collider with OnExitTrigger type function but that seems messy, isn't there a way to do this IN animator?

sentences:
Time reverse mechanism in games I am wondering about how time manipulation mechanisms in games are typically designed. I am particularly interested in time reversing (sort of like in the latest SSX or Prince of Persia).

The game is a 2D top down shooter.

The mechanism I am trying to design/implement has the following requirements:

1) Actions of entities apart from the player character are completely deterministic.

The action an entity takes is based on the frames progressed since level start and/or the    position of the player on the screen
Entities are spawned at set time during the level.

2) Time reverse works by reversing back in realtime.

Player actions are also reversed, it replays in reverse what the player performed. Player has no control during reverse time.
There is no limit on the time spent reversing, we can reverse all the way to the beginning of the level if wanted.

As an example:

Frames 0-50:
Player moves foward 20 units over this time
Enemy 1 spawns at frame 20
Enemy 1 moves left 10 units during frame 30-40
Player shoots bullet at frame 45
Bullet travels 5 foward (45-50) and kills Enemy 1 at frame 50

Reversing this would play back in realtime:
Player moves backwards 20 units during this time
Enemy 1 revives at frame 50
Bullet reappears at frame 50
Bullet moves backwards 5 and disappears (50-45)
Enemy moves left 10 (40-30)
Enemy removed at frame 20.

Just looking at movement I had some ideas about how to achieve this, I thought of having a interface that changed behavior for when time was advancing or reversing. Instead of doing something like this:

void update()
{
    movement += new Vector(0,5);
}

I would do something like this:

public interface movement()
{
    public void move(Vector v, Entity e);
}

public class advance() implements movement
{
    public void move(Vector v, Entity e)
    {
            e.location += v;
    }
}

public class reverse() implements movement
{
    public void move(Vector v, Entity e)
    {
        e.location -= v;
    }
}

public void update()
{
    moveLogic.move(new vector(5,0));
}

However I realised this would not be optimal performance wise and would quickly become complicated for more advance actions (such as smooth movement along curved paths e.t.c.).

sentences: Cause a projectile to wait at the position initially fired for a second before flying off I want to have a projectile that the character fires stay in the same place for a second or two before flying off in the direction of the mouse at the initial time of fire. The character can move away from the projectile after firing it, and the projectile wont move till after the time has passed.

sentences:
How do you determine the amount of moves/turns/lives that should be given to a player? Let's take Candy Crush for example. The player is given 50 turns to complete a certain level.

How is such number determined? Are there educated ways to reach such numbers?

I also presume that these numbers are refined through game updates, but there must be a reasonable starting point to keep the player interested enough without making it extremely difficult or too easy.

Note: I'm only using Candy Crush as an example. I'm looking for general answers to this issue.

sentences:
How to project a Matcap correctly in Amplify Shader Editor Unity's Amplify Shader Editor comes with an example of matcap nodes setup, however, the matcap projection in this example is incorrect.
As you can see the texture becomes distorted when it's on de edges of the screen, that shouldn't happen with a correct matcap:

On the secoud image, this is how a matcap should look, without major distortions.
Does any expert in shaders knows the right way to project a matcap using the nodes? I've done my search and there is absolutelly no information about this around the internet, any response would add for this Shader documentation.
I'm extremelly in need that matcap works with this shader.

sentences:
Resolving prediction error from client side prediction and server reconciliation I am writing a network game based on Gabriel Gambetta's articles on client-side prediction/server reconciliation. I have client-side prediction down (using Box2D for prediction) as well as server reconciliation (setting the predicted entity's physics state back and stepping up to the current client time, applying forces from input every step).

This, of course, results in desync; prediction error. My trouble is figuring out how to correct the prediction error. I've tried snapping 100% to the position from reconciliation, but this looks very jumpy. I've also tried changing the percent of the snapping (10%, 80%, 50%, 30%), but these look jumpy after a short time (since the error keeps increasing, the snap distance increases as well).

I've read that you are supposed to interpolate the current position with the position from reconciliation. But what are you supposed to interpolate between? Prediction occurs every frame, so there's no visual time to interpolate the position unless I send the entity back in rendering time, but that defeats the purpose of client-side prediction. Am I approaching this wrong?

sentences:
Server Side Movement Box2D LibGDX I am trying to implement server-side movement using box2d on libgdx client and planck-js(box2d for javascript)  on nodejs server.
I am running box2d world on both client and server.

Before server i was moving player on client with applying force on input

player.body.applyForce( Vector2(-4.5f, 0f), player.body.worldCenter, true)

Now from client to server i am just sending input data and applying force on server side:

Client if left key pressed:

 var inputData:JSONObject = JSONObject()

            inputData.put("type", "left");
            inputData.put("x", player.body.worldCenter.x);
            inputData.put("y", player.body.worldCenter.y);
            socket.emit("inputFired",inputData)

So server gets this data and applies force code to move player on server side.

    var movePlayer = find_playerid(this.id);
    if (!movePlayer) {
        console.log('player does not exist');
        return;
    }
      console.log(data)
      var positionVector = Vec2(data.x,data.y)
      if(data.type =="left"){
        var impulseVector = Vec2(-4.5,0.0)

      }else if(data.type =="right"){
        var impulseVector = Vec2(4.5,0.0)

      }else if(data.type=="up"){
        var impulseVector = Vec2(0.0,4.5)

      }else if(data.type=="down"){
        var impulseVector = Vec2(0.0,-4.5)

      }
  movePlayer.body.applyForce(impulseVector,positionVector,true)
      movePlayer.x = movePlayer.body.getPosition().x
      movePlayer.y = movePlayer.body.getPosition().y
      console.log("new position")

After this point what is confusing me is what should i really return to client ? If i just return position values of body after applying force,how im gonna position client side body according to this ?

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:
Libgdx optimization of big arrays I am working on a game using libgdx and I have the following code that I want to optimize.

    Array<Bullet> enemyBullets = Enemy2.getEnemyBullets();
    for (Bullet bullet : enemyBullets) {
        c = bullet.getHitBox();
        debugRenderer.circle(c.x, c.y, c.radius, 5);
    }

Basically I just have a big array of objects that I want to preform some action on and I am not sure if this is the best way to do it. I'm not sure if it would be better to use a pool or try to use an iterator instead. I am just not really familiar with these things and I need some help.

sentences: How to draw smooth moving curve in libgdx? i need to draw curve like this picture, I have tried from this link https://github.com/libgdx/libgdx/wiki/Path-interface-&-Splines , but the curve is not so smooth like some game(Amazing Wire) which is already in the market.

sentences:
Stronger Hack-proof MMO Game Comparison: Game Client Based Vs. Via Web Browser I was wondering. I observed most of any MMO that are hack-prone area. Hacks used one-hit kills, stealing accounts, instant level up, aimbots (mostly MMOFPS), and questionable wallers (also in MMOFPS). These hackers might affect the fairness and excitement of the gamers which lead to doubts, abuse kickers (mostly in MMOFPS*, and misunderstandings. Even in MMORPG referred to hacks for instant money for purchase items. I saw these examples via Wikipedia.

This leads me to my question:

Which kind of MMO game platform or model would be best for making MMO games whilst reducing the possibility of hacking?

For example I could make an MMO game for the web browser (by website or via Facebook) or making an MMO game using installers/clients that fetches for patches and graphics that could run only through program via computer. What will help with preventing hacking and how?

In the case of making an installer/client based MMO games, are there anti-hack programs or techniques you can recommend in MMO context?

sentences:
Spawn skateboard under player I would like to know whys in which one can spawn skateboard under player like we see in subway surfers.

My best two guesses are,
1.Spawnning skateboard and then making it child of player.
2.Changing current child prefab of player with skateboard attached prefab.

With first approach ,its get complicated to know exact character's leg position.

What you think is the best way? if you know any other good way then please mention .

Thanks in advance

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:
align local Y to be parallel with global Y during or after slerp I am using the following function to have a globe rotate a point on its surface to face the global Z toward the camera. This works fine, but after each rotation  the Y axis seen as a green line is not vertically aligned.

I believe this is how slerp between two unit vectors works, it takes the shortest path.

I would like to know how can I achieve this rotation whilst getting the globe to rotate itself so that Y is at least parallel to the global Y?

        function rotateToHub(continent){
            var speed = 2000;
            var z = new THREE.Vector3(0, 0, 1);

            point = continent.position.clone().normalize();

            var q = new THREE.Quaternion();
            q.setFromUnitVectors(point, z);

            var duration = {t: 0};
            var tween = new TWEEN.Tween(duration)
                .to({t: 1}, speed)
                .onStart(function(){
                    slerp = true;
                })
                .onUpdate(function(){
                    earthContainer.quaternion.slerp(q, this.t);
                })
                .onComplete(function(){
                    slerp = false;
                    update();
                })
                .start();
        }

sentences:
How can I fade out my overlay in Unity? Something that I can accomplish in 5 minutes in libGDX is taking me forever in Unity. I have a Canvas with a button that covers my entire screen. When the button is clicked, I want the button to fade out and then for the underlying UI to be clickable (if the button is just faded out but it's still on top, you can't click anything).

I tried to use crossFadeAlpha on the Image attached to the button, but the problem is that crossFadeAlpha is async, so I can't do image.enabled = false; when it finishes.

Is there any simple way to accomplish this task in Unity?

sentences:
How can I pass an enum value to the OnClick method of a button? I am making a UI system for my game where I want to use an enum to define different UI modes. But OnClick function on button doesn't show method which receive enums.

I heard I can pass an integer value to OnClick method and then somehow transform it into an enum. What can I do about it?

sentences:
how to move character move on a circular surface in only one direction? Making a 2d game:

I want to move character on circular surface only in one direction?

Script attached to child object is:

    public GameObject ball;
    float speed=2f;

    // Start is called before the first frame update
    void Start()
    {
        GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        Left();
    }

    void Left()
    {
        if(Input.GetKey(KeyCode.LeftArrow))
        {
            ball.GetComponent<Rigidbody2D>().AddForce(Vector3.forward * speed);
            //transform.Rotate(Vector2.left);
        }
    }

Note:
character will move on a circular surface in only one direction...

Image reference:

sentences:
How can I increase the tileset limit in RPG Maker VX? In RPG Maker VX, the default setup allows you to have five tilesets for the map layout.
Is there a way I can increase this limit?

I know it's possible to make "fake" tiles by using events overlaid on the real tiles to show different images. However, this is a huge hassle to setup, and isn't a very clean way of creating the game; I'm hoping there is another way.

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 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:
how to modify shadow mapping in "3D Graphics with XNA Game Studio 4.0"? So I've been following the tutorials from the book Sean James's "3D Graphics with XNA Game Studio 4.0", and have been doing fine until i reached the shadow mapping part.
in this book it creates point lights with a Sphere model.
my first Q is how to draw a directional Light with this frame work?
secondly it can do shadow mapping just for one light,
how can i do shadow mapping for all or parts of the lights in the game?
i just want to know how to modify this codes to do the above tasks.
I've followed tutorials on MSDN and some other sites and didn't got the answer.
please help me, its so urgent.

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:
Phaser: InvalidStateError I am using the Phaser framework for game development, but while working on it I face a bug which is annoying, I have the following message:

  InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable

The consequence is that because of it I now cannot move my hero, I need to first click once on the phaser window and then it worked, so I tried to debug it, and even by using the default phaser demo the same error message appear and cause the same but, so i concluded that my code is not the problem.

Do you please have any idea? Is there a way to know how to fix it ? Otherwise  how can have more details about it in the console?

Note: if you wanna download the official starting tutorial to reproduce the error:

Download .zip: here
Beginner Tutorial: here

sentences:
Push or Pull Input Data In the Game Logic? In the process of preparing my game for networking I'm adding a layer of seperation between the physical input (mouse/keyboard) and the actual game "engine"/logic. All input that has any relation to the game logic is wrapped inside action objects such as BuildBuildingAction.

I was thinking of having an action processing layer that would determine what to do with the input. This layer could then be set up to either just pass the actions locally to the game engine or send it via sockets to the network server depending on whether the game was single- or multiplayer.

In network games it would make sense that the player's actions should be sent to the server, but should the game logic be pulling (polling?) the data through some sort of interface or should the action processing layer be adding the actions to an input queue in the game logic code?

sentences:
How do I edit a Texture2D at run-time to visually indicate connected tiles? I'm making a 2D sandbox game in C# and MonoGame, and I have a couple of tile sprites. These tile are loaded in-game as Texture2Ds. I want to have blocks visually connect to adjacent blocks.

An example:

This is how a tile would look if it was connected to another tile to its right side:

Here's if all of its sides were connected:

If none of its sides were connected at all:

I think you see the idea. Starbound and Terraria do a similar thing.

I don't want to have like 10 different textures for each block for every combination of every side, as that needlessly takes up space.

What can I do in the code to edit my existing sprites to look like this? Am I just better off going with 10 different textures? Or maybe there's something better I've missed?

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:
Why does Physics2D.Raycast automatically fail if applying a layer mask? I have been troubleshooting a problem I have encountered with some of my raycasts, and have arrived at a perplexing brick wall. I fire a Physics2D.Raycast in order to determine if my character is grounded; however, it would not always return a reference to the ground object in situations where it should.

Breaking down the method call, I have fired a raycast without a layer mask. This returns the correct reference; I then send the layer mask associated with the reference transform to the debug log.

public void FireTestRay()
{
    RaycastHit2D hit = Physics2D.Raycast(startPosition, Vector2.down, 0.1f);
    Debug.Log(hit.transform.gameObject.layer);
}

  8

I want to be checking against my platform objects, which I have proven to contain the layer index of 8. However, when I use layer masks, the raycast fails.

public void FireTestRay()
{
    RaycastHit2D hit = Physics2D.Raycast(startPosition, Vector2.down, 0.1f, 8);
    Debug.Log(hit.transform.name);
}

  NullReferenceException: Object reference not set to an instance of an object

I am not moving my game object; in fact, the only thing that changes at all is the above mentioned lines of code.

I seem to be able to successfully hit the intended object if I do not use a layer mask, and in turn, can successfully retrieve the value of the intended objects layer mask. As soon as I filter my raycast to only hit that layer mask, it fails.

Why does Physics2D.Raycast automatically fail if applying a layer mask?

sentences:
Centering an animation [libGDX] I have the following class:

public class AnimationDemo implements ApplicationListener {
    private SpriteBatch batch;
    private TextureAtlas textureAtlas;
    private Animation animation;
    private float elapsedTime = 0;
    private OrthographicCamera camera;
    private int width;
    private int height;
    private int texturewidth;
    private int textureheight;

    @Override
    public void create() {
        width = Gdx.graphics.getWidth();
        height = Gdx.graphics.getHeight();
        camera = new OrthographicCamera(width, height);
        camera.position.set(width / 2, height / 2, 0);
        camera.update();

        batch = new SpriteBatch();
        textureAtlas = new TextureAtlas(Gdx.files.internal("data/packone.atlas"));

        textureAtlas.getRegions().sort(new Comparator<TextureAtlas.AtlasRegion>() {
            @Override
            public int compare(TextureAtlas.AtlasRegion o1, TextureAtlas.AtlasRegion o2) {
                return Integer.parseInt(o1.name) > Integer.parseInt(o2.name) ? 1 : -1;
            }
        });

        animation = new Animation(1 / 15f, textureAtlas.getRegions());

    }

    @Override
    public void dispose() {
        batch.dispose();
        textureAtlas.dispose();
    }

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

        batch.begin();
        elapsedTime += Gdx.graphics.getDeltaTime();
        batch.draw(animation.getKeyFrame(elapsedTime, true), 0, 0);
        batch.end();
    }

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

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }
}

In the above I am using the Animation class to simply draw from a texture atlas. I am following an example from another SO question which is here but the co-ordinates don't fit my equation. How should I set these:

private int texturewidth;
private int textureheight;

Any help would be great :)

sentences:
How to decide face side of sprite I am just starting game-dev with slick2D and marte engine. When I move my sprite left and right, I am doing walk animation but when the key is released how can I decide in which side the sprite face to set?

Here's the relevant code:

    Input ip = gc.getInput();

    if (ip.isKeyDown(Input.KEY_RIGHT))
    {
        this.currentAnim = "Anim2";
        System.out.println("down");
        x += 0.1f * delta;
    }

    if (ip.isKeyDown(Input.KEY_LEFT))
    {
        this.currentAnim = "Anim4";
        System.out.println("down");
        x -= 0.1f * delta;
    }

sentences:
Unity Pixel Perfect Camera - Adjusting the Viewport Rect? I am trying to make a pixel perfect Tetris style game.
I have the pixel perfect component attached and have tried playing with settings such as Crop Frame and Stretch Fill. It seems to override any setting made to the 'Viewport Rect'.
The problem here is I want to control where the play-area is shown on the screen. For example I want the single player game to be somewhere near centre (although preferrably slightly off to the left). But when they play 2-Player mode I want the P1 playarea to be near left, and P2 area at the right.
The screens below shows some of the settings I tried. The 3rd screen shot shows the play area approaching what I want, but I am unable to move it left to right for example (Im unable to move it at all).
(Also note, if I try leaving CropFrame and StretchFill unchecked my Camera Size value is also overridden).
I even tried to 'extend' the Pixel Perfect Camera class but haven't been able to do that, I'm starting to wonder if this is just a limitation of using this component and perhaps I would need to write my own implementation of the pixel perfect camera to achieve the full control I need.
UPDATE: Actually I am able to extend the Pixel Perfect Camera class by 'using UnityEngine.U2D'. So far this is what I am trying whilst I wait in hope of further help (It seems like a lost cause extending the class, because I am not sure I can override much from it and cannot see the code. I can't find a way to set the Viewport X or similar). All the best everyone!
Thanks for any help.

sentences:
Doing an SNES Mode 7 (affine transform) effect in pygame Is there such a thing as a short answer on how to do a Mode 7 / mario kart type effect in pygame?

I have googled extensively, all the docs I can come up with are dozens of pages in other languages (asm, c) with lots of strange-looking equations and such.

Ideally, I would like to find something explained more in English than in mathematical terms.

I can use PIL or pygame to manipulate the image/texture, or whatever else is necessary.

I would really like to achieve a mode 7 effect in pygame, but I seem close to my wit's end. Help would be greatly appreciated. Any and all resources or explanations you can provide would be fantastic, even if they're not as simple as I'd like them to be.

If I can figure it out, I'll write a definitive how to do mode 7 for newbies page.

edit: mode 7 doc: http://www.coranac.com/tonc/text/mode7.htm

sentences:
Why is my image speed not changing? Following is my code for my platformer. However, in the //Run with left shift// section when I made the image speed change, the speed is still the same and doesn't change so is there any piece of code that is preventing this task?

///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)

//Run with left shift
if (keyboard_check(vk_lshift))
{
 movespeed = 5;
 image_speed = 0.14;
}

if (keyboard_check_released(vk_lshift))
{
 movespeed = 3;
 image_speed = 0.025;
}

//Shooting direction
if (keyboard_check(vk_right))
{
 mpfacing = 0;
}

if (keyboard_check(vk_left))
{
 mpfacing = 180;
}

//Shooting
if (keyboard_check(ord("D"))) && (canshoot = true)
{
 instance_create(x+13, y-0.5, Obj_MP_Laser);
 canshoot = false;
 alarm[1] = 30;
}

//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.05;
 }

 else
 {
  sprite_index = CalvinStanding;
  image_speed = 0.025;
 }
}

else
{
 if (vsp < 0) sprite_index = CalvinJumping
 else sprite_index = CalvinJumping
}

sentences:
How do I make my main character move towards an object? LibGDX/Java What I want to happen is for my player to bounce from spring to another. For example take the illustration below:

Here's my code (what I've tried to do so far). This gets called in an update()method

public void springCollision(Box containsSpring) {
        // player object
        Player player = ((Player) this.object);
        // first spring
        Spring boxSpring = containsSpring.getSpring();
        // second spring
        Spring platformSpring = containsSpring.getPartnerPlatform().getSpring();
        // if player collides with first spring
        if (player.getRect().overlaps(boxSpring.getRect())) {
            // distance in x between first & second spring
            float dx = platformSpring.getxPos()
                    + platformSpring.getSprite().getWidth()
                    - boxSpring.getxPos() - player.getSprite().getWidth();
            // distance in y between first & second spring
            float dy = platformSpring.getyPos() - boxSpring.getyPos();
            Vector2 directionToSpring = new Vector2(dx, dy);
            // normalise vector then set player speed
            player.setxSpeed(directionToSpring.nor().x);
            player.setySpeed(directionToSpring.nor().y + player.getGravity());
        }
    }

What currently happens is that when he jumps onto a spring his jump just continues but in slow motion for some reason. Can anyone see why my algorithm doesn't work? Let me know if the comments are unclear

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:
Wall-Sliding, Stuck at Corners I am having trouble with my 2-D wall-sliding.  Namely, when the player avatar collides with the wall, it "snaps" to the corner (see screenshot, below) and sticks there.  The red, transparent rectangle is my "wall":

My code is as follows:

"FootRectangle" is your standard xna rectangle. Location is a vector2.  The player is moving to a target, which could be anywhere on the screen, which is also a vector2.

 if (wall.CollisionRectangle.Intersects(player.FootRectangle))
            {

                // collision above block
                if (player.FootRectangle.Top <= wall.CollisionRectangle.Top)
                {
                    player.Location = new Vector2(player.Location.X, wall.CollisionRectangle.Top - player.FootRectangle.Height / 2);
                }

                // collision below block
                else if (player.FootRectangle.Bottom >= wall.CollisionRectangle.Bottom)
                {
                    //player.FootRectangle.Y = block.CollisionRectangle.Bottom;
                    player.Location = new Vector2(player.Location.X, wall.CollisionRectangle.Bottom + player.FootRectangle.Height / 2);
                }

                // collision left of block
                if (player.FootRectangle.Left <= wall.CollisionRectangle.Left)
                {
                    player.Location = new Vector2(wall.CollisionRectangle.Left - player.FootRectangle.Width / 2, player.Location.Y);
                }

                // collision right of block
                else if (player.FootRectangle.Right >= wall.CollisionRectangle.Right)
                {
                    player.Location = new Vector2(wall.CollisionRectangle.Right + player.FootRectangle.Width / 2, player.Location.Y);
                }

How can I resolve these collisions so that the avatar snaps to a corner and smoothly makes his way to the target destnation?

I attempted to implement a similar solution to that at this post; however, it seemed to stick when the collision occurred.

sentences:
How I can get the time, where I am in a map for osu? How I can get the time, where I am in a map for osu???

I need an osu!api solution, and I want to get this value:

0:05.12

or something like this.

sentences: 3D motorcycle models for web 3D tools I'm developing a website that can display 3D models of motorbike. I haven't decided on which tool to use yet but it seems most of them support X3D and VRML files. So I'm searching for already-made models in either format but got no result so far, anyone know where I can find one? Thank you.

sentences:
What are the requirements for a sound file in android? I am creating a game in Android and eventually I am going to outsource the sound effects. I have a few place holder sounds for testing and I have noticed a problem.  I have an OGG sound file which plays correctly through the emulator/headphones but when I put it on my phone it doesn't play.  Putting my ear right up to the speaker I can hear a faint crackle.

So what are the requirements for a mobile sound file?  Frequency, format, etc.

sentences:
Why circles are not created if small? I have changed the scale in 3DSMax to my own and now I can't create any object, including circle, if it is of the size which is normal for my scale. Instead, I have to create big object first and then modify it to a smaller size. It looks like there is a minimal size protection is set somewhere - where is the setting for it?

UPDATE

While creating a circle, if I drag for 0.04m circle disappears after drag end. If I drag for 0.08m circle also disappears. If I drag for more than 0.1m, circle persists after drag end.

How can I set it so that it persist after 0.01m too?

sentences:
How to handle netcode? I'm interested in evaluating the different ways that the netcode can "hook into" a game engine. I am designing a multiplayer game now, and so far I have determined that I need to (at the very least) have a separate thread to handle the network sockets, distinct from the rest of the engine which handles the graphics loop and scripting.

I did have one potential way to make a networked game entirely single-threaded, which is to have it check the network after rendering each frame, using non-blocking sockets. However this is clearly not optimal because the time it takes to render a frame is added to the network lag: Messages arriving over the network must wait until the current frame render (and game logic) completes. But, at least this way the gameplay would still remain smooth, more or less.

Having a separate thread for networking allows the game to be completely responsive to the network, for instance it can send back an ACK packet instantly upon receipt of a state update from the server. But I'm a little confused about the best way to communicate between the game code and the network code. The networking thread will push the received packet to a queue, and the game thread will read from the queue at the appropriate time during its loop, so we haven't gotten rid of this up-to-one-frame delay.

Also, it seems like I would want the thread which handles the sending of packets to be separate from the one that is checking for packets coming down the pipe, because it wouldn't be able to send one off while it is in the middle of checking if there are incoming messages. I am thinking about the functionality of select or similar.

I guess my question is, what's the best way to design the game for the best network responsiveness? Clearly the client should send user input as soon as possible to the server, so I could have net-send code come immediately after the event processing loop, both inside of the game loop. Does this make any sense?

sentences:
Data for bingo tickets Is there a data source for 90 and 75 ball bingo tickets? rather than coding to generate the tickets myself just trying to find a source to save me the time.

Many thanks

sentences:
How to correctly represent a bone system? I'm currently representing my bone system as follows, in pseudocode:

root = {}
root.rot = v3(0,0,0)
root.pos = v3(0,0,0)

function create_child(parent,rot,length):
    child_bone = {}
    child_bone.rot = parent.rot + rot
    child_bone.pos = parent.pos + v3(0,0,bone.length).rotate(child_bone.rot)

This works for most situations, but sometimes I get weird occasions where rotating a parent bone makes the child bones rotate wildly. What is the proper mathematical representation of a bone system?

sentences:
storing game options in java I'm making a game using java. I'm wondering what would be the best way to store games options (like screen height and width, full screen boolean and many other similar options the user can select) at run time?

Currently, I read the options from a text file so everything that comes out of the reader is a string. I would like to add the value of the string to the appropriate variable in as few steps as possible. I would also avoid having to code getters and setters for all variables there is and have a general getter and setter that takes the name of the option as a parameter.
ex:

    public void set(String name, Object value){
        options[name] = value;
    }

    public Object get(String name){
        return (Object options[name]);
    }

I was thinking about a hashmap of variable names and values but the problem is: not all variables are of the same type, I'll have ints and doubles and booleans. so what would be the best way to store all those different variable types and access them with general calls? Should I leave them as Object and cast them as I need to use them? Or do i really have to set them all manually in my code (which would be quite the hassle should i decide to add more options down the line)?

UPDATE: So, here's the code i got so far for serialization but still not working:

Options.java:

public class Options implements java.io.Serializable{

//Final variables declaration
static transient final String SAVE_DIR = System.getProperty("user.dir") + "\\res\\saves\\";
static transient final String OPTION_FILE = "options.ser";

//Static variables declaration
public int s_width;
public int s_height;
public float fov;
private static transient Options instance;

private Options()
{
    this.s_width = (this.s_width == 0)? 800 : this.s_width;
    this.s_height = (this.s_height == 0)? 600 : this.s_height;
    this.fov = (this.fov == 0)? 60 : this.fov;
}

public static Options GetInstance()
{
    if(instance ==  null)
        instance = new Options();
    return instance;
}

Serializer.java:

public class Serializer {
private static Options o = Options.GetInstance();

    public static void loadOptions()
    {
        File dir = new File(Options.SAVE_DIR);
        if(dir.exists())
        {
            File file = new File(dir + "\\" + Options.OPTION_FILE);
            if(!file.exists())
            {
                saveOptions();
            }

            try {
                FileInputStream fileIn = new FileInputStream(file);
                ObjectInputStream in = new ObjectInputStream(fileIn);
                o = (Options) in.readObject();
                in.close();
                fileIn.close();
            } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }
        }
        else
        {
            dir.mkdir();
            saveOptions();
        }
    }

    public static void saveOptions()
    {
        File dir = new File(Options.SAVE_DIR + "\\" + Options.OPTION_FILE);
        try {
            if(!dir.exists())
            {
                dir.createNewFile();
                o = Options.GetInstance();
                System.out.println("otpion.ser created and initialised succesfully!");
            }
            FileOutputStream f = new FileOutputStream(dir);
            ObjectOutputStream out = new ObjectOutputStream(f);
            out.writeObject(o);
            out.close();
            f.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

sentences:
How can I make a player-interactable bookshelf? In the player's house Interiors->WhiterunBrezeehouse (FormID 000165A8) I duplicated a bookshelf (CommonShelf03 FormID 000ce784 near the fire pit) and the book proxies, container, triggers, collision boxes, et cetera.

When I enter the house the duplicated book shelve is there and it shows the "E to interact" text, but when I press E nothing happens (I'm supposed to get up the book shelf manager).

Any clue of what it might be? What do I need to support proper interaction between a player and the shelf?

sentences:
What is the convention for column-major order matrix transformations? According to this cheat sheet for CG, if I want to use column-major order for my matrix/vector math I have to multiply from the left applying transformations from right to left, i.e. v' = P * V * v

I built my view and projection matrices like this

Matrix44 view(right.x, right.y, right.z, -position.x,
              up.x, up.y, up.z, -position.y,
             -forward.x, forward.y, forward.z, -position.z,
              0.0f, 0.0f, 0.0f, 1.0f)

Matrix44 projection(Sx, 0.0f, 0.0f, 0.0f,
                    0.0f, Sy, 0.0f, 0.0f,
                    0.0f, 0.0f, Sz, Pz,
                    0.0f, 0.0f, -1.0f, 0.0f);

However, when using them in the vertex shader

gl_Position = projection * view * vec4(position, 1.0);

I cannot see my geometry unless I swap the transformation to

gl_Position = vec4(position, 1.0) * view * projection;

which means that I am using row-major order instead of column order. So my question is if the pdf I'm following is correct in the notation for the column-major order for view and projection matrices or what am I missing?

sentences:
How do I export a Java project on Eclipse as an executable? I made a Java project with images, external JARs, and natives(the JARs and natives are for LWJGL and Slick). How can I export this as an executable? I already tried JarSplice and WinRun4J, but when I run the executable, nothing happens. Why?

EDIT: There are also sound files and TrueType fonts.

sentences:
Assigning optimal jobs to entities based on travel distance I'm hoping there is a standard algorithm for this problem, but I don't even know what to search for.
Let's say you have a collection of entities (people, vehicles, whatever), in random locations. And you have a collection of jobs to be done, also in random locations. How do you assign each one a job where they have the least distance to travel?

For example, several entities may have the same travel distance to job A, but only a few of those are closer to job B, making them less of a candidate for job A.
Or, entity 1 is currently headed to job A, but entity 2 just spawned and they're even closer to job A, so entity 1 should switch to job B since they are closer to it than entity 2 is.

Seems like a lot to untangle, where would I start in structuring this?

sentences:
Constraining camera bounds within bounds based on Unity UI object dimensions I have a perspective camera which has bounds which I wish to constrain within larger bounds.  All the bounds are calculated in world space.

The code for containing the camera within the constraining bounds is straightforward:

        var camRect = this.cameraComponent.GetCameraWorldRect();
        var correction = Vector3.zero;

        if (camRect.xMin < constrainingRect.xMin)
        {
            correction.x += Mathf.Abs(constrainingRect.xMin - camRect.xMin);
        }

        if (camRect.xMax > constrainingRect.xMax)
        {
            correction.x -= Mathf.Abs(constrainingRect.xMax - camRect.xMax);
        }

        if (camRect.yMin < constrainingRect.yMin)
        {
            correction.y += Mathf.Abs(constrainingRect.yMin - camRect.yMin);
        }

        if (camRect.yMax > constrainingRect.yMax)
        {
            correction.y -= Mathf.Abs(constrainingRect.yMax - camRect.yMax);
        }

        this.cameraComponent.transform.position += correction;

This can be visualized as:

The problem I am facing is that I have a UI object that is covering the right hand side of the screen and I am uncertain how to correctly calculate the width of the UI object so that the constrained camera bounds can take it into account.

The camera that is drawing the UI object is configured as follows:

The camera that is being constrained is configured as follows:

Apart from the layer, the parameters which affect the rendering of the objects for each camera configuration are the same.

The UI object has the following configuration with a Canvas Renderer:

This is how I am currently attempting to calculate to width of the UI object but given that the UI is being rendered using a perspective camera I wasn't too certain that ScreenToWorldPosition was correct.

    private float CalculateMenuWidth()
    {
        // Generate padding to account for the side menu
        var canvas = LevelEditor.Instance.Menu.GetComponentInParent<Canvas>();
        var menuRect = LevelEditor.Instance.Menu.GetComponent<RectTransform>();
        var menuRectMax = menuRect.rect.max * canvas.scaleFactor;
        var menuRectMin = menuRect.rect.min * canvas.scaleFactor;

        if (this.cameraComponent.orthographic)
        {
            return Mathf.Abs(this.cameraComponent.ScreenToWorldPoint(menuRectMax).x - this.cameraComponent.ScreenToWorldPoint(menuRectMin).x);
        }

        // Perspective camera requires distance for ScreenToWorldPoint
        var distance = Mathf.Abs(this.cameraComponent.transform.position.z);

        return Mathf.Abs(this.cameraComponent.ScreenToWorldPoint(new Vector3(menuRectMax.x, 0f, distance)).x - this.cameraComponent.ScreenToWorldPoint(new Vector3(menuRectMin.x, 0f, distance)).x);
    }

However, the size of menu returned by the method above appears to be too large.

How can I correctly calculate the width of the UI object so it appears that the camera constraints do not allow the camera to travel past the UI object?

EDIT: I've added a link to a Unity project which is the minimal working example for reproducing the issue.

https://www.dropbox.com/s/mq36mfqz5wvvsch/CameraConstraintGUIIssue.zip

The camera can be controlled with WASD to translate and the Shift key will speed up the movement.

The camera is constrained inside the checkerboard.  An offset is created so that the camera should stop moving to the right once the right edge of the checkerboard is adjacent to the left edge of the menu.  Unfortunately, I can't seem to calculate the size of the menu correctly so this occurs.

The code for constraining the camera and calculating the menu size is in EditorCamera.cs.

Edit2:

The constraint from KingDolphin

The constraint I am attempting to calculate (quoted from above, An offset is created so that the camera should stop moving to the right once the right edge of the checkerboard is adjacent to the left edge of the menu.):

sentences:
Black screen when trying to render multiple textures I generate an array for two textures:

int[] textureID = new int[2];
glGenTextures(1, textureID, 0);
glGenTextures(1, textureID, 1);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureID[0]);
glBindTexture(GL_TEXTURE_2D, textureID[1]);

Render:

int Position = glGetAttribLocation(Shader.program_Image, mPosition);
glEnableVertexAttribArray(Position);
glVertexAttribPointer(Position, 3, GL_FLOAT, false, 0, vertexBuffer);
int TexCoordLoc = glGetAttribLocation(Shader.program_Image, atexCoord );
glEnableVertexAttribArray (TexCoordLoc);
glVertexAttribPointer (TexCoordLoc, 2, GL_FLOAT, false, 0, uvBuffer);
int mtrxBackground = glGetUniformLocation(Shader.program_Image, mbackground);
int mtxObj = glGetUniformLocation(Shader.program_Image, mobj);
glUniformMatrix4fv(mtrxBackground, 1, false, m, 0);
glUniformMatrix4fv(mtxObj, 1, false, m, 0);
int mSamplerLoc = glGetUniformLocation (Shader.program_Image, bTexture);
int mSamplerLoc1 = glGetUniformLocation (Shader.program_Image, sTexture);
glUniform1i (mSamplerLoc, 0);
glUniform1i(mSamplerLoc1, 1);
glDrawElements(GL_TRIANGLES, background.getIndices().length, GL_UNSIGNED_SHORT, drawListBuffer);

My fragment shader is like this.

precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D b_texture;
uniform sampler2D s_texture;
void main() {
    gl_FragColor = texture2D(b_texture, v_texCoord );
    gl_FragColor = texture2D(s_texture, v_texCoord );
}

I have no error message, but when I run the application, I only see a black screen.

The app runs correctly with just one texture, but doesn't with more than one. What's wrong in my code?

Do I have to add another set of coordinates and update the vertex shader? Because I have only one “rectangle” constructed from two triangles.

sentences: How to remove horizontal black bar at the bottom of the game screen in libgdx? Here is the screenshot .Here is my Play constructor in Play class.

sentences:
Creating runtime mesh colliders for roads in Unreal Engine 4 I want to create several mesh colliders in game at runtime. By mesh colliders I mean "complex collision".

The meshes are for curved roads. The roads will be rendered using hierarchichal instanced static mesh, the visible road meshes will be high poly detailed meshes. For collision purpose I will create simple low poly meshes at runtime and I want collision checks for them.

I also want these meshes to be stored in single actor for easy handling.

Is there any existing class or plugin that does this, or a way to implement it myself? I have checked procedural mesh component and runtime mesh component but they don't seem to have what I want.

sentences:
iOS: controlling size of assets designed in Cinema 4D when importing into Xcode? A designer provided the attached two DAE files created in Cinema 4D. The characters in these DAE files are to be integrated into an iOS game.

Both assets are of comparable size inside of Cinema 4D. Both DAE files were produced with the same export process.

Importing the DAE files into a SceneKit scene, however, produces different results.

Chango.dae imports at a "normal" size with a bounding box of ~3x4x3.

Tiki.dae imports at a huge size with a bounding box of ~155x325x140. Its dimensions inside Cinema 4D is 122x283x142.

Questions:

1) How do you make sure assets "fit" into a SceneKit scene? Are you supposed to scale down assets with the "scale" property of the SCNNode, or are you supposed to ask the designer to make the asset of a certain size? In SpriteKit and UIKit, this is straightforward. The asset size correlates directly to its screen size (e.g., 20x20 icon takes about that much screen space depending on resolution). However, what's the analog for SceneKit? If you want an asset to fit into a 1x1x1 SCNNode, what size do you ask the designer to make the asset?

2) If your asset is too large for a scene, how do you scale it down? In UIKit, for instance, you can scale an image to fit a UIView with something like ScaleAspectFit. There doesn't seem to be an analog for a SCNNode. Using the SCNNode's scale property changes the appearance, but doesn't change the asset's bounding box. And even changing the appearance isn't precise. For instance, with Tiki.dae, the original height of the asset (as shown by the bounding box) is 324.36. If you set the Y-scale to 0.01, however, the height doesn't become ~3.24. It becomes smaller than 3, which you can prove by fitting it comfortably within a sphere of height 3 (radius of 1.5).

sentences:
Rotating a GUI.Label relatively Learning Unity for 2D development, I want to create a text label.

So far, I have been using GUI.Label to write the text. It is above my sprite:

I would like to rotate the label relatively to the monster. In other words:

How can I achieve this? I have a feeling that OnGUI() is probably the wrong solution.

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:
Rotate entity to match current velocity I have an entity in 2D space moving around, lerping between waypoints. I would like to make the entity rotate around its own origin to face the current direction that it is going, I.E. towards the next waypoint in the list.

In case the waypoint movement code is needed, I'm using the following (this is contained inside of the entity that is following the waypoints) :

    private void GoToWaypoint() {
        if (waypointList.Count > 0) {
            Vector2 origin = helper.GetOrigin(position, width, height);
            int nodeWidth = 50;
            int nodeHeight = 50;

            if (moveToPosition != waypointList[0]) {
                moveToPosition = waypointList[0];
                moveToPositionOrigin = helper.GetOrigin(moveToPosition, nodeWidth, nodeHeight);
                distanceToPosition = moveToPositionOrigin - origin;
            }

            if ((Math.Ceiling(distanceToPosition.X) < 0)) {
                position.X -= moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X + moveSpeed);
            }
            else if ((Math.Floor(distanceToPosition.X) > 0)) {
                position.X += moveSpeed;
                distanceToPosition.X = (int)Math.Round(distanceToPosition.X - moveSpeed);
            }

            if (Math.Ceiling(distanceToPosition.Y) < 0) {
                // Check if the entity moves below the top boundary
                if (position.Y > 0) {
                    position.Y -= moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y + moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }
            else if (Math.Floor(distanceToPosition.Y) > 0) {
                // Check if the entity moves below the bottom boundary
                if (position.Y < 550) {
                    position.Y += moveSpeed;
                    distanceToPosition.Y = (int)Math.Round(distanceToPosition.Y - moveSpeed);
                }
                else {
                    distanceToPosition.Y = 0;
                }
            }

            // If the entity gets in the waypoint, or the distance to the waypoint is 0 on both axis (which can occur due to screen boundaries)
            if ((helper.InNode(position, moveToPosition, width, height, nodeWidth, nodeHeight)) || ((distanceToPosition.X == 0) && (distanceToPosition.Y == 0))) {
                waypointList.RemoveAt(0);
            }
        }
    }

I know this may have been asked elsewhere, and the bit of searching that I did on this type of problem, didn't really help me. I'm slightly math retarded, so I don't understand the explanations that don't really explain what the math is exactly achieving. So any help that breaks down the math and functions needed to achieve this would be greatly appreciated.

Thanks.

sentences:
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:
What technical questions do you need to be prepared to answer before presenting an idea to venture capitalists? A friend and I are planning on pitching an idea to venture capitalists in a few weeks at SIEGE 2010. He is handling the business plan side of things and all those related questions so I only need technical questions here. What types of things should I be prepared to answer about our project?

For reference its an economic game for mobile platforms(targeting android to start with).

EDIT-CLARIFICATION: I am aware that they may be more interested in non-technical questions, but my friend is handling that end. I am mainly concerned with technical questions as he should be able to field most of the rest.

sentences:
How to get light level (brightness) of a particular location? I'm making a 2D top-down survival game similar to Rimworld, I'm trying to emulate a day-night system.
Many features depend on whether any tile is light (or dark) enough, based on time of day or other light sources such as torches, so I'm wondering if there's an easy way to detect how much light there is on a certain tile without making a whole system that tracks light on a per-tile level (or maybe the latter option is better)?
I am using Unity 2020.3.6f1 and the URP, which means I'm going to be using the 'new' 2D lights.
EXAMPLE:
When it's nighttime, I'm going to disable the global light (sun) so those tiles will be pitch black.
When it's daytime, the global light will have an intensity of 1 so that tile will have 100% brightness (look normal).
When it's nighttime, but there's a torch, the tile where the torch is sitting on will have 100% brightness, and that will slowly fade to 0% over a span of 5 tiles.
Making a system that updates every single tile in the game with information about the light level seems pretty expensive. Is there a way we can observe a block "graphically", or in other words, literally look at the pixel on the screen, and determine it's alpha value to check for light level?
Any suggestion is super welcome.
EDIT:
Every tile does not need to know its brightness every frame, but they do need to know it less often. Some examples are:

A plant checking every couple of frames to see if it can grow
A character checking every couple of frames to see if he's in the dark (and if he is, he needs to start panicking)

More importantly, I need my characters to make decisions based on light amount. For an example, if there is a job that needs to be done at a certain location, a character should first check the light level of that location before going to do it.

sentences:
Unity Moving and rotating part of a model I have downloaded a high quality head model which includes the shoulder, and I have want to move and rotate the head model, but its shoulder fixed, as if it is looking at the certain points that I have as list. I am not sure what is the best way to implement this -- should I split the model into two parts with blender, and just move the head model? Or should write a script that only moves the part of the model. If I write a script, how do I locate specific vertices in the model(in my case, the tip of the nose would be best) to follow the coordinates in the list, and how do I specify other vertices in meshes that needs to be follow the change so that the movement would look natural?

Thank you!

sentences:
Is there a tool to help quickly define animation frames from non-uniform size sprite sheets? Many of the sprite sheets online have non-uniform sized rectangles as the animation frames and often use a portion of the image for credits, etc., this makes it hard for a game engine to correctly clip the sheets.

Is there any tool that can help you quickly define frames in a sheet, export animation data which the game engine would use?

sentences:
Things to do to port game made for iOS in Unity to Android? I have just made my first game for iOS and submitted it to app store. I was thinking of porting my game to Android also. I would like to know things one need to do/remember to port game made for iOS in Unity to Android. How to handle different screen resolutions and pixel densities, optimizations required, etc. Any other suggestions and important things you think I should know?

EDIT:
Also, should I handle builds according to device resolutions or by pixel density?

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:
Restarting a game be resetting an object In a game I made, I want to restart the game when the players presses a button.

I have an instance of a Game class, which is where most of the game happens.

I though that I could simply initialize it again, and it will be reset.

Game game = new Game(); - When the program launches.
game = new Game(); - When restarting the game.

But the game uses a lot of additional classes, such as Tank and Missile. Do I have to initialize all of them too, or is initializing the Game class, which will create new Tank objects and Missile objects (with the same reference names as the previous Game instance), enough?

In general, what would be the best way to reset a game or a level in a game?

Thanks

sentences:
Confused about Content Pipeline I'm attempting to get my head around the XNA content pipeline, and how I can use it to simplify my game code. Specifically, I want to define sprites, sprite sheets, and animations as assets and have them automatically available to me in game code.

At the end of the day, this is what I want to be able to do:

add a new file with .sprite extension to my content project
call contentManager.Load<Sprite>("NameOfSprite"); and get back a Sprite instance

My Sprite class looks like this:

public class Sprite
{
    public Texture2D Texture
    {
        get { ... }
    }

    public Rectangle? SourceRectangle
    {
        get { ... }
    }

    public Vector2 Origin
    {
        get { ... }
    }
}

The purpose of the Origin property is not important - it's specific to my game. The point is, I want it to be "packaged up" alongside the texture information.

I've defined a SpriteData class as:

public sealed class SpriteData
{
    public string TextureFilename
    {
        get;
        set;
    }

    public Rectangle? SourceRectangle
    {
        get;
        set;
    }

    public Vector2 Origin
    {
        get;
        set;
    }
}

And I've added a test.sprite file to my content project as:

<?xml version="1.0" encoding="utf-8" ?>

<XnaContent xmlns:data="MyNamespace">
  <Asset Type="data:SpriteData">
    <TextureFilename>Sprites\Test.jpg</TextureFilename>
    <SourceRectangle>0 5 20 25</SourceRectangle>
    <Origin>30 2</Origin>
  </Asset>
</XnaContent>

I have defined a SpriteImporter as:

[ContentImporter(".sprite", DisplayName = "Sprite Importer", DefaultProcessor = "SpriteProcessor")]
public class SpriteImporter : ContentImporter<SpriteData>
{
    public override SpriteData Import(string filename, ContentImporterContext context)
    {
        using (var xmlReader = XmlReader.Create(filename))
        {
            return IntermediateSerializer.Deserialize<SpriteData>(xmlReader, filename);
        }
    }
}

And a SpriteProcessor as:

[ContentProcessor(DisplayName = "Sprite Processor")]
public class SpriteProcessor : ContentProcessor<SpriteData, SpriteData>
{
    public override SpriteData Process(SpriteData input, ContentProcessorContext context)
    {
        var spritePath = Path.GetDirectoryName(context.OutputFilename);
        var textureReference = new ExternalReference<Texture2DContent>(input.TextureFilename);

        // make sure the texture is built (not sure what else to do here)
        context.BuildAsset<Texture2DContent, Texture2DContent>(textureReference, string.Empty);

        return input;
    }
}

Now I'm stuck. If I don't implement a content writer+reader combination then I won't get a Sprite out of the content manager - I'll get a SpriteData instead, which is not what I want. But my attempt to implement a SpriteWriter came up short. I have no idea how to get the texture information from the processor to the writer. Do I need to change the type from SpriteData to something else? Is there a sample anywhere that demonstrates how to do this end-to-end?

sentences:
XNA - Strange Texture Rendering Issue Using XNA BasicEffect I have been reading and working through Riemers 3D XNA tutorials to expand my knowledge of XNA from 2D into 3D. Unfortunately I am having rendering issues that I am unable to solve and I need a point in the right direction.

I am not expecting the Models to look identical to Blender but there is some serious discoloring from the texture files once rendering through XNA. The Character model is using completely incorrect colors (Red where Grey should be) and the Cube is rendering a strange pattern where a flat color should be drawn.

My sampling mode is set to PointClamp.

The Character model that I created has a 32 by 32 pixel texture that has been UV mapped to the model in blender. The model was then exported to .FBX. For the Cube Model a 64 by 64 pixel texture is used.

foreach (ModelMesh mesh in samuraiModel.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.Projection = Projection;
        effect.View = View;
        effect.World = World;
    }
    mesh.Draw();
}

Does this look like it is caused by a mistake I made while UV Mapping or Creating Materials in Blender?
Is this a problem with using the default XNA BasicEffect?
Or something completely different that i have not considered?

Thank You!

sentences:
How to make a custom semantics HLSL shader for the pixel shader I'm pretty sure it's possible but i have no idea how.

Could anyone tell me how to make a custom semantic for a pixel shader.

Thanks

sentences:
How should I implement a timer in a strategy game? I'm developing a real strategy game for Android and want to implement timers. Those timers will represent the time remaining until some building is finished.

Say that i have a building in construction that takes 45 minutes to be completed.

How can I communicate this timer information between my client (Android app) my server and my database? Should I communicate to the server every second in which state my timer is?
Should I even do this on the server (i.e., should the timer run on the client)?

I'm inclined to assign this task to the server for security and integrity reasons, but i'm not sure on the way i can accomplish that.

sentences:
How to resize the child node fit inside SKSpriteNode when resizing? I am creating a virtual gamepad for my game, It has one main SKSpriteNode with circle image and four child node(up, down, left, right) with image. When I am using default size for all it looks perfect but it's big in size and when I tried to resize the main circle SKSpriteNode all it's child node are bigger then it's parent and I am unable to calculate size for child node that will fit for every condition(different size of Main node).

-(id)initWithJoystickImage:(NSString *)baseImage
                   upImage:(NSString *)upImage downImage:(NSString *)downImage leftImage:(NSString *)leftImage rightImage:(NSString *)rightImage
{
    if((self = [super initWithImageNamed:baseImage]))
    {
        SKSpriteNode *up = [[SKSpriteNode alloc] initWithImageNamed:upImage];
        up.position = CGPointMake(0, up.frame.size.height/2);
        [self addChild:up];

        SKSpriteNode *down = [[SKSpriteNode alloc] initWithImageNamed:downImage];
        down.position = CGPointMake(0, -down.frame.size.height/2);
        [self addChild:down];

        SKSpriteNode *right = [[SKSpriteNode alloc] initWithImageNamed:rightImage];
        right.position = CGPointMake(right.frame.size.width/2, 0);
self.size.height/2.5);
        [self addChild:right];

        SKSpriteNode *left = [[SKSpriteNode alloc] initWithImageNamed:leftImage];
        left.position = CGPointMake(-left.frame.size.width/2, 0);
 self.size.height/2.5);
        [self addChild:left];
    }
    return self;
}

sentences:
How to determine the values of parameters controlling the game objects? I am a C# developer and now trying to change to my dream field: Game Development.

I am new to Game Development and currently self learning Unity3D.

To me Unity is component based tools and we can set different parameters to control the behavior of the game object.

There's a question which kept me wonder for a long time:

Is there any "scientific" method to determine the value of the parameters of the component other than trial & error (brute force)?

Like when I watch some tutorials, the tutors normally will just tell you "change this value to x, change that to y" without tell you why is it so.

I just want to know how industry game developers set the value, is there a common standard, etc.

sentences:
Random World Generation Possible Duplicate:
  How are voxel terrain engines made?

I'm making a game like minecraft (although a different idea) but I need a random world generator for a 1024 block wide and 256 block tall map. Basically so far I have a multidimensional array for each layer of blocks (a total of 262,114 blocks).

This is the code I have now:

Block[,] BlocksInMap = new Block[1024, 256];

public bool IsWorldGenerated = false;

Random r = new Random();

private void RunThread()
{
    for (int BH = 0; BH <= 256; BH++)
    {
        for (int BW = 0; BW <= 1024; BW++)
        {
            Block b = new Block();
            if (BH >= 192)
            {

            }
            BlocksInMap[BW, BH] = b;
        }
    }

    IsWorldGenerated = true;
}

public void GenWorld()
{
    new Thread(new ThreadStart(RunThread)).Start();
}

I want to make tunnels and water but the way blocks are set is like this:

Block MyBlock = new Block();
MyBlock.BlockType = Block.BlockTypes.Air;

How would I manage to connect blocks so the land is not a bunch of floating dirt and stone?

sentences:
Blinking color shader Currently i'm using Unity3D, and i want to make one variable blink along time in a fragment shader. Now i have code like this:

    half4 frag(v2f i) : COLOR{
        float4 r = _OutlineColor;
        r.a = r.a * _SinTime ;
        return r;
        }

But this blinking is too slow and not suit me, any ideas ?

sentences:
How to make a changeable color constant for editor materials? Due to the nature of a project I'm working on, the models I got have a bunch of redundant materials on them. I have to fiddle around with some of the colors, but every time I want to change the colors, I have to change each material to the exact same color.

Is there any way to declare some kind of swatch that I can change and have those changes just apply to the materials or anywhere else? For instance, in code, you'd just make a readonly Color mainColor, that you'd use wherever you need and could change at will. I'm looking for this kind of behavior in the editor itself.

sentences:
Problems when rotating object to animate in Unity I am trying to create some animations for a car model in Unity and I have a problem with the rotation of the wheels

https://imgur.com/a/HcWxyob

Here I can set the rotation properly as the pivot point seems to be at the center like how I want it to be but

https://imgur.com/a/TUpXBDX

When I play the animation it rotates on some other pivot point outside of the center of the wheel and even the car

Would you know how to fix this? Sorry if this is a dumb question

Thanks!

sentences: Why is my mouse disappearing at runtime? I'm using Unity 5.3.5f1 and every time I play my game in the editor, my mouse disappears. I really need to test some of my parameters in the inspector but I can't because the mouse is gone. How can I fix this, and if possible, make it permanent?

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:
Unity: Can objects override shader/material properties? I have a situation in unity where I have a custom shader with some properties where every object that uses this shader will want different values for those properties.

As far as I can tell, that means that I need to make a unique material for each object, which is a lot of materials and a tedious pain to set up.

Is there a way to make it so that I don't need to create and use a unique material for each object that uses this shader?

Also, if there is, are there downsides to doing so?

sentences:
Unity facebook SDK. Cannot login I want to show a leaderboard of facebook friends scores in a game.
So I need access to the user_friends permission.
In order to get that permission I have to send a working build using that permission to facebook that they can review.
So I need to keep my app on facebook in development mode, and test it with test users so I can build this feature and get it working.
However when I build the game and try and login to facebook I get this...

It did not give me a chance to login as a test user or anyone else. I didnt log in at all, it just went straight to this screen when I requested login.
Now the solution for this error that I have found many instances of, is to set your app 'live'. But that wont work in my case.. I need the app the be in development mode so I can test this feature.. If the app is live no-one will have access to the user_friends permission including test users.

So this seems like a paradox.
What can I do?

sentences: Develop on Oculus Go using Java and OpenGL I have recently done some game development using Java and OpenGL (with the JOGL library), and I was thinking about trying to learn how to develop on an Oculus GO. However, all guides seem to assume that the developer is going to use Unity. Is it possible to develop Oculus GO applications with Java and OpenGL directly? Is there any good documentation or guides for this?

sentences:
What algorithm to use for predictive collision detection in multivariate systems? In the collision system for my game I basically have two kinds of things, boxes, defined thusly:

struct Box2I
{
    uint32_t x, y, width, height;
};

and quads, which are used for terrain:

struct Quad
{
     const uint32_t left, right;
     const float slope_top, intercept_top;
     const float slope_bottom, intercept_bottom;
     bool solid;
};

The boxes can collide with the quads, but the boxes can't collide with each other, and colliding quads has no meaning.

Anyway, I'm having trouble with the collision, the collision function should return a number between 0.0 and 1.0, where 0.0 is the time of the last frame, 1.0 is the time of the next frame--and -1 for no collision.  But I can't find a way to do this.

Mostly I can find algorithms for systems such as colliding circles, where they move but the scale doesn't change, or points, etc. But I'm having trouble finding anything beyond the general scheme of:

broad phase checks
?????
binary/interpolation search for collision time

And I'm just not sure what goes in 2, because I frequently find things on the  separating axis theorem, but that can't be #2 because objects would sometimes tunnel.  The other general idea I've come across is casting rays from each of the corners of the box, but again, I can see that sometimes allowing tunneling.

What's the general technique that's typically used here?

sentences:
swift fast enumeration on MDLAsset not working I load an MDLAsset from my main bundle and get an compile error when fast iterating the asset object.

Type 'MDLAsset' does not conform to protocol 'SequenceType'

Documentation says it does support fast enumeration:

https://developer.apple.com/library/prerelease/ios/documentation/ModelIO/Reference/MDLAsset_Class/

Iterating over the asset is rather simple

for obj in asset {
    ...
}

I am using XCode7.1.1 and Swift2, is there something broken or what is it I am doing wrong?

sentences:
Where do I handle my input in a basic game loop? I recently had the occasion to work on a game, during a game jam at my college, and it really got me into it, so I've decided to start something more polished with a friend of mine. During the game jam, I made a top-down 2D hack'n'slash with a capped frame rate, thinking it would be easier. However, I ran into some problems for animations, and realized that capping the frame rate wasn't the best solution, as it would also cause the game to run slower on weaker hardware.

I updated the engine, so that it would use variable time steps. However, I've read a lot about patterns, and realized that variable time steps are highly deprecated. After some reading, I thought I'd settle for something like this:

const sf::Time MS_PER_UPDATE = sf::seconds(1 / 60);

sf::RenderWindow window(sf::VideoMode(800, 600), "GameEngine");

sf::Clock clock;
sf::Time lag = sf::milliseconds(0);

while (window.isOpen()) {
    sf::Time elapsed = clock.restart();
    lag += elapsed;
    sf::Event event;
    window.pollEvent(event);

    if (event.type == sf::Event::Closed) {
        window.close();
    }

    // Where to process input?
    while (lag >= MS_PER_UPDATE)
    {
        // Update game logic
        lag -= MS_PER_UPDATE;
    }

    window.clear();
    // Rendering
    window.display();

The question is, where do I handle my input? In my last project, I passed the event polled in the update function (something like update(event, dt)), and handled user input there; I'm wondering if it is actually the way it is supposed to be done. Since I'm only polling one event per frame, I'm wondering if it would significantly affect the user experience.

sentences:
Game Metrics for Achievements So I posted not too long ago looking for an alternative system to what I'm using for game metrics, meaning information I post each update when something specific happens (enemy damaged, killed, a wave starts, player taking damage, etc). I got suggestions to implement something more similar to "events" instead, where I could have a general interface to define events and create derivative classes to represent specific cases. This would be fine, but I'm having a hard time figuring out how to define achievements now in terms of these new events.

My current system, I have long values for each type of metric: player, enemy, kill, damage, damage types, weapons, and various other pieces of information. Each value is a single bit and I compose them together so I can later check specific bits to see if a certain metric was posted and apply it to my achievement progress tracker.

For example, let's say ENEMY = 1, DAMAGE = 2, PISTOL = 4. I compose these together to indicate that an enemy was damaged by the pistol this update and the resultant value is 7. I can later look at the individual bits for different cases. Say I have a general achievement for tracking number of kills regardless of enemy type, I could extract the bit relevant to KILL and ENEMY and see if one of those was posted, and if so, increment the milestone. However, I can also use this same metric to apply to an achievement that's tracking kill counts for specific enemies if I wanted to.

I also have more complicated achievements that use a rudimentary state machine with logic deciding what each state does with the metrics that are posted and determine the next state.

The reason this was problematic is because even though this system is great and works well, it means I only have 64 values I can use to compose together, and with the number of weapons and enemies I'm adding, I'm going to run out fairly quickly.

When I tried implementing "metric events" instead, I found that defining milestone achievements (and likely state machine achievements) was impossible because I could only take the metric events with all the information composing that class, and couldn't "compose" them together and then pick them apart. It also made it a lot more difficult to figure out how to save that information to a file for keeping track of achievements in save files.

Does anyone have a suggestion as to how I could approach this? If it helps, you can find my current implementation of my achievement system here:

Achievements System

You can also find the AchievementController class under the controllers package one level up. This controller defines the achievements themselves, if you want to take a look at how I define my achievements.

I really appreciate any insight people may have. Links to articles detailing how to properly implement an achievement and metrics system would be very helpful, or if anyone has their own examples of systems they've implemented, that would be awesome.

sentences: Animator animation does not show in game after gameobject is disabled and re-enabled I'm trying to understand why an animator stops working in-game after a gameobject is disabled and then re-enabled. The animator pane shows the animation is still going on, but the character is no longer animated in the game/scene.

sentences:
Any free 2D C\C++ framework that supports iPhone? I'm looking for a C\C++ game dev framework that supports iPhone.
It should have least Objective-C requirement to use it.

The closest one I could find is Kanji engine.
But that's not free.

Other frameworks like cocos2d need to be code in obj-c.

So do you know any C\C++ game dev framework for iPhone?

Thanks

sentences:
Making a HUD/GUI with OpenGL (LWJGL) I'm at the stage in my game development where I need to make a HUD or GUI. I've never gotten to this part, so I don't know how its done. I tried rendering a simple quad at a fixed position on the screen, but there's a problem. To make my camera work with orthographic, I use this:

public void lookThrough()
{
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(position.x, position.x + Display.getDisplayMode().getWidth()/zoom, position.y + Display.getDisplayMode().getHeight()/zoom, position.y, -1, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

I don't see how I would be able to make something fixed on the screen using this method? Any way around this? Thanks :)

sentences:
Smooth decelerate, interpolation? I have two points A and B.  I want to perform a smooth deceleration from A stopping at B over time t.  The only thing I managed to do so far was a lerp, which isn't right of course because it's unnatural.  I also tried multiplying the velocity by some factor (0.9 or similar), but then I don't know how to choose the factor such that the end point B is reached (or as near to it as some epsilon value seems reasonable).

Does anyone have something relatively simple that I could use?  I can read C++ and C# code.

sentences:
How to import character package in Unity I recently made a game in Unity 3D and I tried to import the FPS Controller package as the tutorial I was following said, but when I clicked Assets/Import Package the only thing I saw was a button saying 'Custom Package'

How do I get the character option when I click 'Import Package'?

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:
How do you avoid lag with Three.js and mousemove? I'm trying to create a browser moba-like game using three.js. I'm using WASD for movement and the player rotation follows the mouse with mousemove then lookAt() the intersection.

The problem:

As I start to move the mouse rapidly and doing other stuff like movement or shooting the game starts to lag and slow noticeably.

How can I increase performance of the game, should I create a worker thread for the raycasting, use other movement technique (e.g. right click to move). What is your recommendation?

var mouseCallback = function(e){
  if(e.clientX >= renderer.domElement.clientWidth-2){
    mouse.x = 1;
  } else {
    mouse.x = ( e.clientX / renderer.domElement.clientWidth ) * 2 - 1;
  }
  if(e.clientY >=  renderer.domElement.clientHeight-2){
    mouse.y = -1;
  } else {
    mouse.y = - ( e.clientY / renderer.domElement.clientHeight ) * 2 + 1;
  }
  if(player){
    raycaster.setFromCamera( mouse, camera );
    var intersects = raycaster.intersectObject( terain );
    var direction;

    for(var i = 0; i< intersects.length;i++){
      direction = intersects[0].point;
    }

    if(direction){
      var focalPoint =
        new THREE.Vector3(
            direction.x,
            player.position.y,
            direction.z
            );
      player.lookAt(focalPoint);
    }
  }
}

sentences:
Other displacement/deformation methods than vertex displacement? Using vertex displacement on low-res models lead to artifacts, and I imagine tessellation might be a bit slow, if I want it pixel-perfect.
I know signed distance fields can be used, though I doubt that's fast either.
Are there any other approaches? Is using tessellation fast enough for a large scene with hundreds of constantly deforming objects?

sentences:
2D Topdown Shooter - Line of sight based purely on angle and rotation In a game I'm working on, enemies constantly rotate around as they move around the map. I want them to only shoot the player if they're within a field of view.

This is the function header:

bool inLineOfSight(float playerX, float playerY, float enemyX, float enemyY, float enemyRotation);

Enemy rotation is in degrees not radians. Picture kind of shows what I'm looking for. An enemy should not be able to see the player unless they're within field of view. Should mention that raycasting isn't necessary as I've already sorted that out.

How would I make sure that the player is within an enemies field of view based on angle and position only?

sentences:
Find required entities to accomplish specific task in shortest time I have a grid like map with entities that can perform turn-based actions like moving or growing strength. When I have a task that requires a certain strength, I want to find the entities required to solve that task as fast as possible and move them to the target.

The distance to the target is important, since moving a tile takes 1 turn. When entities move on a tile with an existing entity, their strength is combined together. A task can be solved only if the combined strength of the last entity is greater than the requirement. This logically means that entities near the target can grow while additional entities need to move to the target immediately.

It feels like I could use a modified pathfinding, but I can't formulate the procedure to get something meaningful. This inablity also worries me a bit that the problem might be np-hard.

Can you help me?

sentences:
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:
Making a surface transparent from blackness of texture I am making a "halo" shader in unity using GLSL. And I've come to a roadblock.

What I need to do is take a texture, like the following, and make it transparent according to the darkness of it. And I don't want a cutout, because that cuts it off at a hard edge.

This line of code doesn't seem to work.

gl_FragColor = texture2D( vec4( _MainTex.r, _MainTex.g, _MainTex.b, _MainTex.a), vec2(textureCoordinates));

sentences:
Tips for writing 3D Collision detection with opengl I would like to any tips/articles/tutorials on how to write collision detection using OpenGL and C++ in 3D mainly just simple box collisions etc but also if there are any advanced resources that would be great to. i also don't wont to use any external library`s if possible.

thanks

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:
Implementing character movement using real physics This is the first time I'm seriously developing a game so apologies if I'm missing the obvious.

In my 2D platformer I adopted Box2D since it seemed like a natural solution to model gravitational pull (player dropping off platforms) and jump arcs and in the process get collision detection for free. It was also a breeze to integrate with libgdx which I'm using as the main game engine.

One thing that I'm struggling with though is, ironically, the most simple thing: expressing player movement along the x axis using Box2D. Where previously it was as simple as translating position as a function of time, now I can only indirectly affect player position by applying a horizontal force to the rigid body representing the player, thus increasing its velocity.

I have multiple problems with this approach:

If I add friction to the platform fixtures, which seems natural, the user has to keep applying a force to the player for it to keep moving. However, my input system is based on the user pointing to a target platform or block upon which the character moves there, then stops.
If I remove the friction from any static objects the player steps on, then it's sufficient to apply force force once for the player to keep moving, but how do I tell it to stop at point x? I couldn't come up with a solution that does not feel convoluted or unnatural. I was thinking for instance to store the target position and then apply a balancing force in the opposite direction once the player reached it. Sounds complicated and prone to failure in corner cases though. I also thought about placing invisible geometry one unit ahead of the target position so that the player would collide with it and stop once reaching the position.

But seriously, both ideas sound complicated and kinda dumb. Am I missing the obvious?

I'm thinking already that maybe I should pursue a mixed approach of physics and direct controls, but I already tried that and Box2D does not like it if I set object positions manually, since this short circuits the computations behind the scenes?

sentences:
How do I implement corner correction in a platformer? I'm writing a platformer in Unity and I'm trying to make it so that when the player jumps up to a ledge but barely misses (imagine they hit their toe on the ledge, or maybe even their foot, I'll play with the values) they are nudged up onto the ledge instead of not making the jump (as it is now in my game). There's a thread showing that Celeste does this in a few ways here.

My player character uses a dynamic Rigidbody2D and I move the character by setting the velocity directly.

sentences:
Find angle to a point I'm trying to find the angle between a point and the left side of my camera's fov.

In the picture below the camera (Red dot) is looking towards a polygon (Green) with the fov of the camera represented as the blue lines.

I've tried to butcher some code together from my limited understanding of linear so I havent gotten far. I've tried atan2 as well, but it seems to give incorrect answers for what im looking for.

the info i have is:

the point(x,y) I'm evaluating
the camera(x,y)
line segment and angle representing the left side of the cameras fov
same for the right

How would i find the angle between the left angle and the point?
I'm going to use the calculation to find the angle to each of the points making up the polygon.

Below is a rough mock up ive been using to try to figure this out
the blue angle with the question mark is what im looking for

sentences:
c++ How to use angular velocity that derived from inertia and force(torque) in 3d I am relatively new to game development. May my terminology and description are not appropriate. Please excuse my poor phrasing and help me by giving advice on how to question better if this question seems less fitting. I really appreciate your efforts.

Hi. I am having hard time interpreting the set of values I have.
I have inertia and force(torque) in terms of x y z.
FYI I used x and y coordinates as my ground, flat coordinates and z as my up/down.

I am assuming that since f = ma, that angular acceleration must be a = f / m.
So I divide my torque by inertia.
Then I add those x y z values to my angular velocity variable's x y z.

However these x y z values confuse me. Don't I need angle/sec or radian/sec sort of values in order to apply rotation?
The x y z values I have seemed to not say anything about radians or angular movement.

Question : If I have ( 1, 2, 3 ) or any ( x, y, z ) as my angular velocity, how do I actually apply it as angular movement?

FYI Here I am pasting my code :

float mass = 100;
float devidedMass = 1.0/12 * mass;
Vec3 innertia(
    devidedMass* (_box._size.z*_box._size.z + _box._size.x*_box._size.x),
    devidedMass* (_box._size.y*_box._size.y + _box._size.x*_box._size.x),
    devidedMass* (_box._size.y*_box._size.y + _box._size.z*_box._size.z ));
box._angAccel += forceAng/innertia;
box._angVelo += box._angAccel;
box._angAccel.allZero();

source of my inertia calculation
http://www.health.uottawa.ca/biomech/courses/apa4311/solids.pdf

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:
SDL Audio/Mixer cannot initialize with 2 channels only From the documentation using SDL2 Mixer to init the soundcard with 2 channels.
It will return 8 channels (7.1) and seems there is no way have just 2 channels.
here the snippet that i used simple as that:
Mix_Init(0);
    if (Mix_OpenAudio(44100, AUDIO_S16, 2, 1024) < 0) {
        cerr << Mix_GetError();
        return -1;
    }

int freq;
uint16_t fmt;
int channels;
if (Mix_QuerySpec(&freq, &fmt, &channels) == 0) {
    cerr << "query return 0" << endl;
}
cout << "freq: " << freq << endl
    << "format: " << fmt << endl
    << "channels: " << channels << endl;

and channels are equal to 8.
MY soundcard is a 7.1 so make sense, but shouldn't be init as stereo (2 ch) if required so?
Any help how to "force" to have just 2 channels?
It seems like is my driver doesn't support normal stereo, that is quite weird to me.
Any help would be appreciated

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:
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:
What is the proper way to process joystick input? What is the proper way to process joystick input?

Take, for example, the Xbox One controller. XInput returns joystick input along the x and y axis. I'm not sure if the hardware just measures voltage across the two axis, or not; I'm not very knowledgeable, in the hardware domain.

I'm unsure what data processing is done by API's like XInput already - but since the dead zone is still prevalent, I'm assuming XInput does very little input massaging. This leaves me with a few questions:

Should the dead zone be clipped circularly or rectangularly?
What type of low-pass filter should be applied, if any? Perhaps a moving average should be applied?
Should a bias be introduced into the input based on the resting input?

sentences:
Planar shadow matrix and plane b value I implemented planar shadows with the function D3DXMatrixShadow.

As you know, we need plane and light factor to calculate a shadow matrix.

The problem is that when I set the plane as D3DXPLANE p(0, -1, 0, 0.1f), the shadows by directional light are correctly rendered, but the shadows by point light are not rendered.

However, if I use D3DXPLANE p(0, 1, 0, 0.1f), the situation is reversed, shadows by directional light are not drawn, the shadows by point light are ok.

I cannot understand why it happens. Is it normal or am i missing something? Please explain to me why this happens.

Thanks in advance.

Code

//main.cpp
ID3D10EffectTechnique* oldTech = meshes[i]->technique;

D3DXPLANE groundPlane(0, -1, 0, 0.01f);
D3DXMATRIX S;//shadow matrix
D3DXVECTOR4 light;
if(lightType != 2) //2 here means point light
{
    light.x = lightDirection.x;
    light.y = lightDirection.y;
    light.z = lightDirection.z;
    light.w = 0;
}
else
{
    light.x = lightPosition.x;
    light.y = lightPosition.y;
    light.z = lightPosition.z;
    light.w = 1;
    groundPlane.b = 1;
}

D3DXMatrixShadow(&S, &light, &groundPlane);
D3DXMATRIX W = meshes[i]->GetWorldMatrix();
D3DXMATRIX matWorld = W * S;

meshes[i]->technique = shadowTechnique;
meshes[i]->render(&matWorld);
//Meshes here are drawn by ID3DX10Mesh,
//but I tested other code with LPD3DXMESH, it has the same problem.

meshes[i]->technique = oldTech;

 //shader code(.fx file)
 PS_Input VS_Shadow(VS_Input input)
 {
    PS_Input output = (PS_Input)0;
    output.pos = mul(float4(input.pos, 1), matWorld);
    output.pos.y = 0.1;
    output.pos = mul(mul(output.pos, matView), matProjection);
    output.normal = mul( input.normal, (float3x3)matWorld );
    output.color = input.color;
    output.worldPos = (float3)mul(input.pos, matWorld);
    output.tex = input.tex;
    return output;
 }

 float4 PS_Shadow( PS_Input input) : SV_Target
 {
    return float4(0,0,0,0.5f);
 }

 DepthStencilState StencilIncreaseOnce {
    DepthEnable = true;
    DepthWriteMask = ALL;
    DepthFunc = LESS_EQUAL;

    StencilEnable = true;
    FrontFaceStencilFunc = EQUAL;
        FrontFaceStencilPass = INCR;
    FrontFaceStencilFail = Keep;
 };

 BlendState BlendAlpha {
    AlphaToCoverageEnable = FALSE;
    BlendEnable[0] = TRUE;
    SrcBlend = SRC_ALPHA ;
    DestBlend = INV_SRC_ALPHA ;
    BlendOp = ADD;
    SrcBlendAlpha = ONE;
    DestBlendAlpha = ZERO;
    BlendOpAlpha = ADD;
    RenderTargetWriteMask[0] = 0x0F;
 };

 technique10 ShadowRender
 {
    pass P0
    {
        SetVertexShader( CompileShader( vs_4_0, VS_Shadow() ) );
        //SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetGeometryShader( NULL );
        SetPixelShader( CompileShader( ps_4_0, PS_Shadow() ) );

        SetDepthStencilState( StencilIncreaseOnce, 0x0 );
        SetBlendState( BlendAlpha, float4( 0.0f, 0.0f, 0.0f, 0.0f ),
                   0xFFFFFFFF ); //blendState, blendFactor, sampleMask
    }
 }

sentences:
Recommended method towards making custom maps for a 2d game? I am planning on making a 2D game, however different from my last personal projects I want this one to have enhanced graphics, with custom-designed levels. My previous 2d platformers were tile-based, in which I made a map editor for to create levels.

However, I am wondering the best way to implement custom designed maps? For say, some grass is a litter higher than others, flowers here and there, cool drawings and structures along the way, etc. instead of just the same old tiles over and over again. I am thinking but I just can't grasp the idea of how to implement it. I have seen it done in other games and am interested to see how they accomplish it, but can't get my hands on some source code. :(

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:
Hover Craft Algorithm I have a hover craft and I would like to implement it but I don't know what the algorithm or equation of how the physics work is. The variables I think would be the falling speed, the aircraft position and the distance from the ground. Based on that I need it to return the velocity. What makes it so hard is that it needs to work regardless of the situation like falling off a big cliff. Lets say it falls from a very high altitude. Once the craft is at a certain position from the ground the jets should gradually bring the craft down to speed and shoot it up from the ground a little depending on the height. Here is a picture illustrating what I'm talking about.

Could I get some help on what the algorithm would be determining the hover craft's vertical velocity?

Thanks.

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

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

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

sentences:
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: 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: Same noise generator for C# and Javascript I'm writing a 2D web racing game with procedural generated maps using perlin noise(as a university project). The server is written using C# and the client using Javascript. I've developed procedural generating of maps on the server but I've realized that's so time consuming. I've thought that players can generate maps and the server can validate some key points so server doesn't have to do both. The problem is that I don't know how to generate same map on the client (in JS) and the same map on the server (in C#). I've read some about deterministic random number generators which are platform independent. But I'm not sure how to search noise generators with them. Do you know where can I find some, especially in programming languages I'm using? Do I have to write own noise generator?

sentences: Unregister touch sprite when background scene is zoom and moving I am new to game development on Android, I use AndEngine framework. I'm developing an application with isometric view, at this time I had problems with touchlistener area on the sprite in the scene background, I intend to turn off the touch function on the sprite when the background is shifted, so as not to disturb the background when being moved. How it works?

sentences:
Loading and drawing materials using Lib3ds Hey all, i'm currently using Lib3ds to load models into my C++/OpenGL project. So far, i've been follow the model loading tutorial found here.

The tutorial gives a good example of how to draw the vertices and normals using VBO's, but so far i've been lost as how to do the same thing with materials.

Could i get an explanation/example of how to both load and draw materials of my meshes using Lib3ds and OpenGL?

sentences: Sprite orbiting on a point I was wondering how to make a Sprite do an orbit on a determinated point in SpriteKit. I tried to set the anchorPoint of the Sprite orbiting with the center point but it doesn't work. Please can someone help me?

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: Text based game in XNA I want to create a text based game, where the player will type up,down, left or right and the sprite will move in that direction. I created the game and at the moment the player moves with the up,left,down and right keys. I would like to change the movement of the sprite from keypresses to text commands, Ive googled a lot on creating text based games in XNA but have had no luck. Could you please help me or guide me in the right direction of how to do this in XNA.

sentences:
Weapon Reloading Bug I'm developing a top-down shooter in Java with Slick2D, and I've been ignoring this bug for a while because I'm not sure what causes it. I have numerous weapons that you can buy from the shop and cycle through using the scroll wheel or Q and E. The problem is that I've had a persistent bug where if you run out of ammo for one weapon, switch to another and try to fire, it will say you're out of ammo, even if the other weapon is full up. Then, after pressing reload for the second weapon, it will not let you fire the weapon. But if you then switch back to the weapon that was out of ammo and back again, it will allow you to fire.

I was wondering if someone could take a look at the logic for my weapon switching and reloading and tell me if there's a flaw in how it's being handled:

The following is the method that actually refills the clip, if there's any ammo left.

protected void reload() {
    int takeFromInv = getClipCapacity() - ammoInClip;
    int taken = Math.min(takeFromInv, ammoInInventory);
    ammoInInventory -= taken;
    ammoInClip += taken;

    reloading = false;
}

This is called during the update() method...

public void update(BasicGameState gs, long cTime, int delta) {
    // Basically just checking to see if the reload time has elapsed.
    if(reloading && !isReloading(cTime)) reload();
    ...

...once the reload timer has elapsed:

public boolean isReloading(long cTime) {
    long elapsed = cTime - reloadStart;
    return ((elapsed < getReloadTimeTotal()) && reloading);
}

The reload timer is kicked off when this method is called by the Player class when the 'R' key is pressed.

public void reload(long cTime) {
    if(getInventoryAmmo() > 0) {
        reloading = true;
        reloadStart = cTime;
        if(Talents.Munitions.HASTE.active()) {
            float roll = Globals.rand.nextFloat();
            if(roll <= 0.1f) {
                reload();
                StatusMessages.getInstance().addMessage("Haste!", Player.getPlayer(), Player.ABOVE_1, cTime, 1_000L);
            }
        }

        if(reloadSound != null) reloadSound.play();
    }
}

The method that determines if the weapon can be used (fired) is:

public boolean canUse(long cTime) {
    if(reloading) return false;
    boolean clipNotEmpty = ammoInClip > 0;
    boolean cool = (cTime - lastUsed) >= getTotalCooldown();

    if(!clipNotEmpty) return false;

    return (Player.getPlayer().isAlive() && equipped && cool && (automatic || release));
}

Finally, the weapon switching is handled in the Player class as such:

public void weaponRotate(int direction) {
    int wc = getRangedWeapons().size();
    if(wc > 0) {
        // have to use floorMod because apparently Java % is remainder only, not modulus... -_-
        int i = Math.floorMod((rangedIndex + direction), wc);
        setCurrentRanged(i);
    }
}

And here's the setCurrentRanged method:

public void setCurrentRanged(int wi) {
    List<RangedWeapon> weapons = getRangedWeapons();
    if(!weapons.isEmpty()) {
        if((wi >= 0) && (wi < weapons.size())) {
            // If the player actually has the weapon bound to the key that was pressed...
            getCurrentRanged().unequip();
            rangedIndex = wi;
            getCurrentRanged().equip();
        }
    }
}

And finally, getCurrentRanged():

public RangedWeapon getCurrentRanged() {
    List<RangedWeapon> weapons = getRangedWeapons();
    if(rangedIndex >= weapons.size()) return weapons.get(0);
    if(!weapons.isEmpty()) return weapons.get(rangedIndex);
    else return null;
}

I realize that's a lot of code to look over, but those are the relevant functions to my reload and weapon switching processes. I never realized it would be so difficult to implement a good, working reload system. So can anyone spot what might be causing this issue, or any other bugs that might pop up as a result of the way I implemented this?

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:
How can I use a lookup table for brightness and contrast? Currently, I implemented a rudimentary brightness and contrast algorithm that changes brightness and contrast pixel by pixel. This was super inefficient performance wise and the algorithm looked a bit strange.

I heard that I can use a lookup table to get values brightness and contrast for a texture 2D image. How can I do something like this in Unity?

Currently in Unity, I have a prefab in which I load a texture 2D image on top of it. That's the image i want to apply brightness and contrast changes to.

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:
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:
Any way to set drag events on a phaser 3 group? I'm trying to set a drag event on a phaser 3 group, but I wasn't able to achieve what I want. I was reading some phaser 2 blogs, and they said that it isn't possible to set a group a drag event.
Can somebody help me with this? It's really impossible to set a drag event to a group?

sentences:
Can't click on a button with startDrag() active on stage I need to know how can I enable mouse click on a button when I have a MouseEvent listener for the stage.

I have an MClip associated with the mouse cursor:

Mouse.hide();
scope.startDrag(true);

And a MouseEvent on the stage:

stage.addEventListener(MouseEvent.CLICK, FunctionXYZ);

When I try to click on any button they don't call the function that I create for those buttons... for example, button for fullscreen, exit, help, etc... What can I do?

sentences:
Making a level editor for my game I am doing a 2D sprite based game in XNA for WP7, The game logic is simple, you start at some point, you want to avoid obstacles and reach a certain goal.

obviously I need to make many levels for the game to be challenging and funny.

I am considering making a level editor for my game where I can be able to design the level using some kind of GUI then it translates that to a .lvl or something that the game can read and interpret that to a playable level.

I am asking for an already made level editor for XNA/WP7.

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:
Circular lighting mask stretches to ellipse in Monogame using Pixel Shader I am trying to implement a very simple pixel shader for some basic lighting using this tutorial http://www.xnahub.com/simple-2d-lighting-system-in-c-and-monogame/

My problem is that when the effect is applied the circular gradient ends up looking like an ellipse(left) instead of its circular shape(right).

The technique I use is to have two render targets in monogame and blend them together. The first one is all of the light masks textures, and the second is the render target I want to add the lighting effect to.

I believe the problem is related to the shader itself because when I use this code I get the ellipse(left picture)

//Blend both render targets together onto the backbuffer
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
effect1.Parameters["lightMask"].SetValue(lightsTarget);
effect1.CurrentTechnique.Passes[0].Apply();
spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White);
//spriteBatch.Draw(lightsTarget, Vector2.Zero, Color.White);
spriteBatch.End();

However, when I comment out the effect and just draw the light render target. I get a nice circle(right picture)

//Blend both render targets together onto the backbuffer
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
//effect1.Parameters["lightMask"].SetValue(lightsTarget);
//effect1.CurrentTechnique.Passes[0].Apply();
//spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White);
spriteBatch.Draw(lightsTarget, Vector2.Zero, Color.White);
spriteBatch.End();

This is my effect file

sampler s0;

texture lightMask;
sampler lightSampler : register(s1) = sampler_state {Texture = <lightMask>;};

float4 PixelShaderFunction(float4 pos : SV_Position, float4 color1 : COLOR0, float2 coords: TEXCOORD0) : COLOR0
{
    float4 color = tex2D(s0, coords);
    float4 lightColor = tex2D(lightSampler, coords);
    return color * lightColor;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

Thanks.

sentences:
How many texture units are available per shader stage when compared to the total number available on hardware? The answer to the question How many textures can usually I bind at once?, given here, explains that:

OpenGL 3.x defines the minimum number for the per-stage limit to be 16...

and that there can be a higher limit.
This still leaves some ambiguity that I would like to clarify. If we calculate the total number of texture units to be, for e.g., 192 (see here for more details), then does this mean:

theoretically, that we have access to 192 texture units available for the pixel shader? OR
we have access to 192 texture units across all stages, however that still doesn't mean we have access to 192 texture units on any particular stage. OR
?

If #2 is correct, then how do we figure out how many maximum texture units are available on any given stage?

sentences:
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: Rigify to Unity converter stretches 3d model in blender My 3d model animations works perfectly in blender. But whenever I use "Rigify to Unity Converter" add-on it stretches the mesh as if it was pinned at a certain point (T-pose hand and foot position). How can I fix such a problem?

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:
Imitate a textured sphere in 2D I'm writing planet generator, using pico8. I got surface generation done:

And the last thing to do is to map the texture onto a sphere.
Pico8 has no triangle function. So my question is, how do I make a sphere in my 2d space, and how do I apply a texture on it?

Looking for an effect like this (with no lighting, of course!):

I have really bad knowledge of 3d space manipulations.
The full list of available API functions can be found here.

Update 4:

Solved!

Try it live here.

sentences:
Examples of interesting implementations of character stats? I've got this BBG going ( http://ninjawars.net ), and the character stats currently are simplistic.  I'm looking to add a few stats to the current 1/2 (strength and maximum hitpoints, essentially).
I've come up with: (strength (unchanged), speed, stamina, and some others that are somewhat interesting wildcard stats).
However, I'm not satisfied with how boring the effects of some of these stats are, because they're very linear.  Better stat, better effects of the stat, but the stats don't interact with each-other, there's no Rock-Paper-Scissors interaction, having more is always better all the time.

So what I'd really like is to see examples of interesting character stats or effects of stats?

Examples that I can think of off hand:

Call of Cthulu's Insanity stat (things get really weird/chaotic if you start losing sanity)

White Wolf stats, to a certain extent (the stats themselves have some basic effects, and all skills effectiveness base themselves off of stats as well)

What are some other ways people have used stats to check out?

sentences:
Significant 2D SmallTalk/Squeak Game? Smalltalk/Squeak vs. C# Prompted by this question about becoming a faster programmer, I'm curious to know if anyone has made a significant-sized 2D game in SmallTalk or Squeak.

And if so, how does it compare to C#? I'm using C# with FlatRedBall for my graphics/physics stuff, and I find it pretty easy to make whatever I want to make. Also, how is Squeak/SmallTalk as far as automated testing?

It's not clear from the Squeak site how the games work; are they download-and-play? I prefer in-browser (via a plugin, like Flash/Silverlight).

sentences:
Where is the XACT documentation? All the links here are broken:

http://msdn.microsoft.com/en-us/library/bb172314.aspx

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: How do you transition to playing in XNA? I have two classes in my game, a Main Menu and the main playing screen. How can I swap through classes? E.g I click on "New Game" in the menu class and it changes it too the Game class.  A transition animation explanation would be nice.

sentences:
Draw Edges in OpenGL I use blender game engine and blender uses OpenGL for graphics. How can I draw lines around all 3D objects? Would this be a job for a filter? Mainly, I want my end result to look drawn.
I found this:
uniform sampler2D bgl_RenderedTexture;
uniform sampler2D bgl_DepthTexture;

void main()
{
   float depth = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy).r;
   float depth2 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0,0.002)).r;
   float depth3 = texture2D( bgl_DepthTexture, gl_TexCoord[0].xy + vec2(0.002,0)).r;

   float fac = abs(depth-depth2) + abs(depth-depth3);

   float intensity = 9050;

   vec4 sub = vec4(fac*intensity,fac*intensity,fac*intensity,0);

   gl_FragColor = texture2D( bgl_RenderedTexture, gl_TexCoord[0].xy ) - sub;
}

#change float intensity

here and that seems to work, but I need it to look more sketched. So I would like some noise influence. Maybe it's called sinus displacement? Is there a way to do that?
I draw and I want the style to look like this. Thanks.
Disclaimer: I do hang out on BSE and this is not a question they are prepared to answer or is it necessarily on-topic for them, since it is about OpenGL.

sentences: Simple bare-bones path-finding routine I have a 2D grid with a number of cells. I need to find a path from one cell to another. There are no obstacles or opponents, and all cells are identical. What is a SUPER SIMPLE routine to calculate the shortest path? I have read about A* and other routines, but they are waaaaaaaay overkill in my case at this point. (Maybe I will need them later, in the future.) Thanks!

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:
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:
What causes player box/world geometry glitches in old games? I'm looking to understand and find the terminology for what causes - or allows - players to interfere with geometry in old games.  Famously, ID's Quake3 gave birth to a whole community of people breaking the physics by jumping, sliding, getting stuck and launching themselves off points in geometry.

Some months ago (though I'd be darned if I can find it again!) I saw a conference held by Bungie's Vic DeLeon and a colleague in which Vic briefly discussed the issues he ran into while attempting to wrap 'collision' objects (please correct my terminology) around environment objects so that players could appear as though they were walking on organic surfaces, while not clipping through them or appear to be walking on air at certain points, due to complexities in the modeling.

My aim is to compose a case study essay for University in which I can tackle this issue in games, drawing on early exploits and how techniques have changed to address such exploits and to aid in the gameplay itself.  I have 3 current day example of where exploits still exist, however specifically targeting ID Software clearly shows they've massively improved their techniques between Q3 and Q4.

So in summary, with your help please, I'd like to gain a slightly better understanding of this issue as a whole (its terminology mainly) so I can use terms and ask the right questions within the right contexts.  In practical application, I know what it is, I know how to do it, but I don't have the benefit of level design knowledge yet and its technical widgety knick-knack terms =)

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:
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: Removing the billing permision from a apk build in unity So recently we made a version of our game that is paid and not free. This of course means that we removed both ads and IAP capabilities. Now I'm sure that I have removed every single peice of code that references ads or IAP from scripts that get built into the apk but Unity still keeps adding the billing permision to the manifest. Apart from exporting a google android project and then modifying the manifest and then buidilng to apk what other options do I have to solve this ?

sentences:
Getting Vector at 90 Degrees from provided vector I need a function that can take a vector as an input and provide a vector that is at a 90-degree angle to the provided vector. I understand that in 3D there is an infinite amount of vectors that could be produced from this calculation, but I only require 1. I have been using GLM and have tried using its built in vector rotation functions but to no avail. I would like to keep the solution compatible with GLM as I wish to have everything standardized.

Here is a basic visualization of what I need.

Edit
The function's purpose is to pass a direction vector into a function, radius, and an angle and it will create a point around the origin at x angle in space. The reason for this is so I can loop through and create a point cloud in 3D space and then join them together to make shapes such as cylinders (see photo)

Solution Code

glm::vec3 CreateAngledPoint(glm::vec3 rotation_point, float radius, float angle, glm::vec3 normal)
{
    // Normalize the normal (axis to rotate on)
    normal = glm::normalize(normal);
    // Create a vector that will be used for the dot product
    glm::vec3 to_cross = glm::normalize(glm::vec3(0.0f,1.0f,0.0f));
    // Make sure that the normal and cross vector are not the same, if they are change the cross vector
    if (to_cross == normal) to_cross = glm::normalize(glm::vec3(0.0f, 0.0f, 1.0f));
    // Get the cross product
    glm::vec3 to_return = glm::normalize(glm::cross(normal,to_cross));
    // Rotate point around the axis
    to_return = glm::rotate(to_return, angle* RAD_TO_DEG, normal);
    // Scale the point up from the origin
    to_return *= radius;
    // Apply it to the point in space we are rotating around
    return rotation_point + to_return;
}

Example of its usage

sentences:
How to swap out the visual mesh component of an actor at run-time I am attempting to replace the visible component of a pawn with a different component at runtime (in my case a UCustomMeshComponent with randomly generated vertices) and running into problems.

I set up my pawn like this in its constructor (where OurMesh is a UCustomMeshComponent * member variable):

ATestGeomPawn::ATestGeomPawn() : OurMesh(NULL)
{

    PrimaryActorTick.bCanEverTick = false;
    AutoPossessPlayer = EAutoReceiveInput::Player0;

    // root is a scene component so this is placeable in the editor
    RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));

    // camera attached to root
    UCameraComponent* Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("OurCamera"));
    Camera->SetupAttachment(RootComponent);
    Camera->SetRelativeLocation(FVector(-250.0f, 0.0f, 250.0f));
    Camera->SetRelativeRotation(FRotator(-45.0f, 0.0f, 0.0f));

    // create an initial visible component
    RegenGeometry();

}

And RegenGeometry()'s intent is to set up the new component, destroying the old one if it exists (first time through it won't). RegenGeometry() may be called at any time (in my tests I have it bound to an action event):

void ATestGeomPawn::RegenGeometry() {

    // destroy old mesh
    if (OurMesh) {
        OurMesh->DestroyComponent();
        OurMesh = NULL;
    }

    TArray<FCustomMeshTriangle> tris;
    // code for setting up tris omitted for brevity

    // create and attach new mesh
    OurMesh = NewObject<UCustomMeshComponent>(this);
    OurMesh->SetCustomMeshTriangles(tris);
    OurMesh->SetupAttachment(RootComponent);

}

However, this leads to all sorts of bad results. I've tried various hand-wavey iterations of this:

The code as shown above just crashes the editor immediately, even if I don't actually have an ATestGeomPawn placed in the map.
If I use the now-deprecated NewNamedObject instead, with the same name every time, it works initially but subsequent calls to RegenGeometry() cause the mesh to disappear, with weird results shown in this video I made.
If I use NewNamedObject but generate a new name every time, it works initially but does not remove the initial component from the hierarchy, and has a similar visible outcome to the above, shown in this other video I made.
If I call RegenGeometry() in BeginPlay() instead of the constructor, it is never visible.

How do I do this properly?

I'm super new to the Unreal SDK, as in yesterday morning I was doing a crash course through tutorials and docs to try and get this done. I eventually arrived at the above. I have a feeling that my mistake here is some misunderstanding of life-cycles, replication, or maybe e.g. reference counting due to say player input on the pawn or something:

Update: The player input theory is eliminated. I tried the exact same thing as above but with a regular actor instead of a pawn (camera eliminated, no player input, just RegenGeometry() in constructor and nothing else), and the editor crashed in the same way. So it isn't related to this being a pawn.

I'm not sure which direction to head in next.

(Full source, if relevant: TestGeomPawn.h and TestGeomPawn.cpp; the "grow" stuff I just threw in from the tutorial to make sure player input was working)

sentences:
box2d and constant movement i'm developing a game with a top down view, the players body is a circle. To move the character you need to tap on the screen and it moves to the spot.

To achieve this i'm saving the coordinate of the touch and call a method every frame which applies linear velocity to the body with a vector of the direction the body should go

_body->SetLinearVelocity(b2Vec2((a.x - currPos.x)/SPEED_RATIO,(size.height - a.y - currPos.y)/SPEED_RATIO));
//click position - current position, screen height - click position (since the y axis is flipped, (0,0) is in the bottom left ) - current position = vector of the direction we want to go

now the problem with this is that the body slows down until it finally stops when getting closer to the point we want it to go, since the closer we are to that point the lenght of the vector gets smaller. Besides that i've read that it's bad practice to set linear velocity in box2d and i should use apply force instead, but that way the forces would add up and overshoot the target where it's supposed to stop.

So what i'm asking is how to move a box2d body to a coordinate in constant speed.

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:
Direct3d Techniques and Windows 8 Under Windows 8, what is the alternative to this code:

technique11 Light0Tex
{
    pass P0
    {
        ...

technique11 Light1Tex
{
    pass P0
    {
        ...

And:

Light1Tech    = mFX->GetTechniqueByName("Light1");

...

Light1Tech->GetPassByIndex(p)->Apply(0, md3dImmediateContext);

sentences:
Object made of cubes looks different based on the distance in Unity3D? I made a "Wall" from basic Unity3D cubes. They are placed tightly so the wall looks like one big rectangular prism.

If I look at it from close distance, it looks as it should be: one big rectangular prism.

But if I start moving backwards, away from the wall, the cubes' edges become visible:

And this whole thing happens in a circular way.

If I just start moving backwards from the wall,
first I start to see the cubes' edges just at the further parts of the object, and then the pure white circle starts shrinking, the edges become visible at bigger and bigger parts of the object.
then the blurrier edges appear at the further places and the previously appeared sharper edges circle starts shrinking as well. (this phase is shown on the image above)

This should be some kind of shading optimization, like mipmap, right?

How can I fix this? I want the wall to be seamless from all distances.

Update:

Changing the shader to Unlit > Color, fixes the issue.
This thing only occurs on the lit side of the wall. The shadowy side of the wall, (which isn't lit directly by the directional light of the scene) is rendered normally.

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 can auto-click software be detected to stop botting/cheating? I have to completely change my question, because it was far too general. I now want to focus on how I can detect one type of cheating method.

How can auto-clicking be detected? In general, I am referring to software that will simulate mouse clicks or keyboard input automatically. It seems this would be useful for botting behaviour.

Can my software see other software the user's computer is running. If so, how does the software know what the other program is doing? Will it need to check the byte code for routines that simulate mouse/keyboard input?

Would it be useful for my software to detect if the mouse is jumping across the screen in a non-human-like behaviour? That is the first thing I can think of to stop it, as it would be the simplest but also the cheater might be able to simulate mouse movement that is human-like.

I should probably mention that I am most comfortable with Python and C++, and I am currently learning the Windows API.

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:
How to convert pixel coordinates to GL coordinates in 2D space? I know that if you want to display a sprite on screen (in 2D) you can use glOrtho and essentially make 1 gl unit equal to 1 pixel, so when I plot out the vertices for say a 128x128 image (on a quad), I can define the vertices as -64/64, -64-64, etc and then when I map my texture coords to that quad, the image is displayed at a 1:1 ratio.

However, lets say I wanted to not use glOrtho and wanted to have a perspective view, so I can combine 2D sprites with 3D models and whatnot? I'm at a loss on how to convert/set up the coordinates for the planes/quads I want to draw images to, in a way that will match the resolution of the image. That is, define coordinates or convert them in such a way so that when a 2D sprite is right at the near plane, that sprite is mapped as 128x128 pixels on the screen.

sentences:
How to make Pokémon White 3D effect? I just wondered how to create a 3D effect similar to Pokemon White/Black? It seems to be not polygon based, but created just with sprites. If the perspective changes the sprites stay sharp and don't get blurred. How can I archive this?

Source: https://www.youtube.com/watch?v=fZEPUPYOnRc&feature=youtube_gdata_player

Edit: Wow, two downvotes because I used a video instead of screenshots? Don't get me wrong, I thank you, because you want to help me, but the 3D effect can be better understood in motion. Anyway, here is a screenshot: http://wearearcade.com/wp-content/uploads/2011/03/pokemon-black-white-starter-town.jpg

So, if this is a hardware limitation, how can I archive this o na different hardware, e.g. a HTML5 game?
Thank you.

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: 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:
deferred rendering and a few shading functions How to use a few shading functions together with deferred rendering (for example some objects are shaded based on a lighting equation,
other get a fixed color) ? I draw a full screen quad when shading (later I want to add optimizations for point lights). I have some idea how to
solve that problem: during a gbuffer stage a shading function id should be saved in one of the render targets. Then we can do something like this:

if(id == 0)
{
    fragColor = shadingFun0(...);
}
else
{
    fragColor = shadingFun1(...);
}

What do you think about that ?

sentences:
Instantiation of a custom class I have a custom class named Stars:

class Star
{
    public int primaryID;
    public string properName;
    public string HIPID;
    public string HDID;
    public string HRID;
    public string GLID;
    public string BFID;
    public decimal rightAscension;
    public decimal declination;
    public string magnitude;
    public string colourIndex;
    public int scale;
    public int red;
    public int green;
    public int blue;
    public bool isSimulated;
    public double x;
    public double y;
    public double z;

    public void setDetails(int primaryID, string properName, string HIPID, string HDID, string HRID, string GLID, string BFID, decimal rightAscension, decimal declination, string magnitude, string colourIndex)
    {
        this.primaryID = primaryID;
        this.properName = properName;
        this.HIPID = HIPID;
        this.HDID = HDID;
        this.HRID = HRID;
        this.GLID = GLID;
        this.BFID = BFID;
        this.rightAscension = rightAscension;
        this.declination = declination;
        this.magnitude = magnitude;
        this.colourIndex = colourIndex;
        decimal deg2rad = 0.01745329251994329576923690768489m;

        this.isSimulated = true;

        // Decimal datatype is used to make sure that values are very accurate and precise
        decimal degrees_ra;
        decimal degrees_dec;
        decimal radians_ra;
        decimal radians_dec;

        degrees_ra = Decimal.Multiply(rightAscension, 15);
        degrees_dec = declination;

        radians_ra = Decimal.Multiply(degrees_ra, deg2rad);
        radians_dec = Decimal.Multiply(degrees_dec, deg2rad);

        // Converted from decimal to double because the Math library cannot work with decimals
        float distanceStars = 19113;

        this.x = (distanceStars * Math.Cos(decimal.ToDouble(radians_dec)) * Math.Cos(decimal.ToDouble(radians_ra)));
        this.y = (distanceStars * Math.Cos(decimal.ToDouble(radians_dec)) * Math.Sin(decimal.ToDouble(radians_ra)));
        this.z = (distanceStars * Math.Sin(decimal.ToDouble(radians_dec)));
    }

    public Vector3 getVector()
    {
        return new Vector3((float)z, (float)y, (float)x);
    }
}

There are many of these stars and I want to instantiate them at run-time:

void plotStars()
{
    int i = 0;
    while (i < (StarDataBank.Instance.NumOfStars))
    {
        string name = StarDataBank.Instance.StarName[i];
        string HIP = StarDataBank.Instance.StarIDHIP[i];
        string HD = StarDataBank.Instance.StarIDHD[i];
        string HR = StarDataBank.Instance.StarIDHR[i];
        string GL = StarDataBank.Instance.StarIDGL[i];
        string BF = StarDataBank.Instance.StarIDBF[i];
        decimal RA = Convert.ToDecimal(StarDataBank.Instance.StarRA[i]);
        decimal Dec = Convert.ToDecimal(StarDataBank.Instance.StarDec[i]);
        string Mag = StarDataBank.Instance.StarMag[i];
        string ColI = StarDataBank.Instance.StarCI[i];

        var star = new Star();
        star = Instantiate(ObjectStar, transform.position + star.getVector(), Quaternion.identity);

        star.transform.parent = StarObject.transform;
        star.transform.localScale = new Vector3(star.scale, star.scale, star.scale);
        i++;
    }
}

But I am experiencing a lot of errors.

Unity isn't instantiating the Stars because it can't convert UnityEngine.Transform to Star
Star doesn't contain definition of Transform

Is there a way to assign a class as a gameobject?

sentences:
UDK client, C++ server (is it possible?) For example I have C++/C# server side with sockets or http web server and UDK client.

I am interesting what about experience with networking in UDK: could I connect UDK client to C++/C# socket server via UDP/TCP? Maybe some tutorials/examples?

sentences:
Some sprite renderers in a for loop not changing I am using OnValidate() to help me speed up my design process. In the code below (which is in OnValidate()), if strictly one enemy has a weapon and the weapon is a sword or spear I change the Sprite for all enemies (the are of type Blue). I am having two issues:

The sprite renderer doesn't change until I run the Application though the code is in OnValidate()
Even when I run the application, not all Sprite Renderers for enemies change. I checked the number with a Debug.Log, which prints the right number, but I consistent number of Sprite renderers don't change.

    if (enemies.Count (x => x.hasWeapon) == 1) {

    if (enemies.Count (x => x.weaponType == Enemy.WeaponType.Sword) == 1) {

        for (int i = 0; i < enemies.Length; i++) {
            if (enemies [i].enemyType == Enemy.EnemyType.Blue) {
                Debug.Log (enemies.Length);

                enemies[i].GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Sprites/greenEnemy");
            }
        }

    }

    if (enemies.Count (x => x.weaponType == Enemy.WeaponType.Spear) == 1) {

        for (int i = 0; i < enemies.Length; i++) {
            if (enemies [i].enemyType == Enemy.EnemyType.Blue) {
                enemies[i].GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Sprites/blueEnemy");
            }
        }
    }

}

How can I solve these issues?

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:
How do I make function on user clicked on close button Ads reward? So I'm here want to make function when the user closed the Ads before video ads end, the function is stopping or revert, in this case, I'm using ienumerator methods, but I don't know how to add the handler on Ads, because I already using HandleRewardClosed method not like I want but because its same with user watch the vid till end not closed the videos before ended .
    public void loadRewardVideo()
    {
        rewardedAd.LoadAd(new AdRequest.Builder().Build(), rewarded_Ad_ID);

        rewardedAd.OnAdLoaded += HandleRewardedAdLoaded;
        rewardedAd.OnAdClosed += HandleRewardedAdClosed;
        rewardedAd.OnAdOpening += HandleRewardedAdOpening;
        rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad;
        rewardedAd.OnAdRewarded += HandleUserEarnedReward;
        rewardedAd.OnAdLeavingApplication += HandleOnRewardAdleavingApp;

    }

    /// rewarded video events //////////////////////////////////////////////

    public event EventHandler<EventArgs> OnAdLoaded;

    public event EventHandler<AdFailedToLoadEventArgs> OnAdFailedToLoad;

    public event EventHandler<EventArgs> OnAdOpening;

    public event EventHandler<EventArgs> OnAdStarted;

    public event EventHandler<EventArgs> OnAdClosed;

    public event EventHandler<Reward> OnAdRewarded;

    public event EventHandler<EventArgs> OnAdLeavingApplication;

    public event EventHandler<EventArgs> OnAdCompleted;

    /// Rewared events //////////////////////////

    public void HandleRewardedAdLoaded(object sender, EventArgs args)
    {
        Debug.Log("Video Loaded");
    }

    public void HandleRewardedAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        Debug.Log("Video not loaded");
    }

    public void HandleRewardedAdOpening(object sender, EventArgs args)
    {
        Debug.Log("Video Loading");
    }

    public void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
    {
        Debug.Log("Video Loading failed");
    }

    public void HandleRewardedAdClosed(object sender, EventArgs args)
    {
        Debug.Log("Video Loading failed");

        StartCoroutine(ClosedAds());
    }

    IEnumerator ClosedAds()
    {
        _GameManager.instance.isGameOver = true;
        yield return new WaitForSeconds(.05f);
        _GameManager.instance.isStarted = false;

        Time.timeScale = 0;

        _FirebaseRemoteConfig.instance.DisplayAds();

        _GameManager.instance.ShowingGameOverPanel();

        _GameManager.instance.pauseBtn.SetActive(false);
    }
```

sentences:
matrices and nesting hierarchy with game objects Let's say we have some game objects and they are nested to form a tree:

- A
  - B
    - C
  - D

If each of those have a matrix for the scale, rotation and translation, is it then easier that they inherit the properties from the parent as well or not?

If I do make them inherit from the parent then:

+ If I wan't to test if a point is inside C then I can get the inverse matrix and do a test.
  No need to worry about the matrices of A and B.

+  I can draw C directly for example without the need of applying the matrix of A and B.

If I don't make them inherit:

+ rotating C is more easy for example, cause there is no need to subtract from the parent to get correct values.

+ translating one specific entity is more easy cause there is no need to update the children.

- Testing if a point is inside for example is harder, cause all the matrices up to the root of the be applied.

What is more common / recommended? I'm guessing it makes more sense that children don't inherit from the parent but just start with a identity matrix instead.
If someone knows how blender is doing this then please tell me.

sentences:
Difference between integral and accumulator? I'm trying to build a bouncing-ball effect, and a newbie to calculus things...

For the ball-drop, it's straightforward - since there's no initial velocity and acceleration is constant.

For the bounce-up, it seems that what I want to do is integrate the velocity changes over time (since there's some transfer of energy upon impact, and that drives the ball upwards with a sortof fade-off as it fights against gravity?)

This leads me to some questions, one generic and one specific (with a more detailed followup):

Is this correct- that I need to use integration and not just a straight kinematic equation for the bounce-up?
I'm not quite sure about the difference between integration and accumulation. Ideally I would like to have a function y = f(t) where various other properties are known such as the initial velocity upon impact, but I do not want to accumulate anything every tick. I.e. it'd be nice to just have a pure function that pre-loads all the info it needs on impact, and then can be run with any time as an input. Can someone please explain the difference between integration and accumulation in light of this?
A bit more specifically, it seems like maybe there are rules of integration that allow for solving at any t such as the "power rule", but then integrators like Euler/Verlet operate more like accumulators. This is confusing and speaks to the above point.

Thanks!

sentences:
How are the responsibilities and program flow organized, in a graphics engine? I'm starting up on OpenGL, and want to write a well structured and expandable, yet relatively simple 3D graphics engine for fun and personal knowledge. I'm looking for information concerning the best practices and design patterns related to this sort of code.

Specifically, I'm having issues deciding how classes should be organized, how to divide responsibilities, etc. Right now, I'm at the point where everything is done in the rendering method!

Can anyone give me some advice? How are the responsibilities and program flow organized, in a graphics engine?

sentences:
How to change player objects when switching scenes? I have a scene for lobby. When player connects to server he gets a lobbyCharacter, which is an empty gameobject with a script on it that create UI element with the players name. In lobby players can select character they want to use.
Now when starting game, i would like to switch scene to the game scene when all players are ready. I have been reading the API, documentation, and different stack questions, but i cant seem to find any info on how this should work. On NetworkManager i can do scene schange which will be changed on all clients. But how do i persist data over multiple scenes? And if the lobby characters are destroyied how are the game characters instansiated according to the choises made in lobby? How does the client connection persist between multiple scenes?
Do i just manage the character locally and use syncHooks to synchronize over the server? Do i need to create somesort of container gameobject that holds the player connection information and some extra stuff?
EDIT
Reading the soruce code of mirror i fouind that NetworkManager holds the connection of the client, sort of. So now the issue has come down to replacing the prefab for the connection.
I have the following code:
 public void switchScene()
    {
        GameObject obj = NetworkClient.connection.identity.gameObject;

        NetworkServer.ReplacePlayerForConnection(NetworkClient.connection, Instantiate(shipPrefab));

        NetworkServer.Destroy(obj);
        ServerChangeScene(gameScene);
    }

This should switch the prefab for connection and then switch scene, but i keep getting error
InvalidCastException: Specified cast is not valid.
Mirror.NetworkIdentity.SetClientOwner (Mirror.NetworkConnection conn) (at Assets/Mirror/Runtime/NetworkIdentity.cs:362)
Mirror.NetworkServer.InternalReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:837)
Mirror.NetworkServer.ReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets/Mirror/Runtime/NetworkServer.cs:697)
LobbyManager.switchScene () (at Assets/LobbyManager.cs:51)

And i dont understand why this is happening. New prefab has networkIdentity and networkTransform. Old prefab only has network transform. Up until this point everything wors, but once i want to switch scenes, it breaks.

sentences:
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 do I calculate market share in an economic simulation? I want to make a game in which the players create different products (supply), and I give them a certain finite number of customers (demand). Players can choose the price and quality of their products (among perhaps other variables).

I've been trying to come up with an algorithm to decide on the market share of each product based on those variables. I could do something random, but thought I'd ask first!

sentences:
"exception at 0x53C227FF (msvcr110d.dll)" with SOIL library I'm creating a game in C++ using OpenGL, and decided to go with the SOIL library for image loading, as I have used it in the past to great effect. The problem is, in my newest game, trying to load an image with SOIL throws the following runtime error:

This error points to this part:

// SOIL.c
int query_NPOT_capability( void )
{
/*  check for the capability    */
if( has_NPOT_capability == SOIL_CAPABILITY_UNKNOWN )
{
    /*  we haven't yet checked for the capability, do so    */
    if(
        (NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),
            "GL_ARB_texture_non_power_of_two" ) )
        ) //############ it points here ############//
    {
        /*  not there, flag the failure */
        has_NPOT_capability = SOIL_CAPABILITY_NONE;
    } else
    {
        /*  it's there! */
        has_NPOT_capability = SOIL_CAPABILITY_PRESENT;
    }
}
/*  let the user know if we can do non-power-of-two textures or not */
return has_NPOT_capability;
}

Since it points to the line where SOIL tries to access the OpenGL extensions, I think that for some reason SOIL is trying to load the texture before an OpenGL context is created. The problem is, I've gone through the entire solution, and there is only one place where SOIL has to load a texture, and it happens long after the OpenGL context is created.

This is the part where it loads the texture...

   //Init glfw
if (!glfwInit())
{
    fprintf(stderr, "GLFW Initialization has failed!\n");
    exit(EXIT_FAILURE);
}
printf("GLFW Initialized.\n");

//Process the command line arguments
processCmdArgs(argc, argv);

//Create the window
glfwWindowHint(GLFW_SAMPLES, g_aaSamples);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
g_mainWindow = glfwCreateWindow(g_screenWidth, g_screenHeight, "Voxel Shipyard", g_fullScreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
if (!g_mainWindow)
{
    fprintf(stderr, "Could not create GLFW window!\n");
    closeOGL();
    exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(g_mainWindow);
printf("Window and OpenGL rendering context created.\n");

//Create the internal rendering components
prepareScreen();

//Init glew
glewExperimental = GL_TRUE;
int err = glewInit();
if (err != GLEW_OK)
{
    fprintf(stderr, "GLEW initialization failed!\n");
    fprintf(stderr, "%s\n", glewGetErrorString(err));
    closeOGL();
    exit(EXIT_FAILURE);
}
printf("GLEW initialized.\n"); <-- Sucessfully creates an OpenGL context

//Initialize the app
g_app = new App();
g_app->PreInit();
g_app->Init();
g_app->PostInit(); <-- Loads the texture (after the context is created)

...and debug printing to the console CONFIRMS that the OpenGL context was created before the texture loading was attempted.

So my question is if anyone is familiar with this specific error, or knows if there is a specific instance as to why SOIL would think OpenGL isn't initialized yet.

sentences:
Unity Gyroscope orientation (attitude) "wrong" I am using the Unity reference and example implementation here https://docs.unity3d.com/ScriptReference/Gyroscope.html

I struggle to fix an orientation problem. When my phone lies flat on the ground, screen facing upwards, unity thinks I am looking as if I'd take a photo of a landscape. When I actually hold the phone as if I'd take a landscape photo, the screen shows me the sky. Rotating then shows me an arc from sky to my left or right side.

What I want is: Holding the phone as if I'd take a landscape picture should do the same in Unity.

Here is a short video where the phone lies flat and then I pick it up and look left and right on a chair.

and this is the codesnipped responsible:

protected void Update()
{
    GyroModifyCamera();
}

void GyroModifyCamera()
{
    transform.rotation = GyroToUnity(Input.gyro.attitude);
}

// The Gyroscope is right-handed.  Unity is left handed.
// Make the necessary change to the camera.
private static Quaternion GyroToUnity(Quaternion q)
{
    return new Quaternion(q.x, q.y, -q.z, -q.w);
}

sentences:
How do Mobile Idle-Games work I wonder how idle games, games where players only make a few clicks to get a game progress, work. These games appear to be running in the background, even when the app is closed. Therefore these games may be implemented on the server side and run on it accordingly. I'm interested in the kind of implementation.

Is there a program running on the server that creates a separate
instance for each player and performs the actions accordingly?
Or is this realised via a database?

Furthermore I ask myself where the data is stored, on the client (susceptible to manipulation) or on the server (high memory requirements).

Maybe one of you has experience in this area and can give me more information, insights or explain how it works. I am also happy about further reading or links.

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:
Importing an object from Blender into a scene, rotation on X axis? This is my situation:

I save the scene with blender no export with any processing steps.

Blender has x right y up -z into the scene for the view coordinates (OpenGL)
I have x right y up -z into the scene for the view coordinates (OpenGl)
Bleneder has x/y plane and z up as world coordinates
I have x/y plane and z up as world coordinates

I load the mesh with assimp directly from the blend file with absolutely no post processing.
The object is rotated abount π/2 on the x-axis. Why?

sentences: How to apply Collider to Particle and what components are needed for particles? i want to apply collider to particle system because if i applied the collider to particle ,if any other game object touched to that particle its gives some action or do some operation.so only i need.

sentences:
Write to one channel of R16G16 texture on Xbox I was going to draw my shadow map into one channel of a 16 bit texture and then draw a different shadow map into another channel of the same texture.

I realized that this might not be possible to do efficiently since my targetted hardware (Xbox) does not support blending R16G16 formats. (Although the HDRBlendable might make it possible if I need a blendable format to do this.)

Is it possible to mask one channel of a R16G16 texture on the Xbox? How do I do that?

sentences:
How to sync game tick in peer to peer game? I am making a 2-player iphone action game using a synchronization service (in this case Firebase). The service allows state syncing through the internet, but I have to execute all game logic on the phones.

I've read a bunch of game networking articles, and since I have no server, it seems like if I can get both phones to start the game at "exactly" the same time in realtime, I can adjust everything from there. (Planning on using a "tick" count on each phone, and sending the tick along with actions, then rewinding the simulation if necessary. The phones divide the game into halves to determine authority).

But how do you get remote clients to start a game tick at the same time?? It seems like this would be necessarily in lock step peer-to-peer, and something like it in FPS games.

The strategy I'm using now tries to have one client "guess" the other client's clock time, including ping time. If correct, they both start the game based on the guess (since for that message it was on).

a: sends a.localTime
b: receives message. Returns b.localTime, and dTime(a-b)
a: receives message. Returns a.localTime, and dTime(b-a)
b: receives message. If a.localTime + dTime(b-a) is very close to new b.localTime, send accept message.
b: starts game at: new b.localTime + 1 second
a: receives accept. Starts game at accepted a.localTime + dTime(b-a) + 1s

I made a little number counter thing to go with the tick, and they're just barely off. I can't see how this is possible though, since A "guessed" B's time, they should start at exactly the same time...

See anything wrong with my method? What's an easier way? I'm trying to avoid using a server if possible.

sentences:
How to get status of LEDs on keyboard and blink LED on keyboard from Unity 3D on Android? On Android, with Unity how do I get the status of caps lock, scroll lock and num lock LED's and blink these LEDs for caps lock, scroll lock and num lock from Unity 3D?

Blinking the LEDs will of course enable caps, num or scroll lock.

sentences:
OnTrigger not firing consistently I have a Prefab called Player which has a Body and a Sword.
The game uses 2 instances of Player, Player1 and Player2.

I use Player1 to strike Player2. This is code on the sword. My hope is that Sword of Player1 will log on contct with Body of Player2. It happens but only the first hit and then i have to hit several times before another strike is logged. But when i look at log from OnTriggerStay it looks like the TriggerExit is never detected untill long after the sword is gone.

    void OnTriggerEnter(Collider other)
{
    //Play sound to confirm collision
var sm = ObjectDirectory.soundManager;
    sm.PlaySoundClip(sm.gui_02);

    Debug.Log(other.name + " - ENTER" );

}

void OnTriggerStay(Collider other)
{
    Debug.Log(other.name + " - collision" );
}

void OnTriggerExit(Collider other)
{
    Debug.Log(other.name + " - HAS LEFT" );
}

DEBUG LOG:

  Player2 - ENTER
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerEnter(Collider) (at Assets/Scripts/SwordControl.cs:28)

  Player2 - collision
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerStay(Collider) (at Assets/Scripts/SwordControl.cs:34)

  (The last debug log then repeated hundreds of times long after the sword of player 1 had withdrawn and was in no contact with player 2  )

EDIT:
Further tests shows that if i move player1 backwards away form player2 i trigger the OnTriggerExit. Even if the sword is not touching Player2 since after the blow. However even after OnTriggerExit it takes many tries untill i can get another blow registered.

sentences:
Animations not working on custom actor in LibGDX I have this code for rendering a sprite, retrieved from a TextureAtlas

public class SpriteActor extends Actor {
private Sprite sprite;

public SpriteActor(TextureAtlas atlas, String spriteName) {
    sprite = atlas.createSprite(spriteName);
    this.setWidth(sprite.getWidth());
    this.setHeight(sprite.getHeight());
    this.setBounds(0, 0, this.getWidth(), this.getHeight());
}

@Override
public void act(float delta) {
    sprite.setPosition(this.getX(), this.getY());
    sprite.setOrigin(this.getOriginX(), this.getOriginY());
    sprite.setRotation(this.getRotation());
    sprite.setScale(this.getScaleX(), this.getScaleY());
}

@Override
public void draw(SpriteBatch batch, float parentAlpha) {
    Color color = new Color(this.getColor().r, this.getColor().g,
            this.getColor().b, this.getColor().a * parentAlpha);

    batch.setColor(color);
    sprite.setColor(color);

    sprite.draw(batch);

}

}

EDIT: Using actions with a Image actor in the same stage works, It's only my actor that doesn't

When I set the transparency like this : actor.setColor(1, 1, 1, 0.5f);
I can see the sprite becoming half transparent; or, if I set the position manually (actor.setPosition(0, 30);) I see the sprite to the correct position; but if I try to use actions (import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*; [...] actor.addAction(fadeIn(3) or actor.addAction(forever(rotateBy(45), delay(1))) they just do nothing.

Do I need to implement something to have predefined actions working on my code? Or what do I need to make this code work?

sentences:
How to get a job as a game programmer/developer in AAA studios? I have looked up and down on the internet and haven't really found the solution, or maybe I am just too confused to know the answer.

I love games and wanted to get into making them from a long time. I first started working with Unity and then realized that I could not see how this could help me in getting into AAA studios as all there job requirements had stuff that I didn't learn in the process. Then it felt like making a game engine would help me learn better what those studios want. But then that stuff was too overwhelmingly tough for me to actually get something competitive done. I did learn some things, but it was not a one man job.
I then again decided to go into making games on a pre-existing engine, this time I took up Unreal Engine 4. But this time I have a better idea of what I want to do. I am interested in making game play logic, AI system, and on a side have fair bit of interest in modelling (not texturing) and animation. I may not be good at all this right now, but I have figured out what I have to do exactly, and on the side.
Now again I did end up one some companies job page(Naughty Dog, Santa Monica and Sucker Punch) and I found myself in the sea of confusion and hopelessness, half of the time I couldn't figure out what the requirements.

So my question is, is learning how to get complex AI running in UE4, setting up some nice game play mechanics in UE4, and setting up a nice UI in UE4 and creating some models and animating them in Maya will be enough to get me a job at some of the AAA studios I mentioned?

I know I haven't done all the stuff I mentioned in depth, but I can't proceed without having a proper aim and path, the path can change in between but should lead me somewhere at least.

I will be thankful for any good advice.

Edit. I am not good at art, just in case.

sentences:
How to calculate faces involved in collision (Separating Axis Theorem) I have a game engine created in javascript (https://jsfiddle.net/4gqsq8wf/) which uses collision detection via the Separating Axis Theorem. Currently, it does not have any means of resolving velocity upon the impact of multiple objects. Many posts have stated on this site that the post-collision velocity of an object is simply the angle of reflection. (For example: https://stackoverflow.com/questions/573084/how-to-calculate-bounce-angle) However, this requires knowing the angles of the surfaces contacting each other. I don't know how to figure out these, as the function I wrote only calculates the Minimum Translation Vector; how would I find the polygon faces involved in a collision?

Layman's terms would be appreciated.

Edit: Would this be the collision normal?

sentences:
Gravity wells that go with finger I have a simple particle game, where all the particles are arranged in a grid.  This game is for touch devices so to take advantage of it I am trying to have a multitouch gravity field thing going on.

Basically I am trying to get it so that each finger is basically a well in an otherwise non existent gravity field. That way the particles are pulled towards a finger.

My problem is I don't even know where to begin with these calculations, I have tried averaging a particles distance to each finger, its direction to each finger and nothing seems to work nicely!

I have seen other games do this.  What does the math for it look like?

sentences:
How can I use iteration to lead targets? In my 2D game, I have stationary AI turrets firing constant speed bullets at moving targets.

So far I have used a quadratic solver technique to calculate where the turret should aim in advance of the target, which works well (see Algorithm to shoot at a target in a 3d game, Predicting enemy position in order to have an object lead its target).

But it occurs to me that an iterative technique might be more realistic (e.g. it should fire even when there is no exact solution), efficient and tunable - for example one could change the number of iterations to improve accuracy.

I thought I could calculate the current range and thus an initial (inaccurate) bullet flight time to target, then work out where the target would actually be by that time, then recalculate a more accurate range, then recalculate flight time, etc etc.

I think I am missing something obvious to do with the time term, but my aimpoint calculation does not currently converge after the significant initial correction in the first iteration:

import math

def aimpoint(iters, target_x, target_y, target_vel_x, target_vel_y, bullet_speed):

    aimpoint_x = target_x
    aimpoint_y = target_y
    range = math.sqrt(aimpoint_x**2 + aimpoint_y**2)
    time_to_target = range / bullet_speed
    time_delta = time_to_target
    n = 0

    while n <= iters:
        print "iteration:", n, "target:", "(", aimpoint_x, aimpoint_y, ")", "time_delta:", time_delta
        aimpoint_x += target_vel_x * time_delta
        aimpoint_y += target_vel_y * time_delta
        range = math.sqrt(aimpoint_x**2 + aimpoint_y**2)
        new_time_to_target = range / bullet_speed
        time_delta = new_time_to_target - time_to_target
        n += 1

aimpoint(iters=5, target_x=0, target_y=100, target_vel_x=1, target_vel_y=0, bullet_speed=100)

sentences: Creating 2D worldbuilding games like Terraria or Starbound in frameworks like PhaserJS or PixiJS? Frameworks like Phaser or Pixi support tilemaps, but I'm curious if that is already enough to get a map where the player can change everything that he wishes. I'm also not sure if browsers would be able to handle this in terms of performance

sentences:
How to make Unreal save assets in 3-file style? I'm trying to play around with some code to explore UE4 maps, but it assumes that every file is actually multiple files, with the asset accompanied by a .uexp file and optionally a .ubulk file.  When I save a map in Unreal Engine, though, it's all there together as one big .umap.
A bit of googling suggests that this can be changed by changing two config options in the project's engine.ini file, but when I change that, the map still saves as a single file, both for saving the file in-place and saving a copy of it elsewhere, even after completely closing and re-launching the editor.
What's the proper way to force the editor to save my map as 3 files rather than just the one?  (Using Unreal Editor 4.25.4, in case it matters.)

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: What is the difference between OpenGL ES and OpenGL? Android uses OpenGL ES, what is the difference between it and OpenGL?

sentences:
How to rotate camera around some point? I have screen with dimensions: 800x600.
The object that I want to rotate around is located at (400,300, -50) - center of the screen.
Orthogonal projection:
Near plan - 0.1f, far plane - 1000.0f
left - 0, bottom - 0, right - 800, top - 600

Camera:
position at (0,0,0)
look at (0,0,-50)
up vector (0,1,0)

Now what I'm doing to rotate is calculate the X of "look at" using: 0 + width * cos(A).
Y remains the same (0).
Z is calculated using: -50 + width * sin(A).

Now the problem that I'm facing is that after some angle the object starts to disappear, and it doesn't rotate around the object. What can be the problem?

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: Is OpenGl still supported in C? I'm reading the OpenGl superbible 3th edition (well I plan to) and it's all in C. Since this book was written in 2004 and all the other later versions are written in C++, i was wondering whether or not OpenGl is still supported in C, and whether the relevant downloads required will still be available. I want to do it this way, because I'm more comfortable with C, and I'm still learning C++.

sentences:
Unity & inheritance. Different results DebugMode/Build Here are my 2 Classes

public class Item : MonoBehaviour
{
    [SerializeField] protected TextMeshProUGUI txt_itemNom;
    [SerializeField] protected string itemNom;

 //No Start
 //No Update
}

public class Article : Item
{
    public int articleLevel = 1;

    public void Start()
    {
        txt_itemNom.SetText(itemNom);
    }

//Called by a button OnClick
    public void OpenBuyWindow()
    {
            PlayerRessources.instance.OpenBuyWindow(base.txt_itemNom.text + " Lvl " + articleLevel);
    }
}

It is very simple. When I start the game, the GameObject with the Article script set the correct item name in the TextMeshProUGUI object named txt_itemNom.
The player can click a button to buy this item, it will displays a confirmation window.
And it works perfectly! Or at least, it works when I press Play in the editor but weirldy it behaves differently in the build version.

In the build version, the value of base.txt_itemNom.text in

PlayerRessources.instance.OpenBuyWindow(base.txt_itemNom.text + " Lvl " + articleLevel);

is the original value of base.txt_itemNom.text. (which is "Item name" or something).
So I don't get it because base.txt_itemNom.text is correctly setted in the Start because it's displayed in the UI.

It looks like the Article loses its parent class (Item) reference when the player click to OpenBuyWindow(). But only for the TextMeshProUGUI contained in the Item class.

Additionnal info:

The Article script is attached to a prefab.
The prefab is not instantiated by a script. I just added it in the Hierarchy
If I use the string variable itemNom instead of base.txt_itemNom.text, then it will work.

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:
In Unity, how do get access to animation clips in selected model from EditorWindow? I need to add some animation events or copy them from other models. So I decided to make a EditorWindow. Unfortunately there's not much information about this, and I'm stuck in here.

void OnGUI() {
    GUILayout.Label("Source Object contains Animation Clips", EditorStyles.boldLabel);
    sourceObject = (GameObject) EditorGUILayout.ObjectField(sourceObject, typeof(Object), false);

    if(GUILayout.Button("Copy")) {
        if(sourceObject == null) {
            throw new System.NullReferenceException("Source Object is missing.");
        }

        // Do Copy here

    }
}

What I need to do is:

Extract all animation clips from the selected model(fbx) - it's the source object
Select "AnimationClip" to want to copy. Note that AnimationClip in here is not inside of model, it's seperated AnimationClip that duplicated from original model because basically animation clip from imported model is read-only, so I have to duplicate to update it.

How do I get animation clips from selected fbx model with ObjectField? Any advice will very appreciate it.

sentences:
Difference between Object.Destroy() and GameObject.Destroy() in Unity What is the difference between using Object.Destroy() and GameObject.Destroy() in Unity?

I found the following info about that: here and here, but it did not answer my question.

So, could someone explain the matter foolproof, please?

sentences:
How to: Duplicating and updating component data in systems I am new to game development. Coming across the ECS (entity-component system) pattern I generally quite liked the idea. I have implemented the current version of my engine using the OOP style approach. In other words, Components are objects that have both state and behaviour and methods that can be polymorphic. My entity manager also means that when a SpriteRenderComponent has been added to an entity, entity.GetComponent<RenderComponent>() will return a reference to the SpriteRenderComponent. Of course, the problem with this is that components have to communicate with each other. E.g. the draw method will access the TransformComponent's transform data.
Now I have dug a bit deeper and found that most sources recommend the pure ECS approach where the entities are an id or a list of components, components are just structs with public data and the systems are where all the magic happens ie where all the functions are. Of course, components don't depend on each other and the same is ideally true for systems as well.
So now when I want to draw a sprite I create a SpriteRenderSystem which knows how to draw a sprite. The problem is that drawing concerns all kinds of drawable things e.g. to sort them depending on a zOrder and layer. This is what lead me to the idea of nodes as objects that are local to the system. So now the SpriteRenderSystem would add a 'SpriteRenderNode' to the RenderManager. The SpriteRenderNode could inherit from an abstract RenderNode and implement the virtual draw method. The SpriteComponent would only hold the data specific to the sprite such as colour. The vertex array and all the other stuff that is purely related to rendering is kept encapsulated in the derived RenderNodes.
Problem #1
In order to be drawn by the RenderManager, the SpriteRenderNode would need to know and therefore store its transform data. The only way to keep this data up to date would be to copy the entity's transform component's transform data to the SpriteRenderNode every frame. I am not so much concerned about performance here but about the practice of duplicating the data in the systems. It feels like this is a violation of general good programming practices though I can't see any immediate reasons why it may prove harmful.
Problem #2
Taking the data out of the components.
From what I understand, the data should live in the components. However, taking the above-presented idea a step further, there may be cases where storing data in components isn't necessary at all. Such an example may be an animation system which may simply store and update animation nodes for each entity and then change their components such as texture, position... The problem with this is that it would take away the ability to save the game by simply serialising all the components.
As you see I am quite confused about how a good pure ECS should look like. Any help would be much appreciated.

sentences:
Raycasting mouse coordinates to rotated object? I am trying to cast a ray from my mouse to a plane at a specified position with a known width and length and height.

I know that you can use the NDC (Normalized Device Coordinates) to cast ray but I don't know how can I detect if the ray actually hit the plane and when it did. The plane is translated -100 on the Y and rotated 60 on the X then translated again -100.

Can anyone please give me a good tutorial on this? For a complete noob! I am almost new to matrix and vector transformations.

sentences:
How to get map tiles to line up nicely? When I first created my code, there were quite a few cases where I would get horizontal and vertical gaps between tiles when displayed. I put this down to rounding issues with floats and just moved on to other things. Now that I've revisited the issue, I can't seem to get it working properly, even after trying my hardest to eliminate places where this sort of issue might happen. It seems to only happen when I place the camera at certain positions, which is why I think it's likely to be a float issue. If anyone could help me with the correct way to draw the tile layout, it'd be much appreciated.

This is my drawing method for the map:

public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
    var topLeft = Camera.ScreenCoordinateToWorld(new Vector2(0, 0));
    // Readjust the position of the topLeft element so we get the actual
    // drawing position for the tile here
    topLeft = new WorldCoordinate(topLeft.X - 1, topLeft.Y - 1,
                                  -TileSize / 2, -TileSize / 2);
    var topLeftDrawPosition = topLeft.DrawPosition;
    var screenWidthInTiles = Game.GraphicsDevice.Viewport.Width / TileSize + 1;
    var screenHeightInTiles = Game.GraphicsDevice.Viewport.Height / TileSize + 1;

    for (var y = topLeft.Y; y <= topLeft.Y + screenHeightInTiles; y++)
    {
        for (var x = topLeft.X; x <= topLeft.X + screenWidthInTiles; x++)
        {
            if (x < 0 || y < 0 || y >= MapData.Count || x >= MapData[y].Count)
            {
                // Ignore out of range tiles to avoid exceptions
                continue;
            }

            var tile = MapData[y][x];
            var drawPosition = topLeftDrawPosition +
                               new Vector2((x - topLeft.X)*TileSize,
                                           (y - topLeft.Y)*TileSize);
            Tileset[tile].Draw(spriteBatch, drawPosition);
        }
    }

    base.Draw(gameTime, spriteBatch);
}

Broken:

Semi-working:

sentences:
Intantiating objects across multiple container pages I have this script here that generates buttons based on an array and a serialized grid transform
public void InitializeUI()
{
    LevelItem[] levelItemsArray = LevelSystemManager.Instance.LevelData.levelItemArray;
    for (int i = 0; i < levelItemsArray.Length; i++)
    {
        if (i % n == 0) // sets it to 15
        {
            LevelButtonScript levelButton = Instantiate(levelBtnPrefab, levelBtnGridHolder);
            levelButton.SetLevelButton(levelItemsArray[i], i, i == LevelSystemManager.Instance.LevelData.lastUnlockedLevel);
            var page = GameObject.FindObjectOfType<UI.Pagination.PagedRect>();
            page.AddPageUsingTemplate();
        }
    }
}

Now what I'm trying to do is make that array instantiate a new page (calling the page.AddPageUsingTemplate() function which is from another script) once for every 15 items of the array.
I have 75 levels and want to instantiate the buttons on a new game object which has a grid layout group, so it would be 15 buttons on each grid with 5 pages/grids in total.
I do indeed get 5 pages when I run this code, but since the transform is only set to the first one the buttons don't get placed on the other pages.
How can I place buttons after the first 15 on the following pages?

sentences:
In Unity, how do I move my character to an object when I click on it? Basic question here, and I feel like I'm close but can't quite get it.

I have an object--it's a pot on a stove--that is in my 2D game. There will be multiple pots that appear and disappear in the game, all in predefined places (like on top of the burners of a stovetop). There's also a chef in the game, who goes to each pot and does an action. The user never directly controls the chef's movement--instead, when the user clicks a pot, the chef runs over to the counter in front of that pot, where he can perform an action on the pot.

Can someone tell me how to do this? I'm not only looking for the code but for a "correct" design, in terms of where the various variables and methods should be located. In other words, what goes in the pot's script and what goes in the chef's script? (I'm using C#.)

My thought was that the pot GameObject would have an OnMouseDown() method, to catch the user clicking on it. And in that method, there should be a call to a Move() method that is attached to the chef GameObject.

But what I have is not quite working. The chef moves one small bit toward the pot but then stops. I realize that this is because I'm calling the Move function once and that's it; it seems like the Update method should be involved somehow (the pot's or the chef's?); or maybe I should have an if statement in my Move method that checks to see if the user is at the pot, and if not, runs the move code in a loop. Or maybe the design is just fundamentally wrong and it could be done more easily.

Here is the code I have:

public class PotController : MonoBehaviour {

    private GameObject chefObject;

    void Start () {
        chefObject = GameObject.Find ("Chef");
    }

    void OnMouseDown() {
        ChefController chefScript = chefObject.GetComponent<ChefController> ();
        chefScript.Move ();
    }

}

public class ChefController : MonoBehaviour {

    public float moveSpeed;
    private Vector3 moveDirection;

    public void Move () {

        Vector3 currentPosition = transform.position;
        if (Input.GetButton ("Fire1")) {
            Vector3 moveToward = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            moveDirection = moveToward - currentPosition;
            moveDirection.z = 0;
            moveDirection.Normalize ();
        }
        Vector3 target = moveDirection * moveSpeed + currentPosition;
        transform.position = Vector3.Lerp( currentPosition, target, Time.deltaTime );

    }

}

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 do I draw a sprite on top of a video in Andengine? I'm playing a video in Andengine on

@Override
protected void onSetContentView() {}

However, when I place a sprite on the screen at some point in time, it is placed behind that video view. I want it to appear in front of it.

My attempt:

Entity foregroundLayer= new Entity();
foregroundLayer.attachChild(drag1);
scene.attachChild(foregroundLayer);

Setting setZIndex also didn't work

Here's a screenshot:

The world icon is half outside and half behind. It should be on top.

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:
Is it legal to develop a game using D&D rules? For a while now I've been thinking about trying my hand at creating a game similar in spirit and execution to Baldur's Gate, Icewind Dale and offshoots. I'd rather not face the full bulk of work in implementing my own RPG system - I'd like to use D&D rules.

Now, reading about the subject it seems there is something called "The License" which allows a company to brand a game as D&D. This license seems to be exclusive, and let's just say I don't have the money to buy it :p.

Is it still legal for me to implement and release such a game? Commercially or open-source? I'm not sure exactly which edition would fit the best, but since Baldur's Gate is based of 2nd edition, could I go ahead an implement that?

in short: what are the issues concerning licensing and publishing when it comes to D&D?

Also: Didn't see any similar question...

sentences:
Single or Multiple Behavior Trees? I just finished coding a generic Behavior Tree structure for my games.  My question is, when creating behaviors for enemy AI's, do I create one large behavior tree with every possible configuration as a node or do I create many multiple Behavior Trees and simply swap them in and out as I need them?

To better understand my question here are some examples:

One large Behavior Tree might look something like this:

Multiple smaller Behavior Trees might look like this:

In the second tree I would simply swap out different trees depending on when I need them.  This is more apparent for things like evading and backing away from obstacles, I feel like that would need to be done alongside many other behaviors like chasing and evading.

I hope that made sense.

sentences:
Stop a rotating object at a specified angle? I'm working in JavaScript with HTML5 and the canvas. I have an object which is rotating at a certain speed, and I need the object's rotation to slow down gradually and the front of the object to stop at a specified angle. (I'm using radians, not degrees.) I have a variable to keep track of the angle which the object is facing, as it rotates.

How would I go about getting the object to come to rest, facing the direction I want it to?

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:
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:
Designing Collision Detection for 2D Rectangular Adventure/RPG TLDR: I'm looking for an efficient way to detect collisions between irregular/small objects that are not a full tile size (like small cans) and a free-moving character in a 2D game.

I'm planning to design a 2D RPG-style game in XNA. It will be similar to the style of Chrono Trigger (pictured below) -- I will explain what that means. The main issue I have is how to properly design the collision detection.

First, a description of two of the main points of my game design:

Sprites are rectangular. So a character is two parts: lower-half (which collides with solid tiles) and upper half (which is "above" the lower half).
Free movement. Even though I use tiles, you don't move from tile to tile; you can move in any direction in a small increment (such as 8px).

Another important aspect of my design is that I don't (can't?) do any pre-processing on images to detect collision spaces. It must be either generic (eg. a 4px range outside of each tile), or cheaply calculatable. (This is to make it easier to develop by cutting down on the time needed to make sprites.)

My initial design for this (which I prototyped) was to use the (bottom half of the) character to collide with anything on the "ground" level. This works well with things that are full-tile covering (like walls), but not small objects (like cans). Pixel-level collision detection solved this, but can lead to irregularities, problems with granularity (eg. checking 4 pixels to either side), and of course, performance.

What I really want in this case is for the character to be able to move close to small or irregular objects. Is pixel-level collision detection the right answer? What about encapsulating it in a small polygon approximation (say a rectangle, even) and colliding with that area?  I'm concerned that, even with spatial partitioning, the performance will be poor and the user perception of collision will be poor-quality.

How do other 2D games deal with this?

sentences:
Ease action to simulate a clank in a moving or rotating device near end of the trajectory You know those mechanisms that moved or rotated, and then just a few millimeters near the end of the trajectory they oppose a bit of resistance and then clank to the final position.
I want to simulate that clank with an ease function that can be combined with the standard ease actions. The link is for reference to some examples of ease transition functions, but I just need the pseudocode like this:
float clankActionTime(float t) {
    if (t > 0.9)
        return (0.5*sin(10.0*t*2.0*M_PI)+2.0*10.0*t)/20.0;
    return t;
}

That is what I have so far, which gives this graph for t between 0 and 1.

But I want something more like this:

Where A and B are parameters passed to the ease function to indicate where to star the clank and how deep is the valley near the end of the curve, respectively.

sentences:
Very subtle HLSL syntax change causes compliation error The following HLSL works and compiles:

texture2D renderTarget;
float h; // declared here

sampler GetRenderTarget = sampler_state
{
    texture = <renderTarget>;
};

float3 GetHsvFromRgb(float3 c)
{
    float4 k = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    float4 p = lerp(float4(c.bg, k.wz), float4(c.gb, k.xy), step(c.b, c.g));
    float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;

    return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

float3 GetRgbFromHsv(float3 c)
{
    float4 k = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    float3 p = abs(frac(c.xxx + k.xyz) * 6.0 - k.www);

    return c.z * lerp(k.xxx, clamp(p - k.xxx, 0.0, 1.0), c.y);
}

float4 ShadeVertex(float3 p : POSITION0, inout float2 t : TEXCOORD0) : POSITION0
{
    return float4(p, 1);
}

float4 ShadePixel(float4 p : POSITION0, float2 t : TEXCOORD0) : COLOR0
{
    float4 c = tex2D(GetRenderTarget, t);
    float3 hsv = GetHsvFromRgb(c);

    hsv.x = (int)h; // compiles and works

    float3 rgb = GetRgbFromHsv(hsv);

    return float4(rgb, h);
}

technique Simple
{
    pass FirstPass
    {
        VertexShader = compile vs_3_0 ShadeVertex();
        PixelShader = compile ps_3_0 ShadePixel();
    }
}

However, if I remove the cast from the h variable it causes an exception:

float4 ShadePixel(float4 p : POSITION0, float2 t : TEXCOORD0) : COLOR0
{
    float4 c = tex2D(GetRenderTarget, t);
    float3 hsv = GetHsvFromRgb(c);

    hsv.x = h; // removing int cast causes compilation exception

    float3 rgb = GetRgbFromHsv(hsv);

    return float4(rgb, h);
}

This doesn't really make any sense to me. The h variable is being set to 1 in code. The int cast is not what I actually want to do, I was just testing various things trying to understand why I couldn't assign the h variable value directly. Exception I get after removing the int cast is:

  (51,18): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression

More confusingly, if I cast to a float, it goes back to not working:

float4 ShadePixel(float4 p : POSITION0, float2 t : TEXCOORD0) : COLOR0
{
    float4 c = tex2D(GetRenderTarget, t);
    float3 hsv = GetHsvFromRgb(c);

    hsv.x = (float)h; // also an exception

    float3 rgb = GetRgbFromHsv(hsv);

    return float4(rgb, h);
}

Not sure what is going on or what I'm doing wrong, any insight?

sentences:
Android frame by frame PNG animation I am new at Android game development. I have done some apps before, but none of them are games :)

So, I wanted to do a frame-by-frame animation of PNGs. I tried with AnimationDrawable, but OutOfMemory error comes quickly (I have a lot of PNGs). So I came upon SurfaceView. But I am stuck, because I really don't find any useful tutoirals/examples.

What is the best way to make an animation like this?

Here there already is a great answer to almost the same question, but all the links there don't work anymore.

I would really like to here suggestions how to make an animation frame-by-frame with PNGs in Android and if you have any tutorials or examples, I will be really happy :)

EDIT

I thought wrong about sprites, I think... Sorry, but I am a noob at game developing :) I have 60 PNG pictures (40kb, 427*420px each - on disk) which I would like to put in a animation. Is this even possible to do it with frame by frame animation?

The most similar and famous game that is close to mine is Talking Tom (but I don't know if they have frame-by-frame or any other method for animation).

sentences:
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:
Unity3D filling visible camera area with objects I'm developing an isometric tile-based game using Unity 3D.

I'm using an orthographic camera looking down yaw:45° and pitch:45°.

The game has an infinite world, which is loaded from a remote server. Because it is impossible to load everything at once, the game should only load visible areas of world.

But I don't know how to determine which tiles should be requested from server in order to fill up all the visible space on the screen.

I tried loading tiles by chunks e.g. 16x16 tiles chunk around camera. But this looks hacky to me and sometimes leaves blank edges visible on the screen.

Is there better solution to simulate a continuous world on the client side?

sentences:
Implement ARToolkit SDK for Augmented reality for iOS application I am actually new to Augmented Reality and I have to make a simple augmented reality app of rendering a 3d object over camera view in iOS (Not with Unity!).

I have downloaded the ARToolKit and checked it by running the sample projects. In the sample project for iOS , there is a pattern/object recognition of an image and a 3d cube model is rendered over it.

My question is -
How do I change the image that is recognised? How is the pattern recognition code working in it ?
Secondly , how do I change the Cube (3d model) that is augmented over the camera view ?

Please help!
Thanks in advance!

sentences:
Drawing a continuous line with onTouchMoved callback i'm trying to draw a continues spline on every onTouchMoved call,
the functionality is supposed to be similar to the line drawing used in the iOS game - flight control.

i'm using it in the following manner:

constructor init:

conPointsArray = new PointArray();
conPointsArray->initWithCapacity(DEF_ARRAY_SIZE);
lineDrawer = DrawNode::create();

the onTouchMoved callback usage:

void line::onTouchMoved(cocos2d::Touch *Touch, cocos2d::Event *Event)
{
conPointsArray->addControlPoint(Touch->getLocation());
lineDrawer->drawCardinalSpline((conPointsArray), 0.5f, 100, Color4F::BLUE);
CCLOG("on touch moved x: %f y %f", Touch->getLocation().x, Touch->getLocation().y);
}

But the app is always crashing in a certain openGL function.

I assumed the reason for it is because the array is constantly changing and openGL is having trouble with it (and the fact i'm always sending the same array which is a bad idea, but just to see how things work), so i moved the drawing call to onTouchEnded, And indeed, The line was drawn, but only (as expected) after the onTouch action has ended.

What is the solution/best practice for this issue?

Cheers.

sentences:
How to make attention grabbing notifications? A lot of my play-testers miss the tutorial notifications in my game. The notifications fade into the screen and fade out after the player progresses away from where the tutorial was relevant. I've tried adding a moving gif (the little orange thing in picture below) but it still doesn't draw enough attention. Could someone please recommend me some options for how I can catch the user's attention better?
In the example below, the player is given their first "key item" in the game and I want to direct them to click on the "Special" items tab. About 60% of my play-testers open it up, while the other 40% skip past it by clicking the "Search" button to progress to the next part of the tutorial. Then some time later, when the player needs to check their "Special" items, they don't know where they are.

I'm a little unsure if I should prevent the player from progressing until they perform certain actions the tutorial asks. I feel it makes the game feel rigid, but as my game is more turn-based with decision buttons, its like I can teach them they can push blocks to make a staircase to get over a tall hill as one would in a simple platformer.

sentences:
Why are there weird texture artifacts in baked light which don't appear with realtime light? This is the comparison of the same scene, realtime light vs baked light.

What's am I wrong ?

EDIT: In particular, also texture are low quality (see image 2). Why ?

sentences:
Efficient vertex buffer memory management? I am building a voxel engine with a similar mechanism to minecraft(yes, I know...).
It works by loading and unloading individual chunks of 16*64*16 cubes each in a square grid around the player. This works fine for small render distances - like a 9x9 square grid of chunks. However, since updating a single vertex buffer entirely with a new mesh of millions of blocks each time a chunk is loaded/unloaded is inefficient, I have designed it so that each chunk has its own VB of fixed size, and rendering the entire world is basically looping through all the buffers, using d3dDeviceContext->IASetVertexBuffers(...).

When I increase the render distance, say to a square grid of 11x11 (around minecraft's large render distance), creating the vertex buffers simply cannot proceed beyond a certain point, and d3dDevice->CreateBuffer() returns E_OUTOFMEMORY.

So my question is: How do i manage the memory usage of the vertices, to both maintain good FPS (not using a single buffer for the entire terrain) and to have decent memory usage?

Additional Details:
My vertex datatype is a struct composed of x,y,z coords, u,v texture coords and 3 normal coords. I know it can be improved in ways like a single byte for normals, since in voxels there are only 6 possible directions, however this will come later.

The fixed size of each chunk's vertex buffer is 16*16*64*18 vertices (16*16*64 blocks with a maximum of half of the sides showing, or 36/2 vertices max per block). This could also use some work, as each of these buffers is around 10MB.

How do games like minecraft handle this amount of data at once? (not to say i am using 64 blocks high chunks, where minecraft has 256)
I have briefly considered using points as vertex shader inputs and expanding them to cubes in the geometry shader, to save 87.5% of the space, but this seems rather intense on the GPU.

sentences:
How to seperate gui input from world input? I have a GUI interface and a player that hase code to detect when the mouse is pressed.
When i mess with my GUI buttons the code for the player also fires off; an undesired behavior.  The code in the player is meant for mining or using his current item not meant for buttons.
Some people have suggested using _unhandled_input and mouse filters, but i havent gotten either of those to work.  Im just wondering what the common thing to do in the situation?

sentences:
Hobbyist game dev, want to create async multiplayer game. Are server costs manageable? I want to make the game I want to play, and that game happens to be an asynchronous multiplayer game. Think Hero Academy or Hearthstone, where there are 2 players and each submits moves to a central server. Alternatively (and not ideally), clients connect to each other and play is limited to a fixed window of connection, but still there needs to be a central server to acquire new opponents.

That said, this is very much going to be a hobby type endeavor - I'm just one guy after all. This is not going to commercially support itself. If I have 100 players ever, that would be fantastic.

Given that I'm going to have to eat server costs myself, what are my options for getting a server? I don't need much bandwidth or CPU, due to the nature of async games - only the sending of the gamestate/current move, and perhaps some checking of legal moves. Going to Amazon or getting dedicated hosting seems drastically overkill for what I want.

If it makes a difference, I'm intending to learn and use Unity for this.

sentences:
Visual Studio 2010 C++ & OpenGL project cannot detect .lib files So I'm trying to start a C++, OpenGL project on Visual Studio 2010, and I have put glut.h and glut32.dll in the project directory, along with the glut.dll and glut32.lib files in a folder named "glut" in the project directory.

I have also gone to "Porject Properties -> Linker -> Input -> Additional dependencies" and I have typed in "glut32.lib" at the end, and made sure I am not missing a semicolon.

when I try doing

#include "glut.h"

in the Main.cpp file, it complains

error LNK1104: cannot open file 'glut32.libkernel32.lib'

Am I missing any files? What am I doing wrong here?

sentences:
Scrolling with SDL2 & Box2d - My Camera isn't keeping up with my player I'm trying to get a game on the google play store before I'm 40 (long held dream to publish a game since the days of the speccy), I have just over a month to go so it's not looking good! Foolishly I decided to use SDL2 and Box2d to write the game, both technologies I have little experience in & to compound my misery I'm a noob at C++ so please bear with me if I've made a common error.

Basically I've managed to get a simple physics simulation up and running and have sorted applying my SDL textures to the box2d collision boxes, that all seems to be fine and dandy, where I've come a cropper is my player moves along a ground entity on the X axis,

I've managed to implement a scrolling background but it doesn't keep pace with the player, in which I mean the player moves across the screen instead of remaining central as I'd like him to and the background scrolls behind him. I've probably completely mis-interpreted how to manage my requirements and after days of searching for reference code I'm now at a bit of a loss.

Hopefully some kind soul can help me realise my dream! I've posted what code I think is relevant but if theres something missing I'll add it.

Player movements

// Get the position and angle of the player
playerPos = player.pl_body->GetPosition();
playerDeg = player.pl_body->GetAngle();
playerVel = player.pl_body->GetLinearVelocity();

float velChange = desiredVel - playerVel.x;
float impulse = player.pl_body->GetMass() * velChange; //disregard time factor
player.pl_body->ApplyLinearImpulse( b2Vec2(impulse,0), player.pl_body->GetWorldCenter(), true );

SDL2 rendering

//Render current frame using clips
SDL_Rect* playerCurrentClip = &playerClips[ plAnimFrame / 2 ];

// Render player texture to x & Y of player entity
gPlayerTexture.render (playerPos.x - player.PLAYER_WIDTH/2, playerPos.y - player.PLAYER_WIDTH/2, playerCurrentClip, playerDeg, NULL, flipType);

Camera setup

// Setup a surface for the camera area
SDL_Rect camera = {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
// Render background texture
gBackgroundTexture.render (0, 0, &camera, NULL, NULL, flipType);

Camera scrolling

//Center the camera over the player
camera.x = (playerPos.x + player.PLAYER_WIDTH / 2 ) - SCREEN_WIDTH / 2;

 //Keep the camera in bounds
 if( camera.x < 0 )
 {
     camera.x = 0;
 }
 if( camera.x > LEVEL_WIDTH - camera.w )
 {
     camera.x = LEVEL_WIDTH - camera.w;
 }

sentences:
Mobu: Motion Files Naming Scheme for Unity When exporting takes as several fbx files in Motionbuilder 2014 with File > Motion File Export..., the files are named like so:

file_Take1.fbx
file_Take2.fbx
file_Take3.fbx

In order for the motion files to be loaded into Unity correctly, I have to rename them to:

file@Take1.fbx
file@Take2.fbx
file@Take3.fbx

Having to replace underscores with '@' is fine for small projects but can become time consuming when working with many takes in large projects.
Is there a way to change the default naming scheme in Motionbuilder, through preferences or python scripting, so that the default underscore is replaced with an '@'?

sentences:
Raycasting from an object to the center of the screen (crosshair) without clipping through objects Am trying to learn about Raycasting, and I thought I would start with something simple, and that was a laser that would come out of an object (think laser pointer in your hand) and always go to the crosshair.

Using ViewportToWorldPoint I found it easy to cast a ray from the center of the camera, but this had an issue as you can see in this GIF below.

The line would clip through because the ray was coming from the center, not off to the side where the laser pointer would be.

Am not sure how to solve this.

void Update(){
    Vector3 ray = Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f));

    line.SetPosition(0, transform.position);

    RaycastHit hit;

    if(Physics.Raycast(ray, Camera.main.transform.forward, out hit, raylength)){
        if(hit.collider != null){
            line.SetPosition(1, hit.point);
        }
    } else {
        Vector3 pos = line.GetPosition(0);
        line.SetPosition(1, ray + (Camera.main.transform.forward * raylength));
    }
}

The closest thing I could find that I am trying to replicate for this exercise is the No Man's Sky mining tool

sentences:
Why isn't particle hair more popular in games? Blender 2.80 introduced EEVEE, a new realtime renderer, and after interacting with it for a while I was impressed by how well it handles particle hair in terms of performance and visuals. It even manages to reflect light through SSR.

Sphere with 200 parent hair particles, 50 child particles per parent

Blender isn't a game and they probably have different concerns and priorities regarding the performance of the application, so this might be a good reason not to see this being implemented in games right now but still, seeing how well EEVEE manages it and also knowing that games have user-customizable graphic settings, I don't understand why we're still using planes with textures and other techniques like that as our best effort for realtime graphics in games.

Of course having one million strands makes even Blender struggle to keep a reasonable framerate, but a game probably wouldn't need such a dense hair to look convincing and could cheat by having baked hair textures on the scalp in case gaps become visible close-up.

A friend of mine has said Nvidia HairWorks accomplishes just this, but looking at some screenshots I doubt that's the case (if it is, then maybe the technology has evolved a lot lately and nvidia has some catch up to do? I don't know but from what I've seen it doesn't look that good).

So, why isn't particle hair more popular in games?

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: Vehicle audio recording So I red an article on "The sound effect" website about recording the audio of a vehicle. I'm planning on making a race game in the future and I'm having a little concern about the sound of the vehicles and I want to ask is what if you have not seen the car for lamboghini veneno in your life let alone record it. How do you go with it?

sentences:
How can I reference the frontmost part of a mesh in my Unity code? (and help making FPS projectiles seem more real) I have started making a PC game using Unity. It's just a test project, where I'm making as basic as possible FPS shooter.

I'm using the FPS Controller prefab, and I have also a rifle model attached to it. The result is pretty much what I wanted.

Now I'm considering how I want to create projectiles for the gunfire. I think it will be best for me to create each bullet as just being a ray from the gun barrel heading forwards, OR I might create rigidbodies from the gun barrel I'm not sure yet.

My question is: What is the proper way to reference the point in space in which the gun barrel current ends? At the moment, I am thinking just attach ANOTHER gameObject to the gun model, and just manually position it where the barrel finishes. But this seems 'cheaty' and I think perhaps there is a better way (something like mesh.position.z + mesh.length, but I can't seem to find anything like mesh.length).

I haven't posted code at all, because I haven't really written any on this project yet.

I would also be very interested to hear the pro-tip version of how best to simulate this gunfire (ie. is it best to use rigidbodies? or somehow use raycast or something? or some better way that I haven't even dreamt of)

sentences:
Creating a smooth transition between materials on large models using Unity and/or Blender I'm not sure if this is possible or not but I would like to create a smooth transition (cross-fade) between two textures on a 3D model made in Blender that can be imported to Unity.

For example if I have a model with two materials, the edges where the materials meet is an abrupt change. How would I go about creating a smooth transition across the edge where the materials meet?

I've seen some tutorials on using cycles in Blender to achieve this, but to the best of knowledge the cycles rendering cannot be brought into Unity.  Projection painting in Blender using an image as the brush is also a possibility, but the models I'm trying to do this on are rather large and would lose resolution in their textures because of this.  Is something like Substance Painter by Allegarithmic what I need?

sentences: What is ambient occlusion? I've heard about ambient occlusion and it looks nice, but what exactly is it?

sentences:
Snake4d - a 4 spatial dimensional game I wrote a little 4 spatial dimension game, it's a 4D snake. The rule are the same as the game for the old Nokia cell phone - eat the food, don't cross yourself, don't go out of the borders.

What do you think of the idea? How do I make a better graphic of the UI? Do you have any suggestion? Like this actually seem a DOS game ...

Here is a little explanatory video: http://www.youtube.com/watch?v=8IUnqm8j4BE

And here there is a new version I did with OpenGL and C++: http://www.youtube.com/watch?v=NaeqUp3jbls

Moreover I have a question, which from the two representation above you like more? Or better, do you have any idea how to represent the 4 dimension at the best?

Btw any comments, suggestions, and questions are appreciated about the UI, the game concept, etc.

sentences:
how to add a mob to Minecraft [1.16] I have tried to search around google, Bing, and Minecraft forums. I wand to ADD a NEW mob to the game.
------------ requirements for the answer -------

it has to be compatible for 1.16.4
it has to be how to add a new mob not change an existing
no spam
it cannot be a mod to add this to Minecraft
I want it to be in my resource pack
If I have to create a new pack, that is fine

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:
Are Textures cached by GPU or buffered from memory for every frame? Are the textures buffered from memory(RAM) for each Draw Call/Frame or are cached in VRAM.

As per my research, I believe in the former case, if it is, then isn't the second approach a better option?

For example, in First Person Shooter games, the weapon is going to be rendered 98% of the time, so are those weapon textures cached by the GPU locally?

I am not sure about this, so I hope someone could explain this.

sentences:
Donut-shaped / inverse mask in Phaser I am trying to get a donut-shaped mask in Phaser (essentially the inverse of a regular mask). The mask shape is dynamic so it needs to be a Phaser.Graphics polygon object.

Desired result:

The blue shape is the sprite I want to mask, the hole in it is the mask itself.

I've searched the Phaser and Pixi v2 documentation and forums - found nothing though. Anybody who knows how I can do this?

If it is not possible, I am thinking of dividing the mask up into eight polygons:

How sound is that idea? Is that going to be expensive or would it be ok? Or any other ways to achieve this?

sentences:
Texturize a shape of multiple triangles in 2D This is an example of a shape consisting of multiple points, triangles and eventually a shape:

Red Dots = Vector3 (X, Y, Z) or Vector2 (X, Y)

If I have a Texture of a certain size, how do I texturize this area in the best way so that the texture inside the shape matches the shape and does not overlap anywhere? Perhaps also with a chance to scale the texture in case it's too small or to big for the shape, but still so that it gets rendered correctly.

Do I treat the shape as a rectangle? Figure out it's 4 corners?
Or do I calculate the distance between Center - (Texture Width / 2) and Point (to see how "many" times the texture can fit between on that axis to estimate at what Coordinates the Texture should be at that certain point?

I've looked at Texture Mapping but haven't found any concrete examples that it explains it well, it's also confusing with 0.0-1.0 values for Texture Coordinates.

sentences:
Modify the effect of a card being played I'm trying to recreate a simple card game. Each played card has an action (draw extra cards, peek at draw stack, eliminate an opponent card, etc). Once played, it goes on a stack, and the card effect is executed in order.

Cards added by effects are added at the end of this stack as well, and executed once it is their turn.

Each player also has a different unique influence on exactly one type of cards that changes the effect (enhances it like draw 4 instead of 2 or taking cards instead of trashing them to graveyard).

So far a card has a simple interface with value, type and doAction. While I could on each card do a check if a player influence would take effect, this seems like a hard coded noodle salad and makes it difficult to add new cards or influences. And more than once influence can take effect on the same card (for example, one effect could be steal 2 instead of 1 and the second effect, you can steal only a certain type of card from a second influence instead of free choice)

I'm looking for a way to react on a method call (played card that gets executed) and change it accordingly. I'm investigating using delegates for this purpose.

sentences:
OpenGL strange color issue I recently made terrain generation for my game, and I created a lighting system (simply diffuse lignting), but there's a strange problem around the edges.

I know, OpenGL interpolates the different values between the vertex shader and fragment shader, but in this case, it comes out strangely. Here is the issue:

The edges of the squares look a little jagged (I use triangles).

I especially don't understand this one:

Every vertex of that area is dark, but the middle is lighter.

Here are the codes for the vertex and fragment shader:

Vertex shader:

#version 330 core

in vec3 vertex;
in vec3 normal;
in vec4 color;

uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;

out vec3 vertexNormal;
out vec3 cameraPos;
out vec3 vert;
out vec4 vertColor;

void main() {
    gl_Position = projection * view * model * vec4(vertex, 1.0);
    vertexNormal = normal;
    cameraPos = vec3(view[3][0], view[3][1], view[3][2]);
    vert = vertex;
    vertColor = color;
}

Fragment shader:

#version 330 core

in vec3 vertexNormal;
in vec3 cameraPos;
in vec3 vert;
in vec4 vertColor;

uniform vec3 sunColor;
uniform vec3 sunDirection;

void main() {
    vec3 toLightVector = -sunDirection;
    vec3 uLightVector = normalize(toLightVector);

    float diffuse = max(dot(uLightVector, vertexNormal), 0.1);
    vec3 lightColor = diffuse * sunColor;

    gl_FragColor = vec4(lightColor, 1.0) * vertColor;
}

sentences:
Having multiple different friction values on a single piece of track? I am trying to figure out a good/performant way to give a piece of track multiple values of dynamic friction. A track piece is 10x10 units in Unity and the idea is to puzzle them together to a big track like the tracks in Trackmania. The game itself features no acceleration, except from gravity. To make things more interesting I want to give each track piece at the start of the scene multiple random friction values within a given range.
Currently I achieve this by making each piece of track consisting of 100 little tiles which are 1x1 units and they get a random friction values assigned. This approach works somewhat fine as long as there are less than 30 to 40 track pieces(3000-4000 tiles) but with more than that the fps are dropping really low. As it is a racing type of game I had to set the "Fixed Timestep" in the project settings to 0.001 to get accurate time measurments and this is hurting the performance as well. With a lower timestep the collision detection with all the little tiles is really bad too.
Is there a more elegant and/or performant way to achieve this in within the unity physics system?

sentences:
Drawbacks of using reflection for a component based system at loading-time I'm coding a little casual game in Java using Slick2D.

This game use a lot of different "objects", managed in a composite way. So, firearms, furniture in the map, NPC and player character will be composites objects using components to define their behaviors.

Since I'm going to need a lot of, for instance, "shotgun" object, I'm using a sort of prototype pattern. When the player starts the game, XML files are read, and from those XML, typical objects are built and stored in a "EntityPool" class' hashtable. Then, when I'll need a shotgun, for instance, I'll ask for it to the EntityPool, which will give me a clone of this object.

My problem is as follow : I'm using JDOM to parse my XML. I don't know how many components I'm going to use, nor their exact methods. So I'd like to use reflection; a Class.forName(nameOfMyClass) in order to get the exact component for this class, and then a Class.getMethod("set" + propertyName) to fill the information I need.

So my XML can be like that :

<Entity name="window">
  <Component class="Breakable">
    <health>12</health>
    <newEntityAfterBeingBroken>brokenWindow<newEntityAfterBeingBroken>
  </Component>
  <Component class="Renderer">
     <tileset>object.png</tileset>
     <imgnum>2</imgnum>
  </Component>
</Entity>
...

There are obvious drawbacks to using reflection, particularly the lack in performance. But this is done only once, when loading the game. Do you see other problems with this method? Would you do it differently, and how? Thanks in advance for your advice!

sentences:
Implementing a wait function in a game script I have been implementing behavior for enemies in my game and so far I have been doing it sort of like below:

public void update()
{
    if (frame > 60 && frame % 30 == 0)
    {
        shootAtPlayer();
    }
    frame++;
}

Which is meaning after frame 60 shoot the player every 30 frames. The frame-count is important as the game is fixed frame-rate and everything is relying on this at the moment. There are many small scripts for enemy behavior like above and I currently iterate through each one calling update(). I have realized it will quickly get unweildy dealing in absolute frames and I want to move towards a pattern where I can specify to do X for 60 frames then do Y e.t.c, something that is easily understandable and easy to write. I want to go for something like below:

wait(60)
while(true)
{
    shootAtPlayer();
    wait(30);
}

I was wondering if there is a design pattern that would easily support such a syntax. My initial thoughts were to create a thread for each script object and have the wait implemented similar to below:

wait(int frames)
{
    while(frames > 0)
    {
        frames--;
        suspend();
    }
}

with the method running the scripts calling resume in turn on each script. I could potentially have up to 300 scripts running at once which would mean 300 threads to handle. Am I taking the correct approach to solving this problem?

I am programming this in C# XNA.

sentences:
Getting a texture from a renderbuffer in OpenGL? I've got a renderbuffer (DepthStencil) in an FBO and I need to get a texture from it. I can't have both a DepthComponent texture and a DepthStencil renderbuffer in the FBO, it seems, so I need some way to convert the renderbuffer to a DepthComponent texture after I'm done with it for use later down the pipeline.

I've tried plenty of techniques to grab the depth component from the renderbuffer for weeks but I always come out with junk. All I want at the end is the same texture I'd get from an FBO if I wasn't using a renderbuffer. Can anyone post some comprehensive instructions or code that covers this seemingly simple operation?

EDIT:

Linky to an extract version of the code
http://dl.dropbox.com/u/9279501/fbo.cs

Screeny of the Depth of Field effect + FBO - without depth(!)
http://i.stack.imgur.com/Hj9Oe.jpg

Screeny without Depth of Field effect + FBO - depth working fine
http://i.stack.imgur.com/boOm1.jpg

sentences:
Ragdoll on alive creatures: has somebody already implemented it? I find that a dead creature falling realistically is boring.

I wonder, has any game implemented an animation system where the model moves depending of the muscle forces and the velocity of the limbs, but calculated ingame ?

It is much faster to have determinate animation data which is loaded and is just read sequentially, but it looks much "static".

Since I hear a lot about procedural generated data, one could generate a body with its own animation depending of the weight of the bones.

I'm not talking about a real-life robot simulation where the bone is standing, auto-adjusting some angles to keep balance, but something more intermediate and more pre-calculated.

The forces vary slightly between steps (some random on a float so vary plus or minus 10%), so the trajectory of the limbsvary between steps.

It would require a lot of adjustement and preconfiguration, but it would look much less deterministic.

sentences:
XNA Spritebatch sorting by texture vs depth I am refining my 2D game engine, and I want to look in to sorting sprite batches by texture (because I'm quite often using the same textures repeatedly).

However, I also want to retain a few 'layers' of depth (i.e. ground < buildings < units < GUI etc).

My question is, which of the following is the best approach (in terms of performance)?

Create multiple SpriteBatches and Begin() and End() them in order; or...
Create a single SpriteBatch and call Begin() and End() multiple times, once for each layer (in order)?

sentences:
XNA mesh.Draw() takes the longest CPU time We have a problem. Our game steadily slows down as we increase the number of models we draw. When the number reaches 100 - FPS is dead. Our humble tests showed that the reason is not GPU. This is what we did:

Rendered models with the most basic shader code - nothing changed;
Checked the NVidia NSigt metrics - GPU was less and less loaded per second as we increased number of models;

At the same time, a simple Windows Task manager showed that, as the number of models rise, the load increases (up to a 100%) on the single CPU core that our game uses. So we are pretty sure our game is running slowly because of the CPU.

We then moved on and tried to identify which line exactly causes the problem. We used c# TimeSpan metrics and timers for that. Our research showed that the biggest cause of the slow performance is... mesh.Draw() function used by every model that we draw.

We tried commenting this very line and things improved instantly (ofc. nothing was drawn on the screen).

So the question is, what are we to conclude from this? mesh.Draw is a closed function and we cannot optimize it. Trying to bruteforce parallel it is impossible (i guess it was natural). But something tells me that we need to look elswhere if this function is slowing the CPU, the question is where?

Update: here is the code I use to draw the model:
            public void Draw(...)
            {
                int index = 0;

            int i = 0;

            foreach (ModelMesh mesh in Actor.Model.Meshes)
            {

                bool isDrawable = false;
                #region Check if this ModelMesh needs to be drawn according to PartsToDraw (string) list.
                foreach (string s in PartsToDraw)
                    if (s == mesh.Name)
                        isDrawable = true;
                #endregion

                if (isDrawable)
                {
                    int effectStartIndex = index;
                    foreach (Effect effect in mesh.Effects)
                    {
                        if (Actor.MatrixPaletteParams[index] != null)
                        {
                            Actor.WorldParams[index].SetValue(World);
                            Actor.MatrixPaletteParams[index].SetValue(Actor.Palette[i]);
                        }
                        else
                            Actor.WorldParams[index].SetValue(Actor.Pose[mesh.ParentBone.Index] * World);

                        if (drawType != null && drawType.DrawShadow)
                            SetShadowEffectParameters(effect, renderer, drawType.DrawShadowMort);
                        else
                        {
                            SetCommonEffectParameters(effect, renderer);
                            SetLitEffectParameters(effect, renderer, drawType);
                        }

                        index++;
                    }
                }
                else
                    index++;

                if (isDrawable)
                    mesh.Draw();

                i++;
            }
        }

"Set...EfectParameters" methods mostly consist of effect.Parameters["SomeParameter"].SetValue() calls. I pass around 30 parameters to the GPU there, mostly floats, matrices and bools. Moreover each ModelMesh has three textures that it passes into the GPU. I have no idea how fast this works and if it can be optimized. It should be fast.

You should also note that I draw a skeletaly animated model using Dastle's XNA Animation Component library. Once again, I understand that this might be the reason behind lags, and we did find the weak spot of the animation code, but why on Earth does the metrics show that mesh.Draw is the slowest spot? What is happening there?

sentences:
OpenGL and constant buffers I'm doing a small direct3d11 project for "fun". I know d3d11 quite well but not really any opengl. My program is designed for d3d11 but I would like it to be easy to port to opengl at some point so I'm trying to keep to abstractions that are somewhat portable. The concepts of vertex buffer, index buffers, vertex shaders, pixel shaders, and some form of input layout structures all seem to map pretty well.

But what about constant buffers? all of the examples I see of opengl shaders have code getting "pointers" to named variables in the shader and setting them whereas my code for d3d11 just creates a big c++ struct and copies it into a constant buffer. This then maps directly to a cbuffer in the shader.

Does the same concept exist in opengl? I've been unable to find it with any quick searches. Or do I have to set named variables only?

sentences:
With a rolling pawn, how can I have a component that follows its rotation, but stays upright and only rolls? I'm using the UE4 rolling pawn to create a Metroid Prime morph ball style pawn. I've got it set up with a ribbon particle component on a spring arm, inheriting yaw, but if I set it to inherit roll, the axes invert and cause the particle emitter to flip and break the ribbon trail.

I'm sure there's some kind of rotation math that it needs, but it's beyond me. I've tried doing various math things to the axes, but I haven't been able to get it to click at all.

sentences:
Prevent GUI Clickthrough I'm using NGUI to setup my UI in Unity.

Attached to the MainCamera I do have a script to rotate the camera view by clicking and dragging.

It does handle mouse events using Input.GetMouseButton().

The problem is that if I click and drag when the mouse is over a NGUI element (Button, Panel, Slider, whatever), NGUI handles all the mouse events correctly, but they also go through the MainCamera, and the camera rotate.

I want to prevent that.

If I use for example the Unity GUI.Button(), the mouse events are not transfered to the MainCamera and the camera does not rotate.

I have to replicate that, but using NGUI.

I have searched on their support forum, but i couldn't find a solution.

sentences:
Understanding the Entity-Component Model Possible Duplicate:
  Role of an entity state in a component based system?

So, I've heard a bit about a model of game programming that involves creating entities and then attaching different components to them to change their behaviour. So, an enemy entity might have attached components of AI, collision physics, etc. This seems like an excellent way to solve a lot of the problems in creating an engine, but I don't really have a precise idea of what exactly an entity or component is.

So my question then: what exactly should an entity object encapsulate? How would I go about attaching components to it?

sentences:
What does Mecanim's "loop pose" parameter do? What exactly does the loop pose parameter do?

What's the difference between enabling or disabling it on animation clips?

sentences:
Frame Buffer Object (FBO) is not working. What is the right way to use? I am trying to use FBO but i am living some problems. I will show you my steps but first i will show my running screen ,so we can compare them. Like before fbo after fbo.

My running screen and Draw() function code:

glClearColor(0.5,0.5,0.5,1.0);
glLoadIdentity();
glTranslatef(0.0,0.0,-3.0);
glRotatef(0,0.0,1.0,0.0);
glUniform3f(glGetUniformLocation(mainShader->getProgramId(),"lightPos"),0,1,2);
mainShader->useShader();
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    scene->draw(mainShader->getProgramId());
mainShader->delShader();

After I tried to add FBO :

Create FBO texture function:

unsigned int createTexture(int w,int h,bool isDepth=false)
{
    unsigned int textureId;
    glGenTextures(1,&textureId);
    glBindTexture(GL_TEXTURE_2D,textureId);
    glTexImage2D(GL_TEXTURE_2D,0,(!isDepth ? GL_RGBA8 : GL_DEPTH_COMPONENT),w,h,0,isDepth ? GL_DEPTH_COMPONENT : GL_RGBA,GL_FLOAT,NULL);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);

    int i;
    i=glGetError();
    if(i!=0)
    {
        std::cout << "Error happened while loading the texture: " << i << std::endl;
    }
    glBindTexture(GL_TEXTURE_2D,0);
    return textureId;
}

Init() function :

void init()
{
    glClearColor(0,0,0,1);
    glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluPerspective(50,640.0/480.0,1,1000);
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_DEPTH_TEST);
    mainShader=new shader("vertex.vs","fragment.frag");
    quadRenderShader=new shader("quadRender.vs","quadRender.frag");
    scene=new meshLoader("test.blend");

    renderTexture=createTexture(640,480);
    depthTexture=createTexture(640,480,true);
    glGenFramebuffers(1,&FBO);
    glBindFramebuffer(GL_FRAMEBUFFER,FBO);
    //GL_COLOR_ATTACHMENT0
    //GL_DEPTH_ATTACHMENT
    glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,renderTexture,0);

    glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D,depthTexture,0);

    int i=glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if(i!=GL_FRAMEBUFFER_COMPLETE)
    {
        std::cout << "Framebuffer is not OK, status=" << i << std::endl;
    }
    glBindFramebuffer(GL_FRAMEBUFFER,0);

}

And Draw() function:

void display()
{
    //rendering to texture...
    glClearColor(0.5,0.5,0.5,1.0);
    glLoadIdentity();
    glTranslatef(0.0,0.0,-3.0);
    glRotatef(0,0.0,1.0,0.0);
    glUniform3f(glGetUniformLocation(mainShader->getProgramId(),"lightPos"),0,1,2);
    mainShader->useShader();
    glBindFramebuffer(GL_FRAMEBUFFER,FBO);
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        scene->draw(mainShader->getProgramId());
    glBindFramebuffer(GL_FRAMEBUFFER,0);
    mainShader->delShader();

    glClearColor(0.0,0.0,0.0,1.0);
    //render texture to screen
    glLoadIdentity();
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    quadRenderShader->useShader();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D,depthTexture);
    glUniform1i(glGetUniformLocation(quadRenderShader->getProgramId(),"texture"),0);
    quad->draw(quadRenderShader->getProgramId());
    quadRenderShader->delShader();

}

and Result only drawing last setup color (glClearColor) so black :

Result should be like in tutorial :

Note: I know tutorial monkey is purple but it is not problem.

sentences:
How can I take ingame images and videos? I’m using MonoGame and Visual Studio Community on my Mac to develop a game for iOS. I want to take ingame images and videos of the gameplay while the game is running on an iPhone/iPad. Afterwards, I want to use these images and videos for promotional reasons on my website or on facebook.

Is it necessary to install third party software or can I take images and videos in Visual Studio Community without installing additional software?

sentences:
Why are the sprites in my AssetBundles ending up as Texture2Ds instead of Sprites? I packed some sprites into an AssetBundle and uploaded it to my server. The sprites are set to type Advanced, so I can check the read/write enabled box.

When my game downloads it I want to initialize a sprite:

Sprite sprite = (Sprite)Instantiate(bundle.LoadAsset("1.png"));

This is not possible because apparently the asset is not a sprite (but it is...) - it seems like, for some reason, the asset is a Texture2D object rather than a Sprite one (why?). So I have to do something like this:

Texture2D tex = ((Texture2D)Instantiate(bundle.LoadAsset("1.png")));
Sprite sprite = Sprite.Create(tex,new Rect(0,0,tex.width,tex.height));

And that's fine. But I have the feeling this is not how it's supposed to be: why is my asset a Texture2D and not a Sprite already? Why do I need to create a brand new Sprite?

sentences:
Compile time error handling for single programmer games? Hey.
My input system has a GetKey() method that returns a key in a map. Simple enough.
However, I want to know if the key is not available - be it a typo, or misuse of wording, or something else.
I am the only person working on this project; would it be a good idea to simply set some compile time throw to see if it catches one? Is this even possible?
What I'm meaning is:
 if(entry is not found) { throw something("couldn't find key"); exit(); }
Rather than an approach of
if(entry is not found) { try and compensate somehow and continue }
And then go through the code and find where I've made a mistake. Of course, for a large project I would want real error handling like the second. But I can just get rid of these errors, since there's no modding. But I'm the only one working, so is this probably the easiest way to do it?
Well, it's this or make some kind of BLANK key and check it every query.
EDIT: I am using strings as my keys, so no translate functions would be easy.
Double EDIT: I bind commands (strings) to keys (wrapper over an enum value). It means it's more understandable to check if "move_left" has been pressed than if keyCode::A has been, as well as being more changeable.

sentences:
How to become a Ph.D. in video game design? The title says it all, I am wondering if it is possible and if so, how it would be possible, to become a Ph.D. in video game design. I'm quite sure you can become a Ph.D. in pretty much anything, but since video games are such an informal and relatively young sector, I thought I'd ask.

Thanks in advance!

sentences:
Game Physics: Calculating a collision response using the Separating Axis Theorem? I am working on a project in which I have implemented the Separating Axis Theorem to detect collisions between objects. My current collision response is an object that contains whether it is overlapping and what the minimum translation vector (MTV) is.

I then take the MTV and add it to the linear velocity of the object we're testing. This all works fine. However, I want to add rotational forces to the object based on the collision. For this, I imagine we will need two things:

The Minimum Translation Vector, which represents the force
A contact point, which is the point at which the MTV-force gets applied to the object

However, I have been struggling with calculating the contact point for the past two/three days. I haven't been able to find good resources on this, unfortunately.

How would I go about calculating a suitable collision response as I described? Thank you very much!

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 parent object to empty when looked at I am making a fps in unity. I have an empty parented to the camera for the gun, and I want to be able to pick up and drop guns found in the scene. Does anyone have a simple c # script that would allow the player to look at the gun on the ground, press a key and have it be parented to the empty? I would also like for the player's old gun to drop on the floor where the one being picked up was and un-parent from the empty when the new gun is picked up. If you want an example I guess you could say it is like halo where you can go around and pick up new guns. I am not looking to make an inventory, just a simple script where you can swap your weapon.

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:
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:
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:
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:
Spawning large numbers of navmeshagents causes them to jump position Cross posted on StackOverflow

I'm making a tower defense style game in 3D using Unity. I'm experiencing a frustrating issue with spawning large numbers of characters in an area of navmesh where if I spawn too many near the same location many of them will 'teleport' immediately after instantiation to near the navmesh destination.

Here's a doodle of one of the levels:

The black spot is the player base the NPCs have to get to. The green scenery has no navmesh and uses mesh colliders. Scenery is mostly steep hills forming a valley the NPCs should path through. It is composed of multiple meshes marked Unwalkable in navigation. The large blue spot is the first spawn location I tried, I later tried a larger area indicated in the right side of the image (see 'things I've tried' below).

When instantiating at the original spawn location if I spawn more than about 20 NPCs at once many of them will jump to the the area indicated by the red spots.
The NPCs have a radius of about 1.5m, as do their colliders and navmeshagents avoidance property.

Things I've tried:

Spawning to a random position inside a circle with a radius of 50m.
Adding a large new hidden area of navmesh as in the image above,
defining an array of vector positions spread well apart and spawning
at each position in turn so no two navmeshagents spawn near each
other.
Adding a delay to navmeshAgent.SetDestination(playerBase)
after instantiation hoping this would prevent the immediate jump to
near the destination.
Reducing navmeshagents avoidance radius. This sometimes
reduces the problem a little but still, even with a radius of 0.1 any
more than around 50 NPCs triggers the problem.
Turning avoidance off althogether (setting to none in navmeshagent), again, can spawn more but problem still happens
Turning off auto traverse links and auto repath in navmeshagent
Increasing the time between instantiations, a large gap of several seconds works but makes the game too easy
Not setting a destination - oddly they still teleport to near the player base,  so I guess destination is not a factor

How can I spawn large numbers of navmeshagents in a short timeframe, avoiding this 'teleporting' behaviour?

sentences:
What is GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS? I am a beginner in OpenGL. I am learning about textures in OpenGL. What I don't understand is how to determine how many texture units are in the GPU. I heard someone said that you can see how many texture units by writing the following code.
int total_units;
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &total_units);
std::cout << total_units << '\n';  // the result is 192

Is there 192 texture units in my GPU?  In documentation, it says:

GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
params returns one value, the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined. If both the vertex shader and the fragment processing stage access the same texture image unit, then that counts as using two texture image units against this limit. The value must be at least 48. See glActiveTexture.

So I wanted to know how many texture units can be used to access texture maps from the vertex and fragment shaders. So I wrote and run the following code.
int vertex_units, fragment_units;
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &vertex_units);
std::cout << vertex_units << "\n";   // the result is 32
glGetInteferv(GL_MAX_TEXTURE_IMAGE_UNITS, &fragment_units);
std::cout << fragment_units << "\n"; // the result is also 32

So 32+32=64. But why does GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS shows me the result of 192? I think I am missing something. What do I need to calculate to get 192?
And also, in OpenGL, why are there only GL_TEXTURE0 to GL_TEXTURE31 macros? I think these macros are for each shaders. Am I right?

sentences:
How to store and retrieve user data in a multiplayer game I am building a multiplayer game with a team and each player will have a multiplayer rank, a matchmaking rating (MMR), a username, and possibly a picture, a description etc.
We are planning on delivering the game on multiple platforms such as Steam, itch.io and GoG.

Since I am using Unity, how can I store and retrieve such data independently of the platform ? Is there a builtin service provided by Unity or do I have to create some SQL database and code all of the logic to use it ?

sentences:
How do you implement AABB? I am having some trouble peforming an overlap test on a axis aligned bounding box.

Here is my code

public boolean overlapps(AABB other) {
    return false;
   }

}

I don't know how to implement this method.

Here is what I tried

public boolean overlapps(AABB other) {
    if(min.x <= other.max.x && max.x >= other.min.x) {
        if(min.y <= other.max.y && max.y >= other.min.y) {
            if(min.z <= other.max.z && max.z >= other.min.z) {
                return true;
            }
        }
    }
    return false;
}

sentences:
Recognising when a user is clicking below a particular sprite I have a game, built using pixi.js, where I want to run some code every time the user presses below a certain sprite. I am handling the press event using hammer.js. The problem is that the y attribute of the sprite and the y attribute of the user’s touch event don’t  match what I can see on my screen.

As, an example, consider the code below:

if (touchPointer.clientY > this.children.marker1.position.y) {
  console.log("******* Clicked Below the Line ********: ");}
else{
  console.log("******* Clicked Above the Line ********: ");}

The problem I have is that, when I click slightly above the sprite, the first section of code will run (which prints “Clicked Below the Sprit”), even though on the screen, I can clearly see the pointer is above the sprite.
I am guessing, what’s going on is that the y positions for the pointer and the sprite are being calculated differently, but I don’t know how to go about ensuring they’re calculated consistently, so I can properly compare sprites against the pointer. Any suggestions?

sentences:
How to automatically generate (creative) names for stuff? How can I get large number (100-1000-10 000) of names, that are at most average hard to spell for things like places, weapons (and NPCs).

Have a look at TES4 Oblivion or TES% Skyrim.

http://www.uesp.net/wiki/Oblivion:Places

Yes, I understand, that they have paid army of designers for years.

My questions is how this people are creating those names?
Is there some hints for this, like should have at least/most this amount of letters or maybe let's create three sets of words - beginnings, middle and endings, and then take one random word from each?

Can it be automatized? Do they check, if created name means anything in any language?

This question is meant as extension for other questions like this, especially: Name generation

Above question was about NPC names, I am looking for something generic, especially for places and artifact names.

I am aware of Markov chains, but even after automatic generation, I would need a way to check, if this "sounds" good and if it means anything in nay language.

As much as second thing can be probably automatized, that first one not really.

Is there any full solution? Do we know, what kind of solution does Oblivion/Skyrim use? Most important part of this question is automatizing part.

sentences:
How can I achieve long-distance rendering of static terrain and props in an open-world context? How can I perform seamless rendering of long-distance vistas in a fashion suitable for an open-world game (e.g., where the player is relatively unconstrained in how they traverse the world)?

For the purposes of this question, I'm only concerned with rendering of static objects: terrain and large props, as my game world is relative devoid of dynamic actors outside of the player.

The PS4 remake of Shadow of The Colossus™ illustrates the kind of effect I'm going for:

sentences:
Image-Space coherence of the z-buffer algorithm I'm reading Hierarchical z-Buffer Visibility by Ned Greene et al. and they state that

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

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

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

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

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:
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:
Getting position of finger along a screen I'm trying to get a list of Vector2 position by tracking my finger and then tracing them with a prefab (Basically just gestures). I have appended an onGUI function to help print out the list of vectors.

However, the attached code does not work and only prints "System.collection.Generic.List'1[UnityEngine.Vector2] when my finger moves along the screen.
I know I'm missing something; any help would be greatly appreciated.

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

public class line : MonoBehaviour
{

    List<Vector2> movePos = new List<Vector2>();
    private float lastFingerRelease;
    public String printer;

    void Start()
    {

    }

    void Update()
    {

        if (Input.touchCount > 0)
        {

            Touch touch = Input.GetTouch(0);

            if(touch.phase == TouchPhase.Began && Time.time - lastFingerRelease > 2)
            {

                printer = movePos.ToString();

                movePos.Clear();
            }

            else if (touch.phase == TouchPhase.Ended)
            {
                lastFingerRelease = Time.time;
            }

            movePos.Add(touch.position);
        }

    }

   void OnGUI()
    {
        GUI.Label(new Rect(0, 0, 1000, 1000), printer);
    }

}

sentences:
Java 2d Gaming, best practice to update random falling objects I'm new to game development. I do have basic knowledge in Java and also have moderately good experience in OOP from other languages.

I started developing this simple 2D game as my first project.

The game is simple, I have a character, I can move only right and left with constant speed.

I want to add obstacle objects that fall from the sky (top) that I have to dodge. I created the main class (StartingClass) that contains the game loop. receives input from the user's keyboard and moves the character accordingly.

I created a Character class which describes the character position, and reflect its position with painting its image.

Everything is well. However, I'm now trying to add the falling objects. My delima is how to implement them.

I started by creating a new class (FallingObject). In the instructor I create its width, height, falling speed.. etc (randomly). The issue I'm having is to determine how to update this object's position. I would have created an update method for the object and call it every time in the game loop to update its position. But my problem is I will have multiple objects falling simultaneously, each with different speed. So these are the solutions that came to my mind:

Visible/Active falling objects will be stored in an array list *

1) on every game loop, iterate over the falling objects and update them individually, which doesn't sound that friendly to me.

2) In the falling object instructor, when finished assigning the random values, call a synchronized "startFalling" method on the object, so it keeps falling until it hits the ground.

3) My FallingObject class would implement the runnable interface, and run the function described above through thread. But still... thread for each falling object? I'm not liking that idea.

So I would like to know if I'm somewhat in the right direction in my way of thinking to solve this issue, and which of the above suggestions you think is best, or if there's way better solutions (which I believe is true) that I'm unable to see due to my limited experience in game development design / java.

Thank you very much for your help and support!
Cheers
Shady

sentences:
Get intersection of vector in the middle of the screen My screen resolution is 640x480 and I have two Vector2 objects located at (10,10) and (600, 320).

How can I connect these two objects and extend the line to encompass the whole screens width, how can I get the Y for the intersection at the center of the width (320)?

sentences:
How would I tell the player what options they have without explicitly telling them? I'm writing a script for a game story which starts with a bombing of a school. You spawn in a room at the second floor. You play as a child and his 2 best friends and you have 2 options:

Hide in the bombing shelter with everyone else
Risk your lives in an attempt to get out of the schools

I need a way to non-explicitly tell the player to choose one of these options. Rather than tell the user straight out with a message box, I would like the story to tell this to the player.

How I think I might do this:
1. Have an opening scene where the ncps talk with the main character (the main character and his best friends) and initially discus the 2 options.
2. Leave the user to figure this out by giving him/her some clues. This might be an open door to get out of the school [2] , all the other npcs moving to the bombing shelter, etc [1].
3. Give a hint in the loading menu / pause menu. Not the smartest idea, however...

Does anyone have any ideas how to reveal the 2 options without explicitly stating so? I'm free to any ideas.

sentences:
Javascript tile map -> bitmap or JSON I would like to know which idea is better in terms of performance.

The map is 5000x5000 tiles and I plan to expand it even more. It is split into 50x50 regions and camera doesn't move with player, the map just switches to next one when player reaches border of the screen.

I have few possible approaches to store and load a big map like this.

Case 1: I store every 50x50 region in a seperate JSON file, and just load them dynamically with XHR when player reaches border of the screen (native not jquery, since it is much faster)

Case 2: I store every 50x50 region in a seperate bitmap files, and then load that image dynamically using canvas and read it's pixels to generate map.

Case 3: I store images in bigger chunks (ex. 1000x1000) and preload them all at the beginning of game and also read pixel by pixel when needed.

Which case is possible/best? I need performance, it comes first before code readability etc. My main concerns are the memory leak of XHR, and also which is faster: XHR loading and parsing JSON or loading and reading image pixel by pixel.

Thank you!

sentences:
Box2d Collision problem I'm not good with words so here's a picture to describe my problem:

In my game there is this big ball which the user can move on x-axis only. Now, if the ball is falling like the red one, it's blast away. But, with the angle/hit position of the green one it's just kinda sliding on the big ball and falling.

I'm using Box2d above AndEngine on an Android platform.

What is the reason for my green ball problem?

sentences:
Adding a delay into the middle of a function in Unity In the spot //wait 1.5 seconds what would I say to make it wait 1.5 seconds then complete the code after?
Here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OnclickHeal : MonoBehaviour
{
    public PlayerHealth playerHealth;
    public PlayerMovement playerMovement;
    public Inventory Inventory;

    public Button healButton;

    void Start()
    {
        Button btn = healButton.GetComponent<Button>();
        btn.onClick.AddListener(TaskOnClick);
    }

    void TaskOnClick()
    {
        playerMovement.moveSpeed = 3;
        //wait 1.5 seconds
        playerMovement.moveSpeed = 4;
        playerHealth.currentHealth = 100;
    }
}

Also, the line public Button healButton; throws an error:

error CS0246: The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)

sentences:
Normalization of Vectors: Return a copy of the result or alter the object itself? When calculating the normal of a vector, which is considered canon:

Returning a copy:

Vector2D Vector2D::Normalize() const {
    double a1 = GetX();
    double a2 = GetY();
    double a3 = GetZ();
    double length = GetLength();
    assert(Math::IsEqual(length, 0.0) == false);
    if(Math::IsEqual(length, 0.0)) {
        throw Exception("Can not normalize a Null Vector.");
    }
    return Vector2D(a1 / length, a2 / length, a3 / length);
}

Or altering the object itself?:

void Vector2D::Normalize() {
    double a1 = GetX();
    double a2 = GetY();
    double a3 = GetZ();
    double length = GetLength();
    assert(Math::IsEqual(length, 0.0) == false);
    if(Math::IsEqual(length, 0.0)) {
        throw Exception("Can not normalize a Null Vector.");
    }
    SetTerminal(a1 / length, a2 / length, a3 / length);
}

P.S.
IsEqual verifies the following: (std::fabs(a - b) <= 0.0001)

sentences:
Fighting aliasing on specular highlights MSAA does a good job removing aliases on mesh edges, but it does not help with aliased specular highlights:

Notice the aliased specular highlights on the doors and windows.

I believe the reason for this lays in the way normals are filtered after being sampled from their maps, so I wonder if there are some known methods how to make highlights more smooth?

sentences:
Freeing texture memory in SharpDX - what am I missing? I'm having a torrid time trying to resolve an issue whereby my total GPU memory consumption keeps rising throughout the course of my application, until the application fails with a DX out of memory exception.

I frequently load large textures, split into texture arrays (of type Texture2D). These are freed using .Dispose() before the next one is loaded, but memory is not seen to be freed when using Process Monitor (specifically, the "Committed GPU Memory" keeps rising with each new allocation).

I freely admit that I do not really know what the Committed GPU Memory metric in Process Monitor is telling me, but it is the case that the application will eventually fail through lack of memory - so the memory leak is real (and always when the memory hits the same amount in PM).
I do have object tracking enabled, and am able to see that no objects remain unaccounted for when the application closes normally (including after a number of texture loads).
I have created a synthetic example which simply allocates a texture and immediately calls Dispose() on a button click. This demonstrates the problem - memory usage increases until the application fails with an out of memory exception.

    public void d()
{
    texture = new Texture2D(Renderer.Device, new Texture2DDescription()
    {
        Width = 1024,
        Height = 1024,
        MipLevels = 1,
        Format = Format.R8_UNorm,
        BindFlags = BindFlags.ShaderResource,
        Usage = ResourceUsage.Default,
        CpuAccessFlags = CpuAccessFlags.None,
        OptionFlags = ResourceOptionFlags.None,
        ArraySize = 100,
        SampleDescription = new SampleDescription(1, 0)
    });
    texture.Dispose();
}

I did read somewhere on this forum that calling Flush on the context might have an effect, and in my synthetic example it does stop the memory build up - but not in my real app (?).

System is Windows 8.1, SharpDX 2.6.3.

Am I missing something really obvious here? I've Googled extensively but I can't find anything that suggests more than a Dispose is required when freeing textures.

thanks,
Matt

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 do i writing timing function for lightning flash in C++? I need to write a horror scene with lightning flash. Unfortunately I am new to both C++ and OpenGL and I am looking for efficient way to mimic lightning timing in C++/OpenGL?

I don't need graphical implementation, just algorithmic implementation.

as such, the function should return a float representing lighting intensity and the delay of lightning flash should be random (5 seconds followed by 10 seconds then 3 seconds.. etc)

I hope I made everything clear!

sentences:
Unity - Loading Assets / Resources during run-time for a highly customizable game I haven't had to think too much about this problem too much until now.

I am in the middle of creating a character customization system for my game.

There are 60+ characters in the game, I have created them using an internal character customizer, using multiple assets/meshes - bodies, eyes, clothes, hair, etc. - combining them into create a single mesh which can be controlled by a rig.

Currently I have all the body parts and clothing in one folder, labelled in such a way that with a bit of simple logic, they can be assigned to certain parts of a character's body.

In another folder, I have all the Character prefabs - GameObjects with a special Character component, which allow me to configure each character using the editor's inspector. So instead of interacting with the hierarchy directly, I use dropdowns in the inspector to choose what the character wears and other aspects of their appearance)

With this system I can drag and drop characters into a scene, hit play and they'll work as intended.

But what if I considered all character's appearances as dynamic (suppose they wear different clothing depending on time of day, different accessories, etc.), then it becomes too variable to consider pre-compiling each character.

Or to really accentuate the problem - what if I consider an in-game character customizer? Or even in-game scene editor? Where objects like chairs, tables and walls have to be loaded individually during run-time.

Currently, I rely on AssetDatabase (LoadAssetAtPath(), FindAssets(), etc.) to generate a character within the editor, obviously this won't work in-game.

I am very confused by Unity's whole asset-bundle/resource pipeline.
Should I put all of the body-parts, hairstyles and clothing into a Resources folder and replace 'AssetDatabase' references with 'Resources'?
From looking online, I get the impression this is bad practice. Why?

Do I put every single one of these assets into a single AssetBundle? Is there any difference between a Resources folder an AssetBundle containing the same objects?

I understand this will create an overhead whenever a character needs to be created and initialized, but I don't see any other way.

I'm sure my understanding of AssetBundles and Resources is muddled at best.
Possibly at the most basic level - I don't understand why I can't just say 'Unity, load this asset now' as I do with the AssetDatabase class in an editor script. I know the compiled asset doesn't resemble the same file-mapping as my project folder, but surely it can still be got at.

Any suggestions on the matter would be really appreciated.

I hope the confusion I've expressed fully illustrates the depth of my ignorance.
While I've been using Unity for over a year now, I've had so much trouble getting familiar with it, yet I'm usually very adaptive to new software, APIs or coding practices.
There's just something about Unity that causes so many misunderstandings and misapprehensions.
We don't see eye to eye on anything it seems.

sentences: Navmesh string pulling vs funneling I'm creating a path-finder for navmesh. I'm wondering which method should I use after the A* has been completed, funneling or string pulling? What are the advantages/disadvantages of using them on a triangle-based navmesh?

sentences:
Change Tag of Instantiated Clone In my game there is a bird flying up and a stream of containers (baskets) is moving from right to left of the screen in the bottom. Baskets are being Instantiated on right and get destroyed when they reach the left side of the screen.
 On The left there is an EmptyObject called Destroyer and anything that collides with it get destroyed. I'm not using out of bounds for the objects to get destroyed instead I'm using an EmptyObject with collide.
 And on tap the bird throws an artifact projectile downwards and if it collides with the Basket it changes into another sprite. This is the code for that transform.GetComponent<SpriteRenderer> ().sprite = changedBasket;
 The problem is that user is only allowed to miss 3 baskets losing more than 3 baskets will result in Game Over. So inside my Basket.cs I'm checking that if(target.gameObject.tag == "Deadly") then count it as a chance loose. BUT the changeBasket also act as it's the same basket.The logic that I think will work is to change the tag after the artifact collides with the basket and on that type of tagged object deadly won't work. If I'm write kindly tell me how to implement this in c# of-course. Please note that the object is an Instantiated Clone

sentences:
Recommended book for cocos2d? I'm an experienced programmer that recently got into iOS development by working through the big nerd ranch book by Aaron Hillegass and Joe Conway. I loved the way the book was structured in terms of typing in the code and doing the challenges.

I'm interested in learning more about iOS gaming and cocos2d, but am a complete newbie in terms of game development/design. There are a number of books on amazon on cocos2d, can anyone recommend one in particular?

sentences:
A* heuristic for use with Goal Oriented Action Planner Many of the high-level descriptions I've found for GOAP and similar planners suggest using A* for their path-finding, but I'm struggling to implement it for my own planner. Specifically, I'm struggling with creating an admissible heuristic.

As a trite example, consider this set of nodes, expressed as a map of srcCoord -> dstCoord -> cost (cost is Euclidean distance with one exception):

{0, 0}:
  {-14, 0}: 14.0,
  {3, 3}: 4.242640687119285,
{-14, 0}:
  {10, 10}: 1.0, # exception here, call it a wormhole
{3, 3}:
  {6, 6}: 4.242640687119285,
{6, 6}:
  {9, 9}: 4.242640687119285,
{9, 9}:
  {10, 10}: 1.4142135623730951,

The shortest path from {0,0} to {10,10}, by 0.1421356237309501, is {0,0} -> {-14,0} -> {10,10}.

Euclidean distance is a reasonable heuristic without wormholes in the picture, but it's inadmissible here: It'd return 26 for {-14,0}->{10,10}, so it'll never expand the {-14,0} node and will end up incorrectly returning the path through {3,3}.

My planner has no connection to 2d-geometries, but it exhibits this "wormhole" behavior... an initial action doesn't appear to get us closer to our goal, but after expansion we see that it makes future actions less costly, or amplifies their effect in reaching the goal.

Here's a specific example I have in mind for amplifying the impact of future actions:

  If mid-fight a better weapon (let's assume it's better in all respects) appears on the ground than the one currently equipped (likely dropped by someone who died), and it won't take longer to pick it up + finish the enemy than to finish the enemy with the current weapon, then pick it up, equip it, and use it.

How can I avoid overestimating the remaining cost after picking up the weapon? It's tempting to say "let's assume the best possible outcome will come to pass", but if there're any further options after picking up the item than equipping and using it then calculating the best outcome would require its own planning exercise, turning my A* into a DFS.

Some plausible future actions that could lower our actual cost to lower the most obvious estimate:

wield the weapon with two hands, in order to do more damage
cast Haste on ourselves to double our attack speed
use a weapon-specific technique, e.g. sweeping our opponent's feet / tripping them using the haft of a polearm

sentences:
Unit selection - logic & screen communication I'm building a game using SFML, with disconnected logic & screen systems that run on different threads and communicate through synchronised buffers. Now, this system worked perfectly well when I only ran independent AI units, but now comes the time to handle player input, and I'm not sure what's the best way to handle it.

Currently, when a player clicks the screen, the input manager creates a MouseClick event, which goes to the logic buffer. The logic manager checks if that spot contains a controllable entity, and if it does, creates a SelectUnit event with the relevant information in the display buffer. When the display manager reads that event it updates the screen with the relevant piece of GUI, and any click on the GUI again sends an update to the logic component. The two problems I see are that the SelectUnit event will need to contain a lot of logic info which might harm the info decoupling, or just make it useless, and that I fear (still not tested) that since the communication will bounce several times between the two threads, some might be lost.

Now, I wonder if this system could be handled better, with less transferred information.

Note about the tech: SFML creates a RenderWindow object which handles input and display. I'm still not sure what library to use for GUI (probably GWEN.net), so I can't currently name tech limitations on it.

EDIT: this is supposed to be a RTS multiplayer game. So far, it seems to me there'll have to be a central logic unit (on the host computer?) that'll receive all the inputs from all players, and send the responses accordingly. This, obviously, makes this system even more complex. Again, suggestions are welcome.

sentences:
How does the change ID increment in the Path of Exile API? Does any body know how the next change ID increments on the POE API?

I think I have figured out the the API returns the latest, system wide next_change_id for the latest stash changes.. but in between refreshes the incrementations are a bit all over the place.

So these are the change id's reported within seconds of updates

97021553-101802592-95624331-110373614-103027614
97021579-101802666-95624405-110373692-103027683
97021579-101802668-95624405-110373695-103027694
97021579-101802668-95624405-110373710-103027694

It looks like a GUID but it is not a GUID by any means.. when the game started these numbers where allot lower.

I have tried searching forums for a more in depth breakdown of how the API works. The game site has limited information, Reddit has some insight and source code links.. but no proper break down.

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:
Ambient occlusion: Correct culling after anisotropy correction I've added simple color based ambient occlusion to my game.

First it looked like this (from giawa.com):

The description: "Due to anisotropy, the ambient occlusion shading on the top left is inconsistent with the top right. We need to flip those quads so that they get rendered properly."

So according to that I had to flip some faces in order to fix the issue. I did and then it would look like this:

This is of course because of back face culling, culling the flipped faces.

When I disable culling, it looks like this:

Which is how it's supposed to look. But as you can imagine, that costs a lot of performance because culling is now disabled.

According to the article: http://www.giawa.com/author/giawa/page/10/
"This occurs due to differences in how the GPU linear interpolates across the edge of a triangle versus the body of a triangle. This is called anisotropy, and can be fixed by ‘flipping’ the quad. My final fix was to enable polygon culling, which meant I had to make sure to render my quads in a consistent winding. "

I've searched for this "polygon culling" but could not find anything about that.

I can't just switch between culling modes because all the vertexes are added to a vertex buffer when initializing a chunk. This is so I can render each chunk in one draw call.

I hope anyone knows a way to fix this, thanks in advance.

sentences:
LibGDX - How to draw a filled rectangle behind a text? I'm new in LibGDX and I want to create a grid based game. Every square will have a rectangle and a text and the background color of the rectangles can change during the game.

The problem is when I draw a filled rectangle with ShapeRenderer, it always in front of the BitmapFont. How can I set the rectangle behind the text?

The code I use to draw the squares:

// Draw numbers and rectangles
for (int i = 0; i < map.length; i++) {
    for (int j = 0; j < map[0].length; j++) {
        String value = String.valueOf(map[i][j].getNumber());
        float offset = fontSize/3f;
        Rectangle rect = rects[i][j];

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(150/255f, 150/255f, 150/255f, 1);
        shapeRenderer.rect(rect.x, rect.y, rect.width, rect.height);
        shapeRenderer.end();

        // Draw font
        if (map[i][j].isActive()){
            fontActive.draw(batch, value, rect.x + offset, rect.y + offset);
        } else {
            font.draw(batch, value, rect.x + offset, rect.y + offset);
        }
    }
}

Thanks all!

sentences:
License for a casino game with virtual money (chips) Do I need a specific license for operating a casino game (lets say poker Hold'em or video slots) that players are supposed to play with virtual money (chips) only? I am speaking about games like Zynga poker, Poker Deluxe, Slotomania and the hundreds other similar games on iTunes or Google Play. Players start with a certain amount of chips and if they run out they can rebuy a bundle of coins to keep playing. The users may not exchange those collected virtual funds (chips) for products or services, or cash out for real money, but just keep on playing for a fun.

Do I need any license for operating such a game?

sentences:
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:
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:
Designing for multiple screen resolutions and aspect ratios, target one resolution then scale to meet others or use normalized values? I feel like what I'm currently doing is stupid but would just like reaffirmation it is. Basically I'm writing games which target a certain screen resolution (800x480), so all positions, widths and heights I set for sprites is for that resolution.

On the engine side I have special scalers which will change the width and height of what is being drawn to meet the current platforms res, so for example if the platforms screen res is 1200x720 I will stretch a sprite by a factor of:

1280 / 800.0f;
720 / 480.0f;

Positions are also offset and manipulated in a similar way.

I really feel I should move to a normalized system for widths and positions (i.e. 0 to 1) but at the same time feel this is more intuitive since the first platform I target is 800x480 and I already kind of have a good udnerstanding of dimensions and such for that.

So my question is, is it really that bad to target a specific ccreen res then in the engine side modify this res to meet different platforms?

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:
How to implement view bobbing? I'm developing a First-Person shooter game. Everything is just fine but I've a little problem with my camera moving.

My FPS camera is moving smoothly! But the camera should move like a human is walking and his head is doing up and down.

Now I'm stuck! So what kind of algorithm can I use for that purpose?

Any kind of help is appreciated.

sentences:
Proper way to draw 1000 billboards that always face the camera I have up to 1000 visible GameObjects with trivial plane meshes, which are essentially sprites/billboards and which should always face in the relative direction -camera.forward.

There are so many ways to do this that I have trouble sorting the good ways from the bad ones.

The straightforward way is to use a geometry shader, but that isn't supported on most devices, so that's out.
Using a script is nice, easy, simple, and wasting performance.
Using a vertex shader and passing in center coordinate of the billboard through properties feels clean but is wasting even more performance because it breaks batching.
Doing it in a vertex shader and passing in center coordinate of the billboard through through uv2 feels brittle and wrong, but will be the most performant.

Ideally, someone has a better solution. If not, maybe someone can make a convincing argument for one of the approaches?

Related: Rotate object to always face camera, Efficient billboarding sprites in Unity 5

sentences:
Changing game object type: reinstantiating the object, or switching an object state I work on a strategy game, where the player occasionally has to transform ordinary citizens into the so called "leaders". Leaders are temporary units, which the player can control directly, in order to interact with the other citizens. After some time, the leader gets transformed back to a normal citizen.

My question is if I should stick to the classical OOP approach of keeping citizens and leaders in two separate classes, whereas the leader class extends the citizen class, and every time when I need a leader, I simply re-instantiate the current citizen instance.

I personally dislike this approach, however. I already have a state machine implemented, and am more likely to keep only the citizen class (or rather, human class). Rather, I'd like to keep the citizen/leader separation into two different states. When I need one or the other type, I simply switch the current state.

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:
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:
Trying to create a sphere in UDK on which I can stand Trying to build a globe in UDK, but when I do (create a sphere), my player falls straight through it.  How do I make a sphere that I can walk on?  Every other shape (cube, cone...etc) work just fine.

--

Edit:  Specifically, I want to build a CSG/Brush sphere, not a mesh sphere.  It appears to work just fine if I set the "sphere exptrapolation" to 1 or 2, but if I bump it up to 3 or higher, I fall right through.  I literally created 2 spheres next to each other, one set at "2" and one at "3" - I can walk from the top of the "2" sphere and jump onto the "3" sphere, but I fall right through it.

sentences:
Figuring out what object is closer to a certain point? I'm trying to create fog of war, I have the visual effect created but I'm not sure how to deal with the hiding of other players if they're within the fog of war.

So right now the thing I'm trying to do is if another player is hiding behind a wall then not to render that player. I was thinking of doing it by sending a ray in the direction of all the players, and then creating a list of all the obstacles that ray collides with and then trying to figure out if an obstacle was closer than the player in order to predict the distance.

But then I realized I'm not really sure how to figure out if the obstacle is infact closer or not because I have to account for all the dimensions, so I'm kind of stuck. First of all is this approach the correct way to go about it and secondly how would I calculate if the obstacle was infact closer taking into account the X Y and Z.

Thanks

sentences:
Translate click on screen to point on plane in 3D space I am creating a 2.5D game with the camera at a slight angle, like so:

The grid is the "playing field," and the positive x, y, and z directions are labelled.

I already know all the details about where the camera is, where the point on the grid that corresponds to the center of the screen is, and what the angle between the positive z axis and the direction the camera is pointing is.

What I want to do is be able to click on the screen, and figure out where on the grid I clicked. There are two ways that I have considered approaching this problem:

I could create a vector or ray of some sort that starts at the camera and goes in the direction the mouse is pointing. I could then solve the equation for the ray for x and y at z = 0. The problem with this is I don't know how computationally expensive it would be.
I could figure out the transformation matrix for something (I'm not sure exactly what it would have to be), then apply it to the [x y] position of the mouse. The problem with this is I have no idea where to start when finding the necessary transformation matrix.

Is one of these likely to be better than the other? Is there a different way that might be better? If I should use the transformation matrix option, how do I find that matrix?

sentences:
Drawing Chess Board vs Using Picture Would it be better to actually draw the board in a script and attach colliders to each piece or get a picture and add the colliders before the game starts?  Is the difference in processing power needed significant?

Which way would be the easiest for figuring out where a specific piece is?

sentences:
Effective content manager on AS3 Flash In my game more than 600 images and 200 sounds. I'm try organize effective images and sounds manager for fast access. This is a good approach?

public class Images
{
    public static var image_1:BitmapData;
    public static const image_1_class:Class;

    public static var items_icons:Vector<BitmapData>;
    public static const item_1_class:Class;
    public static const item_2_class:Class;

    ...
}

// initialization
Images.image_1 = new Images.image_1_class().bitmapData;
Images.items_icons[0] = new Images.item_1_class().bitmapData;
Images.items_icons[1] = new Images.item_2_class().bitmapData;

// using
new Button().setTexture(Images.button_close);
sounds.playRandom(Sounds.gnome_hit);

sentences:
Does the feature level affect multisampling? I'm using DirectX 11 with the feature level 9_3 even though my computer could run 11_0, but I want to support older hardware as well.

I'm using CheckMultisampleQualityLevels to check whether multi sampling with the given samplecount is supported or not. However it returns 1 for quality with 4samples. And with 8samples it returns 0 (so its not supported). With feature level 11_0 CheckMultisampleQualityLevels returns 1 for 8samples. I'm using a AMD/ATI Radeon HD5830. In the most DirectX9 games I can still use 8x antialiasing. So why is it not supported in DX11 with a lower feature level.

Another point is it seems like 4samples doesnt really affect the output:

With mutlisampling disabled the result is the same. I'm sure that I configurated ms correctly.. even in the Depthbuffer.

Whether I enable AntialiasedLineEnable in the RasterizerDesc or not the output is still the same.

I searched in MSDN but I couldn't find any more information about multisampling.

EDIT: The blacklines in the picture are outlines made in the pixelshader

sentences:
Issue with using two StartCoroutines in one script I'm having a Issue with trying to use multiple StartCoroutines within my Script. I'm having an error at line 50 where is says StartCoroutine does not exist in the current context

void OnCollisionExit(Collision theCollision) {
    if ((theCollision.gameObject.tag == "Boost")) {
        movementspeed = 13000;
        //StartCoRoutine (Delay2 ());  error here
        Destroy (theCollision.gameObject);
    }
}

IEnumerator Delay2 () {
    yield return new WaitForSeconds (1);
    movementspeed = 10000;
}

void OnCollisionEnter(Collision theCollision) {
    if ((theCollision.gameObject.tag == "Wall")) {
        movementspeed = 5000;
        StartCoroutine (Delay ());
    }
}

IEnumerator Delay() {
    yield return new WaitForSeconds (3);
    movementspeed = 10000;
}

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:
Web based poker on Phaser 3 Please can somebody help me as I'm a lil bit new to game dev and user interface designing.
I am trying to create a simple Texas holdem poker using phaser3 for multiplayer application.
I have a few doubts this is my app.js

   const config = {
  type : Phaser.AUTO,
  width : 800,
  height : 600,
  backgroundColor : #000000,
  physics : 'arcade',
  scene : {
    preload : preload,
    create : create,
    update : update

},
}

var game = Phaser.Game(config);

What is actually happening in this code and what should be my project folder structure for any simple multiplayer online game.
Can I set the witdh and height dynamically depending on the device width and orientation??.

Please anybody who could just explain me a few things about gamedev...

Thanks in advance.

sentences:
How to make a string[] from the words of a file in Unity? I have .txt file containing all the English words separated by line breaks.

I want to turn them to a string[] so I can easily pick a random one from them.

The way I would do that in normal C# is the File.ReadAllLines(path) function in the System.IO namespace.

But, I don't think that I can use System.IO with Unity so the alternative that I could come up with is the TextAsset class which I can use to reference an imported text asset and get its text property as a string.

But, if I have a giant string how can I simply split it up into individual words and store them as a string[]?

sentences:
Unity2D Having trouble steering gameobject So I am making a 2d maze game where one of the enemies has to follow the player once it detects the player. I am currently using a steering method to steer the enemy towards the player and also when it detects a wall. I am not using any sort of path finding algorithm, just using steering to make a "dynamic" path finder. But I am having some trouble steering the enemy away from the walls and then resume moving towards the player.

This is what I am doing right now:

follow the player when it is detected
set the enemy's velocity towards the player.
use a raycast to detect if a wall is ahead
if raycast detects the wall, steer the enemy towards the direction it
is moving in, then steer it towards the position of the player again.
E.g if it is moving up while following the player and hits a wall on
the left or right, it will steer up.

I am having a hard time steering the enemy away from the wall and then back towards the player again, because once it steers away from the wall and isn't hitting a wall anymore, it checks where the player is to resume it's pursuit, but then the player goes too far away from the enemy and so it doesn't know where to move towards.

Here is the code:

 void Update()
  {
     RaycastHit2D hit2D = Physics2D.Linecast(transform.position, player.transform.position, 1 << 8);
     if (hit2D)
     {
         string wallTag = hit2D.collider.tag;
         FindMovementDirection(ref wallTag);
         wallHit = true;
     }
     else
     {
         wallHit = false;
     }
  }
 void FindMovementDirection(ref string wallTag)
 {
     int len = 3;
     if (wallTag == "V_Wall")
     {
         if (currentVel.y <= 0) currentDirection.localPosition = new Vector3(0, -len, 0);
         else currentDirection.localPosition = new Vector3(0, len, 0);
     }
     else if (wallTag == "H_Wall")
     {
         if (currentVel.x <= 0) currentDirection.localPosition = new Vector3(-len, 0, 0);
         else currentDirection.localPosition = new Vector3(len, 0, 0);
     }
 }
 void seekSteer()
  {
     float maxForce = 0.8f;
     float maxSpeed = 6;
     if (wallHit)
     {
         desiredVel = currentDirection.position - transform.position;
     }
     else
     {
         desiredVel = player.transform.position - transform.position;
     }
     desiredVel.Normalize();
     desiredVel *= maxSpeed;
     steerVel = desiredVel - currentVel;
     if (steerVel.magnitude > maxForce)
     {
         steerVel.Normalize();
         steerVel *= maxForce;
     }
     currentVel += steerVel;
     if (currentVel.magnitude > maxSpeed)
     {
         currentVel.Normalize();
         currentVel *= maxSpeed;
     }
 }
 void FixedUpdate()
 {
     transform.position += currentVel * Time.fixedDeltaTime;
 }

Another thing that I would like to ask is that, should I be using a path finding algorithm? I am aware that I am not using one and that is because I want the enemy to find it's path dynamically. I also know that path finding and steering go hand in hand most of the time, so am I doing it wrong? Thanks.

sentences:
How to transform a shadow map to camera view? I'm making a rendering engine as a hobby to learn more about 3D. I have a deferred renderer with the G-buffer (color, normal and depth). I also have a lighting controller that uses only spotlights at the moment. For each light, I render the depth to a texture. This works nicely, but I can't wrap my head around how to map this depth map.

Basically what I would want is a view from the camera with the light's depth map mapped in the view. I've read a ton of tutorials but cannot seem to understand this process well enough.

(BTW, I'm aiming OpenGL 3.3, so no deprecated stuff in the answers. The web is full of those already :D)

sentences:
Architecture - how to refer to skills/abilities internally within code? I have about 60 skills within my game, which are loaded from a JSON file. Each skill is a subclass of a skill object and has attributes like range, cost, target type, etc. Currently each skill has an integer index to identify the skill. Warrior skills begin at 100, wizard at 200, rogue at 300, etc.

Now I'm at a point where I'm implementing the mechanics of what these skills actually do, I have created an enumerated type with 60 integers corresponding to the indices from within a JSON file. And what I have right now is a switch statement with 60 cases:

enum SkillsEnum
{
    sPowerAttack = 100,
//59 more enums with skill names
}

-(void)doSkillActionWithTarget:(CharacterModel*)target
{
    DLog(@"Skill activated");

    switch (self.skillIndex) {
        case sPowerAttack:
        {
            //apply skill effect here
            break;
        }
     //59 more skills
     }
}

I'm working in Objective-C, an object oriented language and am interested if there's a better or more flexible to refer to skills within the game engine?

In other words, would there be any benefit from creating more specialized separate class hierarchies for skills, or passing them around as Maps/Dictionaries?

sentences:
How to move from A to B, with check and fix the destiny? I only found the formula for check the collision between two lines. But never about of movement and fixed from one point to other point in one of the line.

I need move from pA to pB and if take collision in one line (wall), move around before of the wall to the new destiny point fixed.

Where found this and/or which is the formula?

sentences:
LWJGL 3 - Random Sprites Don't Blend Some of my sprites don't "Blend" in with tiles behind them Z-wise.
glEnable(GL_DEPTH_TEST);

Depth testing is enabled and works.
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

The blend function is above.
Below is a picture of four different instances of the application. As you can see, blending works on random sprites.
Why aren't some of the sprites blending?
An observation that I made is that when I move the sprites (layers 0 and 1) below (Z-wise) the button, you can see the sprites from the gaps left by letters (layer 10), yet the button itself (layer 9) doesn't show in that area. This is what I find the strangest.

sentences: Arc'd jumping method? Okay, so I'm making a platformer, and I wanna know how I can make a arc'd jump easily. Like what Mario does in super Mario Bros 1. Any ideas on a simple way to accomplish this?

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:
How do I switch between different Update behaviour states in Unity? I have a bird entity that needs different update rules when it's moving or dying (among potentially other states).

I want to avoid making my Update method a clutter of if-else branches like this:

void Update() {
   if(state == movingState) {
       // Do moving logic.
   else if(state == dyingState) {
       // Do dying logic.
   else if...

Instead, I thought I could make a base class for all my bird behaviours, then derive classes for each state with their own update functions, and use the appropriate derived version based on the current state.

public class BirdBaseModel : MonoBehaviour
{
    void Update()
    {
        // ...
    }
}

public class BirdMoving : BirdBaseModel
{
    void Update()
    {
        // ...
    }
}

public class BirdDying : BirdBaseModel
{
    void Update()
    {
        // ...
    }
}

My BirdBaseModel is attached to the bird game object. Based on game states, I want to dynamically reference it in the GameController class.

BirdBaseModel b;

if(State == 1)
{
    b = new BirdMoving();
}
else if(State == 2)
{
    b = new BirdDying();
}

Based on the above logic, I want to call the Update function of that particular class. How do I invoke the Update of the subclass?

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:
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:
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:
Sprite rotating to look towards mouse I am trying to figure out how to calculate the angle to rotate a sprite in z axis to look towards the mouse.

I declared one index -and vertexbuffer and set following vertices in it:
        VertexBuffer vBuffer;
        IndexBuffer iBuffer;

    VertexPositionColor[] vertices = new VertexPositionColor[4];
    short[] indices;

       vertices[0] = new VertexPositionColor(new Vector3(0, 0, 0) + position, Color.Blue);
        vertices[1] = new VertexPositionColor(new Vector3(1, 0, 0) + position, Color.Blue);
        vertices[2] = new VertexPositionColor(new Vector3(0, 1, 0) + position, Color.Blue);
        vertices[3] = new VertexPositionColor(new Vector3(1, 1, 0) + position, Color.Blue);

        indices = new short[] { 0, 1, 3, 3, 2, 0 };

        vBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 4, BufferUsage.WriteOnly);
        iBuffer = new IndexBuffer(GraphicsDevice, IndexElementSize.SixteenBits, 6, BufferUsage.WriteOnly);

        vBuffer.SetData<VertexPositionColor>(vertices);
        iBuffer.SetData<short>(indices);

Rendering:

            GraphicsDevice.SetVertexBuffer(vBuffer);
        GraphicsDevice.Indices = iBuffer;

      effect.View = Matrix.CreateLookAt(new Vector3(0, 0, -5), new Vector3(0, 0, 1), new Vector3(0, 1, 0));
        effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000.0f);
        effect.VertexColorEnabled = true;

        effect.World = Matrix.CreateRotationZ(radians);
        effect.CurrentTechnique.Passes[0].Apply();

        GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 2);

The variable radians is set in the update-method :

            center = new Vector3(0, 0, 0) + position;
        mousePosition = new Vector3(Mouse.GetState().X, Mouse.GetState().Y, 0);

        mousePosition = GraphicsDevice.Viewport.Unproject(mousePosition, effect.Projection, effect.View, Matrix.Identity);

        Vector3 dir = center - mousePosition;

        radians = (float)Math.Atan2(dir.Y, dir.X);

Now I want to solve this problem by avoiding using the method atan2.

Given is the xy-plane.
How is it possible to calculate the angle of a vector with the direction (0,0,0) to (mouseX,mouseY,0)?
Trying to use a reference vector and calculating then the dot product, dividing it by length to put it in the acos function had given false results.

Can You suggest a solution to this?

Thank you.

EDIT: I just read http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/ which states that many acos implementations give a result between zero and pi... makes sense.

sentences:
UE4 C++ - Add generated source code folders to Visual Studio solution? In Unreal Engine 4, using a Visual Studio solution and projects generated from the Editor using the First Person Template, the layout of the Solution looks something like the following:

I am not a fan of this flat horizontal folder structure. What I would like to do is put some new classes into a nested folder here.
I will be generating a new GameState subclass, and putting the sources into the Source\GameState folder that will also be created on the fly, using the UE4 editor:

Notice that the "Create New Folder" option is disabled.

Here I have appended the "GameState" folder to the normal source path.
However, the folder structure in the Solution Folder has not changed, and nothing I try to do is working. The things I have tried to do so far include:

Drag the folder into the solution from the file explorer
Right Click > Add > Existing Item... (Which just results in the files appearing horizontally to the other files without the new folder I have created, also add as link is not an available option)
Create a "Filter" (what the other folders appear to be) within Visual Studio. This results in the layout I desire, but I have to add the source code files to the filter manually which just copies them to the .vcxproj file directory. I end up not modifying the actual files I added.

How can I add this folder and it's files while keeping up with the original copies?

sentences:
Vertical Text - Bitmap Font Libgdx How can I achieve this kind of rotation or vertical text using Bitmap Font?

I already used Matrix but didn't get the result same as above.

sentences:
Unity move canvas slightly with smartphone acceleration I'm developing an AR-App with the Samsung-GearVR. To get a smooth UI, I thought about creating a UI, which is not completely fix, I thought it could be nice, when the UI is slightly behind my head movement, but still lerps to the correct position, when my head is not moving. (A lot of 2D-Sidescroller got this style of camera, which is not fixed on the character, but instead is following the character with a bit of delay, I want this effect for my canvas.)

First off I changed my canvas to World space, which works fine, then I was thinking about the Input.acceleration method, but it does not really give you the actual acceleration, but the actual rotation of the phone. Now I'm struggling, because I don't know, how to get the current acceleration. Is there some better way to achieve this effect or do I have to build something with the Input.acceleration method?

sentences:
Spawn Array of GameObjects to Array of Transforms I have a question regarding spawning an array of GameObjects in Unity. What I want to happen is that when a big enemy dies, it will spawn enemies into their respective Transform positions (i.e., Enemy 1 will spawn in Position 1, Enemy 2 in position 2, and so on).

I suppose I could go on with something like:

// C#

public GameObject[] Enemies;
public Transform[] SpawnPoints;

void KillEnemy()
{
    GameObject enemy1 = Instantiate(Enemies[0], SpawnPoints[0].position, SpawnPoints[0].rotation;
    GameObject enemy2 = Instantiate(Enemies[1], SpawnPoints[1].position, SpawnPoints[1].rotation;
    GameObject enemy3 = Instantiate(Enemies[2], SpawnPoints[2].position, SpawnPoints[2].rotation;

    Destroy(gameObject)
}

But the problems are:
1. I'm aware that the code is expensive to run, especially since I'm doing a 2D game; and
2. It provides no flexibility, meaning if I want a different enemy to use the same code, then I won't be able to do stuff like adding more enemies to spawn (after the first one dies, of course).

So yeah, I hope I get some help with this. Thanks!

sentences:
How to Invite Facebook Users to a Unity Game for Android I am currently using the following code to let the player invite other players to my multiplayer game:

FB.AppRequest("Test Message", callback: this.HandleResult);

and

FB.AppRequest("Test Message", null, null, null, null, null, null, callback: this.HandleResult);

When tested on an Android phone, it only brought up a Facebook dialog box for the player to choose his/her friends. Clicking "Send" would close the dialog box, but no message whatsover would be received on the target person's Facebook.

I used to do:

FB.Mobile.AppInvite(new Uri("xxxx"), callback: this.HandleResult);

but I understand this has been obsolete, invoking only a black blank screen.

I applied for a 'user_friends' Facebook permission but was told it was not required.

Both 'Single Sign On' and 'Deep Linking' have been enabled on the Basic Settings page at Facebook Developer.

What else should I try?

I tried to print out the result of the callback function which looks like this:

public void HandleResult(IResult result){
    string r = "";
    if (result == null) return;
    if (!string.IsNullOrEmpty(result.Error)) r += "Error Response: " + result.Error + "\n";
    else if (result.Cancelled) r +=  "Cancelled Response: " + result.RawResult + "\n";
    else if (!string.IsNullOrEmpty(result.RawResult)) r += "Success Response:" + result.RawResult + "\n";
    else r+= "Empty Response\n";
    r+=result.ToString();
    GameObject.Find("FBText").GetComponent<Text>().text = r;
}

and obtained the following:

Success Response: {"request":"415323562654670","callback_id":"2","to":"3XXXXXXXXXXXXX"}
Facebook.Unity.AppRequestResult
AppRequestResult:
   Error: null
   RawResult:{"request":"415323562654670","callback_id":"2","to":"3XXXXXXXXXXXXX"}
   Cancelled: False
AppRequestResult:
   RequestID: 415323562654670
   To: 3XXXXXXXXXXXXX

The request seemed to be successful. However, no invitation was received at the target account.

I am using the latest Facebook SDK -- version 7.15.1.

sentences:
Basics of drawing in 2d with OpenGL 3 shaders I am new to OpenGL 3 and graphics programming, and want to create some basic 2d graphics.  I have the following scenario of how I might go about drawing a basic (but general) 2d rectangle.  I'm not sure if this is the correct way to think about it, or, if it is, how to implement it.

In my head, here's how I imagine doing it:

t = make_rectangle(width, height)

build general VBO, centered at 0, 0

optionally: t.set_scale(2)
optionally: t.set_angle(30)
t.draw_at(x, y)

calculates some sort of scale/rotate/translate matrix (or matrices), passes the VBO and the matrix to a shader program

Something happens to clip the world to the view visible on screen.

I'm really unclear on how 4 and 5 will work.  The main problem is that all the tutorials I find either: use fixed function pipeline, are for 3d, or are unclear how to do something this "simple".

Can someone provide me with either a better way to think of / do this, or some concrete code detailing performing the transformations in a shader and constructing and passing the data required for this shader transformation?

sentences:
(C++, DirectX 11, UWP) - How do I update the ByteWidth of a VertexBuffer without recreating it? I want to have one buffer used for all dynamic properties but the amount of vertices in this could vary from just a few for an interface to the whole scene. As such if it's becomes initialized with only let's say the below.

offset = 120; //example situation.
bd.ByteWidth = sizeof(VertexPositionColorTexture) * offset;

The above is 120 vertices, but if let's say the next time when I go to update. I need 160 vertices the buffer will only have space for 120 and will do one of the following.

Crash with an access exception.
Draw but it'll be missing those 40 excess vertices.

I update the Vertex Buffer by doing the following:

D3D11_MAPPED_SUBRESOURCE resource;
ZeroMemory(&resource, sizeof(D3D11_MAPPED_SUBRESOURCE));

Engine::context->Map(dynamic_interfaces_buffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);

memcpy(resource.pData, &vertsToDraw, sizeof(VertexPositionColorTexture) * offset);

Engine::context->Unmap(dynamic_interfaces_buffer.Get(), 0);

The "offset" value changes with what ever data ends up being present. I update the existing "vertsToDraw" data as needed.

So if the title didn't make sense. I'm looking to edit the ByteWidth value that what stored in the ByteWidth of the description when the buffer was originally created. My only solution so far was to set the buffer to the maximum size I feel I would ever need then set the VertsToDraw array size to that same value. However then when I update I only update with the needed amount. I'm not sure if that causes a performance issue by having a buffer with a byteWidth of "32 Bytes" * "36,000 Vertices". When in many cases I might only use a few 1000 or less.

Another thought I had if the above is the only way was to create multiple buffer of various sizes and use which ever one fits the situation the best.

E.g. if it's 3828 vertices use a 4000 pre defined vertices buffer or if it's 18348 vertices use a 19000 pre defined buffer.

But i'm up for any solution if there's a better way to go about this i'm a bit new to DirectX.

sentences:
(Unity) Values set in Start() will be reset? This is my GameController GameObject in the Inspector (Ignore Suns and Player). Note that the GameController script has GameSpawner as a SerializeField.

And my script for GameController below.

public class GameController : MonoBehaviour
{
    public GameObject sunParent;
    public GameObject playerPrefab;

    [SerializeField]
    GameObject sunSpawnerObject;

    SunSpawner sunSpawner;

    void Start()
    {
        sunSpawner = sunSpawnerObject.GetComponent<SunSpawner>();
    }

    // this is only for testing
    void LateUpdate()
    {
        SpawnSunAtY(sunParent, -3.5f);
        SpawnSunAtY(sunParent, 0f);
        SpawnSunAtY(sunParent, 3.5f);
    }

    void SpawnSunAtY(GameObject parent, float y)
    {
        sunSpawner.SpawnSunAtY(parent, y);
    }

}

When the Scene starts, it should get the SunSpawner script from sunSpawnerObject. Then what is SunSpawner? See below.

This GameObject(prefab) has SunSpawner script as a component.
And below the script for SunSpawner. (where my question begins)

public class SunSpawner : MonoBehaviour
{
    const float SUN_MIN_SIZE_FACTOR = 0.05f;
    const float SUN_MAX_SIZE_FACTOR = 0.3f;

    [SerializeField]
    GameObject sunPrefab;

    float playerRawRadius;
    float sunRawRadius;

    void Start()
    {
        // these lines work just fine
        GameObject player = GameObject.FindGameObjectWithTag("Player");
        playerRawRadius = player.GetComponent<Renderer>().bounds.size.x / 2f;
        sunRawRadius = sunPrefab.GetComponent<Renderer>().bounds.size.x / 2f;
    }

    public void SpawnSunAtY(GameObject parent, float y)
    {
        float sizeFactor = Random.Range(SUN_MIN_SIZE_FACTOR, SUN_MAX_SIZE_FACTOR);

        Vector3 position = new Vector3(GetRandomXPos(sizeFactor), y, 0);
        GameObject sun = Instantiate(sunPrefab, position, Quaternion.identity);
        sun.transform.localScale *= sizeFactor;
        sun.transform.parent = parent.transform;
    }

    float GetRandomXPos(float sizeFactor)
    {
        float offset = Camera.main.WorldToScreenPoint(new Vector3(GetHorizontalOffsetFromScreen(sizeFactor), 0, 0)).x;
        float screenRightBoundWorldPoint = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x;
        float screenLeftBoundWorldPoint = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x;

        return Camera.main.ScreenToWorldPoint(new Vector2(Random.Range(offset, screenRightBoundWorldPoint - offset), 0)).x;
    }

    float GetHorizontalOffsetFromScreen(float sizeFactor)
    {
        float horizontalMargin = 0.1f; //TODO temporary value
        float playerRadius = playerRawRadius;  // *look here (1)*
        float distancePlayerToSun = 0.5f; //TODO temporary value
        float randomRadius = GetRandomRadius(sizeFactor);

        return horizontalMargin + (2f * playerRadius) + distancePlayerToSun + randomRadius;
    }

    float GetRandomRadius(float sizeFactor)
    {
        // *look here (2)*
        print("sunRawRadius: " + sunRawRadius + ", sizeFactor: " + sizeFactor + ", scaledRadius: " + (sunRawRadius * sizeFactor));
        return sunRawRadius * sizeFactor;
    }
}

Call stack:

GameController.LateUpdate() -> SunSpawner.SpawnSunAtY(parent, y) -> SunSpawner.GetRandomXPos(sizeFactor) -> GetRandomXPos(sizeFactor) -> GetHorizontalOffsetFromScreen(float sizeFactor) -> GetRandomRadius(sizeFactor)

Look here (1):

in SunSpawner.Start(), all values are initialized properly, I can see values in the debugger or log. However, when I get to GetHorizontalOffsetFromScreen(..), I see playerRawRadius is now zero.

Look here (2):

Same thing. sunRawRadius is 0, but sizeFactor argument is properly passed down the call stack.

Question: Why is it doing this?

Follow up: How do I properly instantiate prefabs through game object chains and use them?

Big thank you in advance.

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:
How to create an OpenGL texture using primitives? I'm currently rendering a large proportion of the graphics of my game using custom OpenGL primitive functions (e.g. DrawCircleFilled(), DrawPolygonFilled(), etc) drawing procedurally generated objects (e.g. trees). Typically the core of these functions is a glBegin and glEnd loop, and use GL_TRIANGLE_FAN, GL_LINE_LOOP, GL_LINES, or GL_POLYGON. While this generally works, I'm seeing some performance issues if I have too many objects using these functions on screen at once.

For instance, I could render a brick wall by drawing 128 small brick-coloured rectangles with an outline. Alternatively I could render a single OpenGL texture with these bricks pre-drawn, which takes up more video memory but seems to be less processor intensive.

With this in mind, my question is: how do I take the output of the primitive functions and store them in an OpenGL texture at runtime? I'm aware of how to do with with an SDL_Surface, but I don't have access to the primitive drawing functions in SDL and SDL primitive drawing is very slow (one of the reasons why I switched to raw OpenGL in the first place).

Advice appreciated.

Thanks,
Nathan

sentences:
How can I escape my field delimiter in my game's packet data? For my game I decided to not encrypt my packet's payload. Instead I'm just going to check everything on the server to make sure the packet is legitimate.

As I'm not doing any encryption, my packet's raw payload looks like this:

PacketID|Arg1|Arg2|Arg3[|Arg4...]

Now I want to encode those arguments, so if I have a | in for example a chat message, I can still handle my packet. How can I achieve this?

sentences:
Can't figure out how to create texture from a font-surface I can't seem to be able to render my font, it crashes and I can't figure out why. It seems to load the font correctly, but the parts relating to surface crashes.

Why does my texture crash?

Here is the code bits relating to it. SDL2 and TTF has been initialized properly.

        TTF_Font *arial;
        SDL_Color mm_txt_color = {255, 255, 255, 0};
        SDL_Texture *myTexture;
        SDL_Rect myRect;
        load_font(MM_FONT_ARIAL, 18,  &arial);

        get_text_and_rect(0, 0, "Exit", arial, &myTexture, &myRect);

int load_font(char *filepath, int size, TTF_Font **font)
{
    (*font) == TTF_OpenFont(filepath, size);
    if((*font) == NULL ) {
        printf("ERROR: Failed to load font: %s.\n", filepath);
        return FAILURE;
    }
    return SUCCESS;
}

    void get_text_and_rect(int x, int y, char *text, TTF_Font *font,
        SDL_Texture **texture, SDL_Rect *rect)
    {
        int text_width;
        int text_height;
        SDL_Surface *surface;
        SDL_Color textColor = {255, 255, 255, 0};

        surface = TTF_RenderText_Solid(font, text, textColor);
        *texture = SDL_CreateTextureFromSurface(renderer, surface);
        text_width = surface->w;
        text_height = surface->h;
        SDL_FreeSurface(surface);
        rect->x = x;
        rect->y = y;
        rect->w = text_width;
        rect->h = text_height;
    }

sentences:
Detect collision in Blender I am trying to write a Python function for Blender(2.66) game engine, that permits me to detect collision between two objects.

I tried to read the documentation, but it's very confusing, and I don't understand it.

Someone have an example how to do it?

sentences:
Designing an API for defining rigged game entities I am making a game framework for building/constructing what I would imagine are called something like "multi-component rigged entities". This would be things like a stick-figure drawing. Can't find a great animation to demonstrate, but something like this, where the head is a circle, the hands circles, the arms are poles, torso is one block, etc. (imagine there is no bending, only rigid shapes moving attached by joints).

I need to design some kind of API for a user of the framework to use to describe such a rigged entity.
As one example, I am looking at Vue.js and their API is basically like this, you have a template:

    Ask a yes/no question:
    <input v-model="question">

{{ answer }}

And a model, which has external/internal properties, computed properties, and methods:
var watchExampleVM = new Vue({
  el: '#watch-example',
  data: {
    question: '',
    answer: 'I cannot give you an answer until you ask a question!'
  },
  watch: {
    question: function (newQuestion, oldQuestion) {
      this.answer = 'Waiting for you to stop typing...'
      this.debouncedGetAnswer()
    }
  },
  created: function () {
    this.debouncedGetAnswer = _.debounce(this.getAnswer, 500)
  },
  methods: {
    getAnswer: function () {
      if (this.question.indexOf('?') === -1) {
        this.answer = 'Questions usually contain a question mark. ;-)'
        return
      }
      this.answer = 'Thinking...'
      var vm = this
      axios.get('https://yesno.wtf/api')
        .then(function (response) {
          vm.answer = _.capitalize(response.data.answer)
        })
        .catch(function (error) {
          vm.answer = 'Error! Could not reach the API. ' + error
        })
    }
  }
})

This is just one example of an API I am looking for.
But what I'm looking for is some inspiration, perhaps from Unity or some other gaming framework/engine, where it allows you to specify not "view components" but entire rigged entities like in this animation above.
It seems to come down to a skeleton with bones and joints, and the bones are somehow attached to skins, but that's as far as my knowledge goes, and I'm not really sure what a DSL sort of thing would look like for defining a rigged entity.
How can I design an API that handles this task?

sentences:
How to create seamless and coherent voxel terrain using simplex noise 2D? I'm using the simplex noise 2d plugin for unreal engine 4, which can also be understood by most programmers.
I have already implemented chunk generation and dual-chunk noise elevation.
However, each chunk has a unique heightmap and this results in jagged voxel terrains.
Pseudo code:

//Chunk.cpp
for(int chunkWidth = 0; chunkWidth <= 10; chunkWidth++){
   for(int chunkHeight = 0; chunkHeight <= 10; chunkHeight++){
      noiseX = ((chunkWidth / 10) - 0.5) * Frequency;
      noiseY = ((chunkHeight / 10) - 0.5) * Frequency;
      Elevation = SimplexNoise2D(noiseX, noiseY) * 100;
      ChunkLoc = getActorLocation(self);
      SpawnMeshAtLoc(ChunkLoc.x + chunkWidth, ChunkLoc.y + chunkHeight, Elevation);
   }
}

I have another variable available: chunk2DCoord(2D vector coordinate for each chunk)

sentences:
Card game - creating card Listener I am making a card game where there are 21 cards on hand and 2 options from where user can draw cards to his hand and throw a card from hand.

I am new on game development and I'm following the principle of MVC.
Till now in my game I have a InputHandler class that handel the input. GameWorld and GameRender are two class which controll the game logic and render the game respectively. Both of these class are called by GameScreen class which extends Screen.

My question is how should I implement the touchListener to these cards. They are now just sprites and I have used texture Packer to create a spriteSheet

Doing research i have found that Stage and Actor are the things that I am looking for. Reading on wiki I found that these are useful to create menus. I've also read that working with stage and Actor is  complex for creating game environment and follow the rule of MVC.

So, please anyone could guide me a way from where should I need to move forward. This is the very basic move that I need to move but I know if I did wrong here, i have to pay much more later.

sentences:
How to randomly place entities that don't overlap? I am creating a randomly-generated environment for a game I'm developing. I am using OpenGL and coding in Java.

I am trying to randomly place trees in my world (to create a forest), but I don't want the models to overlap (which happens when two trees are placed too close to each other). Here's a picture of what I'm talking about:

I can provide more code if necessary, but here's the essential snippets. I am storing my objects in an ArrayList with List<Entity> entities = new ArrayList<Entity>();. I am then adding to that list using:

Random random = new Random();
for (int i = 0; i < 500; i++) {
    entities.add(new Entity(tree, new Vector3f(random.nextFloat() * 800 - 400,
    0, random.nextFloat() * -600), 0, random.nextFloat() * 360, 0, 3, 3, 3);
}

where each Entity follows the following syntax:

new Entity(modelName, positionVector(x, y, z), rotX, rotY, rotZ, scaleX, scaleY, scaleZ);

rotX is the rotation along the x-axis, and scaleX is the scale in the x-direction, etc.

You can see that I am placing these trees randomly with random.nextFloat() for the x and z positions, and bounding the range so the trees will appear in the desired location. However, I would like to somehow control these positions, so that if it tries to place a tree too close to a previously placed tree, it will recalculate a new random position. I was thinking that each tree Entity could have another field, such as treeTrunkGirth, and if a tree is placed in the distance between another tree's location and it's treeTrunkGirth, then it will recalculate a new position. Is there a way to accomplish this?

I am happy to add more code snippets and details as necessary.

sentences:
How to project a foam trail on dynamically changing mesh I am trying to create water, and right now I got it through dynamically generating waves on a mesh. But now I want to make my boat manipulate these waves, and cause a Kelvin Wake on top of this.

Fact is I generate the water using different tiles, repeating the same pattern dynamically. So How would I generate this on top of a dynamically generated mesh(plane)? Without also manipulating the other tiles (planes)?

sentences:
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:
Increasing spawn difficulty I'm trying to increase the difficulty of the game over time. I'm using InvokeRepeating to spawn enemies and in the update function I calculate the next spawn time using the following code:

public Vector2 secondsBetweenSpawnsMinMax;
float nextSpawnTime;

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

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

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

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

sentences:
OpenGL 2D Depth Perception I have a 2D RPG game written in Java using LWJGL. All works fine, but at the moment I'm having trouble deciding what the best way to do depth perception is. So , for example, if the player goes in front of the tree/enemy (lower than the objects y-coordinate) then show the player in front), if the player goes behind the tree/enemy (higher than the objects specific y-coordinate), then show the player behind the object.

I have tried writing a block of code to deal with this, and it works quite well for the trees, but not for the enemies yet. Is there a simpler way of doing this in LWJGL that I'm missing?

sentences:
SDL2 - Inconsistent FPS with VSYNC I'm working on a game using SDL2. Today I noticed the game has some jolty issues when not fullscreened so I made an extremely simplified program that simply moves a square from left to right to see if the result is the same.

I expected the squares movement to be very smooth but instead it's very jolty/laggy (when not fullscreened).

At first I thought it was to do with how I was calculating the time between each frame but after outputting the 'ftime' I can see the time each frame takes ranges from 13 to 30(ish) as opposed to a consistent 16/17.

Here's the code:

#include <iostream>
#include <SDL.h>

const int GAME_WIDTH = 1920;
const int GAME_HEIGHT = 1080;

//frame independent movement variables
double old_time = 0;
double current_time = 0;
double ftime = 0;

#undef main
int main(int argc, char** argv)
{
    SDL_Window* mainWindow;
    SDL_Renderer* mainRenderer;

    SDL_Init(SDL_INIT_EVERYTHING);

    mainWindow = SDL_CreateWindow("MiracleSquare", 50, 50, GAME_WIDTH, GAME_HEIGHT, 0);
    mainRenderer = SDL_CreateRenderer(mainWindow, -1, SDL_RENDERER_PRESENTVSYNC);

    SDL_Rect miracleRect; //creating the SDL square
    miracleRect.x = 0;
    miracleRect.y = 400;
    miracleRect.w = 100;
    miracleRect.h = 100;

    bool running = true;

    while (running)
    {
        old_time = current_time;
        current_time = SDL_GetTicks();
        ftime = current_time - old_time;

        std::cout << ftime << std::endl;

        SDL_Event e; //stops crashing on input
        if (SDL_PollEvent(&e))
        {
            switch (e.type)
            {
            case SDL_KEYDOWN:
                break;
            default:
                break;
            }
        }

        miracleRect.x += (ftime / 1000.0f) * 100.0f;
        if (miracleRect.x> 1920) miracleRect.x = 0;

        SDL_SetRenderDrawColor(mainRenderer, 0, 0, 0, 255);
        SDL_RenderClear(mainRenderer);
        SDL_SetRenderDrawColor(mainRenderer, 255, 255, 255, 255);
        SDL_RenderDrawRect(mainRenderer, &miracleRect);
        SDL_RenderPresent(mainRenderer);
    }

    return 0;
}

Am I doing something wrong? As far as I can tell this should produce a smooth movement.

Any help would be greatly appreciated!

Edit: Since posting this I've figured out it has something to do with my use of dual monitors. If, for example, I have a video playing on chrome on my secondary monitor, the lag issue is very prominent. I'm now looking into if this issue is avoidable, or if I'll just have to ignore it.

sentences:
Random layout rooms with intersecting walls I am trying to layout few rectangle rooms on un unlimited map. The main condition is that every next room has to intersect with one of already placed with at least one point of the wall.

The number, width and height are random values generated by something like D&D dice rolling. Every next room can be adjacent to any placed rooms.
Result should look like a kind of dungeon (hope the picture makes it more clear)

I am afraid that different packing algorithms too heavy for that problem. I would greatly appreciate any advice!

sentences:
I love game development books but they're so expensive! What means do you use to get your game dev book fix? Do you pony up the big bucks for the thick books, or do you budget yourself and buy one at a time, or do you rent or limit yourself only to your library? Do you prefer to read them on your eBook reader?

How do you obtain your game development books?

sentences:
Graphical quality of open source vs. commercial games I'm new in Game development. I have researched many open source games. But I have not met any open source game which has high quality graphics, comparable to these found in commercial games.

What is the reason for this? Are open source game engines not advanced enough to support such graphics or is there just a lack of assets, textures and models?

I know that this question is very general, I would like to hear some points of view.

sentences: Is it possible to a create an Android game that uses the built in keyboard? I know the keyboard is probably built into the Android OS and I have a simple game idea, sort of like a word game, but is it possible to create a game that uses this in the game itself?

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:
Pygame platformer - Making sprite jump I am currently trying to make a Mario-type platformer using pygame and the MVC design pattern. My progress as of right now is getting a character on screen and having it move left and right.

My goal is to have this character have the ability to jump when spacebar is pressed. It is definitely recognizing that spacebar is pressed, but the character just stops in place instead of jumping. Here is the code for the character that I currently have:

import pygame

class Player(pygame.sprite.Sprite):
    def __init__(self, name, x, y, img_file):
        pygame.sprite.Sprite.__init__(self)

        self.image = pygame.image.load(img_file).convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.falling = True
        self.onGround = False
        self.v = 0
        self.speed = 2

    def moveLeft(self):
        self.rect.x -= self.speed
    def moveRight(self):
        self.rect.x += self.speed
    def jump(self):
        if self.onGround == False:
            return
        self.velocity = 8
        self.onGround = False

and here is the controller part corresponding to this:

if event.type == pygame.KEYDOWN:
    if(event.key == pygame.K_SPACE):
        self.player.jump()

Thanks

sentences:
How can I render attack ranges as in this screenshot? Divinity: Original Sin 2 has an amazing range-of-attack display. When I select a character's abilities, the range of the ability will appear (as shown in the screenshot below).

I'd like to know how to create an effect like this.

You can see this system in motion via this YouTube video

I think It just displayed navmesh , so I tried to display my navmesh.I used NavMesh.CalculateTriangulation() , GL API to displaying.

After baking navmesh attach this script to your camera and give this a material:

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

public class NavmeshDebuger: MonoBehaviour {
    public Material material;

    void OnPostRender() {
        var triangulation = NavMesh.CalculateTriangulation();
        if (material == null) {
            return;
        }
        GL.PushMatrix();

        material.SetPass(0);
        GL.Begin(GL.TRIANGLES);
        for (int i = 0; i < triangulation.indices.Length; i += 3) {
            var triangleIndex = i / 3;
            var i1 = triangulation.indices[i];
            var i2 = triangulation.indices[i + 1];
            var i3 = triangulation.indices[i + 2];
            var p1 = triangulation.vertices[i1];
            var p2 = triangulation.vertices[i2];
            var p3 = triangulation.vertices[i3];
            var areaIndex = triangulation.areas[triangleIndex];
            Color color;
            switch (areaIndex) {
            case 0:
                color = Color.red; break;
            case 1:
                color = Color.green; break;
            default:
                color = Color.blue; break;
            }
            GL.Color(color);
            GL.Vertex(p1);
            GL.Vertex(p2);
            GL.Vertex(p3);
        }
        GL.End();

        GL.PopMatrix();
    }

}

sentences: How can I get game objects and prefabs to recognize modifications in enum values from scripts in the scene window I have made a script with several properties and enums that I attached to an empty game object. I am making changes to the values within the inspector, since they a public. How can I get the scene window to recognize these changes as they occur?

sentences:
Why do I have to set my Unity app to full-screen manually on my phone When I open my unity app it doesn't go full-screen until I change it in the settings, isn't there a way to do that... it actually isn't a scaling problem or an aspect ratio.... Because you can see how in the phone settings it is turned off
Thanks in advance

sentences:
How to make game sessions like "with friends" games? I want to make a game like "words with friends" or "chess with friends" or "Draw Something" or any of the other online multiplayer type games that are based around friends having game sessions with each other.  I have made one app before that had no online features so I know the basics of objective-C and xCode.  I looked up facebook connect so I know how to make friends find other friends to play with through Facebook.  Just not how to make the gaming session.

I only need my game to send a small array (or XML if it's better) of strings and integers from one iPhone to the other as each iPhone takes a turn.  I'm NOT sending some complex video or anything like in "Draw Something."

I was hoping someone could point me in the right direction (whether link to website or book or just a general idea) for how to do gaming sessions between two iPhones.  I read this tutorial http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server  but it seems to be more about having two iPhones communicate over a server on a laptop or through the same wifi, not how to have iPhones game together over any Internet connection like in "with friends" games.

I've tried to research this in other places but I'm never quite sure if what the articles I find are talking about is related to what I want or not.  Someone please just point me in the right direction or give me a general outline of what to do.  I will look up the specifics on my own once I know what to look for.  Thank you.

sentences:
How can I publish a Python game on itch.io as html? I'm making a game with Python, using Pygame. I want to publish my game on itch.io so that it's playable in the browser.
Is there a way to do this? If so, how?

sentences:
Rogue Door Connection logic I'm having a bit of trouble developing code to figure out which doors connect in Rogue which is written in c. Not the actual path making. I just dont understand how they link to each other.

If rooms have 2 doors each then, while not the cleanest solution, I can connect the first rooms door1 to the second rooms door2 and continue that pattern, finally going around in a loop.

However, say there are 3 doors for one room, then that would break because one door wouldnt connect to anything. The same thing goes for a one door room.

Any help would be appreciated and links to examples would help too.

Thanks

EDIT

I'm not really generating paths right now, its more of the player teleporting to another door. If it were paths then of course it could intersect which takes care of the paths.

sentences:
DirectXCollision.h missing I am using DirectX10, June release and I am trying to

#include <DirectXCollision.h>

so that I can use the bounding objects, however it does not seem to be there. Am I missing something basic?

sentences:
How to manage requests for a MMOG? I read that most servers handle more than 50 requests per second. Is this true? how many requests can a normal server handle?

How do MMOG manage requests having to update player actions instantly?

sentences:
Problem with making camera follow player in Javascript So I'm testing a few things in Javascript and something I was testing was making the camera follow the player. When I move the player, instead of the dots going away from the player, they follow the player and it looks very strange.

Here is the code: https://codepen.io/anon/pen/wLgEPO?editors=0010

Move the player using the arrow keys.

Thanks.

sentences:
Phaser: Shader Chain I want to implement lighting via shadowmaps. I see process as:
1) render something to RenderTexture1(size as game)
2) create RenderTexture2 (custom size)
3) add it to Image2 (custom size)
4) apply "generate lightmap" shader to that image, with RenderTexture1 as additional channel
5) create RenderTexture3(size as game)
6) add it to Image3(size as game)
7) Apply "generate light from lightmap" shader, with rendered lightmap as additional channel

I have a problem on last step, seems texture passing as additional channel is not rendered with shader. however it's ok in image.

code:

create() {
    ...
    this.sourceRT = this.game.make.renderTexture(this.game.width, this.game.height);

    this.shadowMapRT = this.game.make.renderTexture(this.SHADER_SIZE, this.SHADER_SIZE);
    this.shadowMapImage = this.game.add.image(0, 0, this.shadowMapRT);
    this.shadowMapImage.filters = [this.shadowTexureShader];

    this.lightingRT = this.game.make.renderTexture(this.game.width, this.game.height);
    this.lightingImage = this.game.add.sprite(200, 0, this.lightingRT);
    this.lightingImage.filters = [this.shadowCastShader];

    this.shadowTexureShader.uniforms.iChannel0.value = this.sourceRT;
    this.shadowCastShader.uniforms.iChannel0.value = this.shadowMapRT;
}

update() {
    this.light.x = this.game.input.activePointer.x;
    this.light.y = this.game.input.activePointer.y;

    this.sourceRT.renderRawXY(this.renderGroup, 0, 0, true); // this.renderGroup is a group with shadow-casters

    this.shadowTexureShader.uniforms.uLightPosition.value = [this.light.x, this.light.y];
    this.shadowCastShader.uniforms.uLightPosition.value = [this.light.x, this.light.y];
}

Additional re-explanation with picture:

I take texture0, apply shader to it (texture1 as an additional channel), to get shadowmap. Then i want to take texture1, apply shader2 to it, with texture2 (given by shader as additional channel) to get shadows from objects.

Problem at the question mark -- instead of getting texture2 (processed by shader1) i get texture0 (still unprocessed). I want to get rendered texture2 in my shader2.

sentences:
Farseer: How can I remove a body? I have many sensors(coins) in each level and I want to remove the sensors(coins) when the player rectangle(Mario) touches them. I check in OnCollision if Mario touches a coin, if he touches it, it should be removed. But I don't know how to remove a body.

What is the best way to remove a body?

How can I remove a coin in this example?

bool Player_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
    {
      if (fixtureB.CollisionCategories == Category.Cat10)
        {

        }
        return true;
    }

 coinrect = BodyFactory.CreateRectangle(world, 0.64f, 0.64f, 1.0f);
 coinrect.BodyType = BodyType.Static;
 coinrect.Position = new Vector2(1.60f, 4.16f);
 coinrect.CollisionCategories = Category.Cat10;

 coinrect2 = BodyFactory.CreateRectangle(world, 0.64f, 0.64f, 1.0f);
 coinrect2.BodyType = BodyType.Static;
 coinrect2.Position = new Vector2(2.60f, 3.16f);
 coinrect2.CollisionCategories = Category.Cat10;

 playerrect = BodyFactory.CreateRectangle(world, 0.64f, 0.64f, 1.0f);
 playerrect.BodyType = BodyType.Dynamic;
 playerrect.Position = new Vector2(0.22f, 0f);
 playerrect.FixedRotation = true;

 playerrect.OnCollision += Player_OnCollision;

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:
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:
AntiGravity Vehicle? I'm making a racing game akin to F-Zero and Mario Kart 8 with AG mechanics. I currently have a vehicle that is a rigidbody with normal gravity pointing down. True to AG games, I want the gravity to always be applied against the surface of the track (e.g. the player will stick to the surface of an upside-down track). I figure I have two options:

Shoot a raycast below the vehicle that returns the normal of the surface. Apply gravity in the direction of that normal.

Have several "checkpoints" that determine the direction of gravity in that area. When inside, the vehicle is affected by that new gravity.

The issue with option #1 is that it may not work if I wanted ramps or airtime. I could possibly extend the raycast down a lot further to get the normal even in the air, but that could lead to a lot of glitches. There's also the instance that there is no floor below the player. I noticed MK8 even had gliding sections in anti-gravity where you would twist in the air back to normal gravity, which leads me to believe they had something like #2. The issue with #2 however is that it may require a LOT of checkpoints to be manually placed.
I'm wondering if anyone has an idea to some simpler alternative?

sentences:
Is Rigidbody a variable type? I been searching for this for a while online but found no good answer so now I'm asking here. I have a scripting question about Unity's Rigidbody.

When your making a game object move with Rigidbody you typically make a script for it that starts off with

public Rigidbody rigid;

Then you put in a GetComponent call like so

void Start() {
  rigid = GetComponent<Rigidbody> ();
}

And the part I don't understand is how the Rigidbody variable works. Is it a variable type that unity is using cause even in the GetComponent it starts looking for Rigidbody not rigid. That seems like making a int variable then calling it saying Debug.Log(Int);

Also in unity script from the documentations it uses

function Start () {
  var rb = GetComponent.<Rigidbody>();
}

Theres no Rigidbody in the declaration of the variable at all. Thats what made it even more confusing for me due to how GetComponent cleary shows it getting just the Rigidbody component but from the look of the script how does it connect to the game object?

With the C# example you drag and drop the GameObject in the Rigidbody variable even when the script is connected.

The reason why I'm asking is because I'm wanting to learn intuitively where I understand all the meaning of code like a second language. Is that normal?

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:
Separating Axis Theorem and rotated objects Quick question which hopefully won't require thralling through my code.

I have a working implementation of SAT for 3D collision detection but I'm having some problems with dealing with rotated objects. So what I have done, is every frame I rotate every point in both objects by their rotation quaternions. This feels excessive, especially if I am going to be translating/scaling/rotating every vertex in every object on every frame for the collision detection.

I would hope there's a way of implementing my SAT implementation to work with rotated normals only, and not need the rotated projections to compensate, but that doesn't seem to be working.

Could anyone provide me with a brief explanation with how SAT should be expected to handle rotations? Can we rotate certain points, or perhaps get some sort of post-projection rotation value to skew our projections like we can with translations?

Thanks

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:
Limit mouse movement within 2 points I have a circle sprite that i only want to move between 2 empty game objects (points). Using Vector3.Lerp() I'm able to move the circle between those points

void FixedUpdate()
{
    float speed = 10 * Time.deltaTime;
    float current = Mathf.PingPong(Time.time * speed, 1.0f);
    transform.position = Vector3.Lerp(startPoint.position, endPoint.position, current);
}

The output:

The problem:

I want to move that circle using a mouse drag (basically like a UI slider from point a to point b) and as soon as the mouse leaves the circle to stop moving it

I can currently move the circle anywhere on the screen using the mouse. I've set a circleCollider2D around the circle sprite and I have this code that moves the circle

bool Selected = false;
void Update()
{
    if (Selected)
    {
        Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        transform.position = cursorPos;
    }

    if (Input.GetMouseButtonUp(0))
        Selected = false;
}

void OnMouseOver()
{
    if (Input.GetMouseButton(0))
        Selected = true;
}

What I've tried:

I have tried adding a gameobject with a box collider between the two points and using triggers to detect when the circle exits the trigger
(OnTriggerExit2D), but this solution only works when the circle fully leaves the collider (which i don't want). I want a way for the circle to move just like its moving currently with Vector3.Lerp but with mouse control
I tried locking the circle to only one axis and moving it. While this worked, it failed when i rotated the whole slider as its only locked on one axis and rotation doesn't change that
I have also tried to implement the mouse position into the Vector3.Lerp function with no luck
Vector3.Lerp(startPoint.position, endPoint.position, mousePosition.x);

I tried with y and z, all of it failed. And this way wouldn't work when i go to rotate the slider

sentences:
Programmatically creating a continuous scrolling background in Game Maker: Studio I have 15 background images for a 2D horizontal scrolling shooter game and I have been wondering how to insert programmatically those background images in the first level room, as I want them to be displayed one after the other looking as they were one large background image, repeating the last four ones until the boss is defeated.

I have seen that in Game Maker: Studio only 8 background slots are available in each room, so how could I achieve doing what I need here?

sentences:
How to make gameObjects in Unity move in predefined patterns easily I am trying to make a bullet hell game. I want my 2D enemies to move in predefined, curving patterns. How should I do this?

The difficulty I have is being able to quickly produce enemy movements that are

(A) predefined, not random

(B) curved

(C) easy to make, with little coding

(D) visually able to see what is going on, maybe in the inspector?

Perhaps a 3rd party tool may be warranted?

sentences:
Preventing diagonal movement I was originally fine with diagonal movement but it's clashing with my sprite animation...

    public void keyPressed(KeyEvent e){
    int key = e.getKeyCode();

    switch(key){
        case KeyEvent.VK_W:{
            dir = 3;
            velY = -speed;
            break;
        }
        case KeyEvent.VK_S:{
            dir = 2;
            velY = speed;
            break;
        }
        case KeyEvent.VK_A:{
            dir = 1;
            velX = -speed;
            break;
        }
        case KeyEvent.VK_D:{
            dir  = 0;
            velX = speed;
            break;
        }
    }
}

public void keyReleased(KeyEvent e){
    int key = e.getKeyCode();

    switch(key){
        case KeyEvent.VK_W:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_S:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_A:{
            velX = 0;
            break;
        }
        case KeyEvent.VK_D:{
            velX = 0;
            break;
        }
    }
}

    public void update(){
    y += velY;
    x += velX;
}

I thought that perhaps a switch statement or an if else statement would prevent multiple keys from firing at once, but it's not working out. I even tried synchronizing some methods but still to no avail. Any suggestions? And please ignore the dir variable I use it to find the direction the player is facing.

sentences:
How can I read an image from a binary file? I'm trying to put all the assets inside a binary file and then trying to read them from the file itself, without scattering all them around in separate folders to let them exposed. What I'm trying to achieve is something like the way that RPG Maker and Wolf Editor use to join all the images / sounds of the game into a single customized format file (e.g. Data.wolf).

It's a very simple security's method but is enough for what I'm planning.

For now, I have the following code for reading a PNG file inside the binary, that always prints an error's message when it trys to create a new surface from IMG_LoadPNG_RW, saying "Error reading the PNG file."

tString sResult{};
cFile_Manager::tRead_File oRead(sDir, std::ios::binary);

if(oRead.is_open()) {
    tString sLine{};
    while(getline(oRead, sLine)) sResult += sLine + "\n";
    oRead.close();
}else {
    throw cLog("\n\n[ERROR] Wrong dir passed.\n\nDIR: %s\n\n", sDir);
}

SDL_RWops* aRW{};
aRW = SDL_RWFromConstMem(&sResult, sizeof(sResult));

if(!aRW) // Error message

SDL_Surface* aSurface{};
aSurface = IMG_LoadPNG_RW(aRW);

if(!aSurface) // This is where SDL shows "Error reading the PNG file."

EDIT: Omg I made some mistakes, now this is the correctly code. Now it gives a different error: "PNG file corrupted by ASCII conversion"

    char* sBuffer{};
    if(oRead.is_open()) {
        oRead >> std::noskipws;
        oRead.seekg(0, oRead.end);
        int iLength = oRead.tellg();
        sBuffer = new char[iLength];
        oRead.seekg(0, oRead.beg);
        oRead.read(sBuffer, iLength);
        oRead.close();
    }else {
        throw cLog("\n\n[ERROR] Wrong dir passed.\n\nDIR: %s\n\n", sDir);
    }

    SDL_RWops* aRW{};
    aRW = SDL_RWFromConstMem(sBuffer, sizeof(sBuffer));

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:
XNA Textures with background color I am fairly new to XNA and I have questions in regards to textures.

Most of my of textures have a background color along with the overall image (white, black, or whatever). This is quite ugly as the users main character, ship, or bullets, ect, have this black or white background with it. Is there any function, tool, or anything that will enable me to crop the actual part of the image i want to use as the texture?

I am by no means good with and photo editors or anything graphic related.

I came up short with google, as most results led me no where.

All help is appreciated. Thank you.

sentences:
Don't understand how paddle location is tracked; using XNA tutorial Wanting to learn how to make games, decided to use Monogame. Have pretty light programming knowledge, so I apologize beforehand for my ignorance to this surely obvious oversight.

Following a beginner's tutorial on XNA game development. It's a simple ball and paddle game that has a game class, paddle class, and ball class.

Now my problem lies in the code for the ball class.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    namespace BreakingOut
{
class Ball
{
    Vector2 motion;
    Vector2 position;
    float ballSpeed = 4;

    Texture2D texture;
    Rectangle screenBounds;

    public Ball(Texture2D texture, Rectangle screenBounds)
    {
        this.texture = texture;
        this.screenBounds = screenBounds;
    }

    public void Update()
    {
        position += motion * ballSpeed;
        CheckWallCollision();
    }

    private void CheckWallCollision()
    {
        if (position.X < 0)
        {
            position.X = 0;
            motion.X *= -1;
        }
        if (position.X + texture.Width > screenBounds.Width)
        {
            position.X = screenBounds.Width - texture.Width;
            motion.X *= -1;
        }
        if (position.Y < 0)
        {
            position.Y = 0;
            motion.Y *= -1;
        }
    }

    public void SetInStartPosition(Rectangle paddleLocation)
    {
        motion = new Vector2(1, -1);
        position.Y = paddleLocation.Y - texture.Height;
        position.X = paddleLocation.X + (paddleLocation.Width - texture.Width) / 2;
    }

    public bool OffBottom()
    {
        if (position.Y > screenBounds.Height)
            return true;
        return false;
    }

    public void PaddleCollision(Rectangle paddleLocation)
    {
        Rectangle ballLocation = new Rectangle(
            (int)position.X,
            (int)position.Y,
            texture.Width,
            texture.Height);

        if (paddleLocation.Intersects(ballLocation))
        {
            position.Y = paddleLocation.Y - texture.Height;
            motion.Y *= -1;
        }
    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(texture, position, Color.White);
    }
}
}

When I run the game, it functions properly. Player moves the paddle, and when the ball collides with the paddle, it bounces off.  I don't understand how the Ball class knows the paddle location though.  It's not like paddleLocation is a public variable in the paddle class.

sentences:
Playing two sound effects in a queue libgdx I've been developing this game for which I need to play two sound instances one after another.
Calling them one after another results in overlapping sounds.
The issue is there is no way to know if a sound has finished playing, any workarounds anyone has found for this?

sentences:
Map generator sometimes doesn't work I am making a dungeon map generator and am currently trying to make it place empty rooms. It first checks if the space is empty and then places a room.
The problem is that most of the times it compiles and I get a map/2d array printed, but sometimes it compiles but doesn't print the map. I don't get an error.

public class Mapa {

public static void main(String[] args) {
     // Create a 2D array map filled with floors

    char map1[][] = new char[100][100];
    for (int i = 0; i < map1.length; i++) {
        for (int j = 0; j < map1[i].length; j++) {
            map1[i][j] = tiles.wall();

        }
    }
    char mapFinal[][] = roomPlacement(map1);
    for (int i = 0; i < mapFinal.length; i++) {
        for (int j = 0; j < mapFinal[i].length; j++) {
            System.out.print(mapFinal[i][j] + " ");
        }
        System.out.println();
    }

}

public static char[][] roomPlacement(char map1[][]) {
     // this method places rooms into the 2D array map

    char mapReplacement[][] = map1;

    int roomNumber = (int) (10 + (Math.random() * 10));
    int roomLength = (int) (10 + (Math.random() * 10));
    int roomWidth = (int) (10 + (Math.random() * 10));

    int startPositionX = (int) (Math.random() * (mapReplacement.length - roomLength));
    int startPositionY = (int) (Math.random() * (mapReplacement.length - roomWidth));

    int counter = 0;

    while (roomNumber > counter  ) {
        if (position(startPositionX, startPositionY, roomLength, roomWidth, mapReplacement)) {

            if (roomSpace(mapReplacement, startPositionX, startPositionY, roomLength, roomWidth) == true) {
                for (int i = startPositionX; i < (startPositionX + roomLength); i++) {
                    for (int j = startPositionY; j < (startPositionY + roomWidth); j++) {
                        mapReplacement[i][j] = tiles.floor();
                    }
                }
            }
            if (roomSpace(mapReplacement, startPositionX, startPositionY, roomLength, roomWidth) == false) {
                startPositionX = (int) (Math.random() * (mapReplacement.length - roomLength));
                startPositionY = (int) (Math.random() * (mapReplacement.length - roomWidth));

            }

            counter++;
        }

        roomLength = (int) (10 + (Math.random() * 10));
        roomWidth = (int) (10 + (Math.random() * 10));

    }

    return mapReplacement;
}

public static boolean roomSpace(char map1[][], int startPositionX, int startPositionY, int roomLength,
        int roomWidth) {
    // this method checks if there is enough free space

    boolean isFreeSpace = false;
    char mapCheck[][] = map1;

    int counter = 0;
    for (int i = startPositionX; i < (startPositionX + roomLength); i++) {
        for (int j = startPositionY; j < (startPositionY + roomWidth); j++) {
            if (mapCheck[i][j] == tiles.wall()) {
                counter++;
            }
        }
    }

    if (counter == (roomLength * roomWidth)) {
        isFreeSpace = true;
    }

    if (isFreeSpace == true) {
        System.out.println("true");
    } else if (isFreeSpace == false) {
        System.out.println("false");
    }

    return isFreeSpace;

}

public static boolean position(int startPositionX, int startPositionY, int roomLength, int roomWidth,
        char mapReplacement[][]) {
    boolean position = false;
    // checks if the room is out of bounds
    if (startPositionX > 0 && startPositionX < mapReplacement.length && startPositionX + roomLength > 0
            && startPositionX + roomLength < mapReplacement.length && startPositionY > 0
            && startPositionY < mapReplacement.length && startPositionY + roomWidth > 0
            && startPositionY + roomWidth < mapReplacement.length) {
        position = true;
    }

    return position;
}

  }

Sorry for the long code but wanted to let you see the whole code to better understand it

sentences:
Make UI draggable from clicked vertices of UI I am able to make my UI panel draggable. Here is the script, it will be helpful:
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class UIElementDragger : EventTrigger
{

    private bool dragging;

    public void Update()
    {
        if (dragging)
        {
            transform.position = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
        }
    }

    public override void OnPointerDown(PointerEventData eventData)
    {
        dragging = true;
    }

    public override void OnPointerUp(PointerEventData eventData)
    {
        dragging = false;
    }
}

It is working fine but with one issue. Each time I click to drag the panel, my UI panel drag from the center (i have custom panel anchor). Is there any way available to move it with the clicked position of UI? I mean it should be draggable from where i have clicked. Certainly, problem lies in this line
transform.position = new Vector2(Input.mousePosition.x, Input.mousePosition.y);

transform.position need to change to clicked position of object?
https://www.youtube.com/watch?v=gayEHaol4Lc

sentences:
Implementing DirectX 7 light attenuation in Unity's Universal Render Pipeline I am create a modern Unity based client of an old MMO from 2000, and I am working on implementing their lighting system. Based on the data I have reverse engineered, it looks like they used a custom attenuation formula. The original client uses DirectX 7. I have found a reference sheet for DX7 light.
http://developer.download.nvidia.com/assets/gamedev/docs/GDC2K_D3D_7_Vert_Lighting.pdf
The relevant info starts at page 17. In the URP, in Lighting.hlsl, I have set up linear attenuation:
float range = rsqrt(distanceAndSpotAttenuation.x);
float dist = distance( positionWS, lightPositionWS);
half attenuation = 1.0f - dist/range;

Looks good! https://i.imgur.com/5bfJ5fF.png
Everything looks good. Now I am trying to (based on the document) recreate the same linear attenuation. It should look something like this:
// DX 7
float range = rsqrt(distanceAndSpotAttenuation.x);
float dist = distance( positionWS, lightPositionWS);
half c0 = 1.0f;
half c1 = 1.0f;
half c2 = 0.0f;
half d = dist/range;
half attenuation = 1.0f / ( c0 + c1 * d + c2 * d * d );

This should give me linear attenuation according to the doc, but it ends up bleeding light way past the range of the light. So I am convinced the distance is wrong. What kind of value is expected here? Normalized distance? It doesn't specify. I have played around with the distance a lot. Set it to the attenuation in the first code example, to the raw value, and a bunch of other values. No luck: https://i.imgur.com/JWJ0HF2.png
Does anyone have any ideas?

sentences:
Mirror Create Player From Client and Change Scene I'm very new to Mirror in Unity but I have a lot of experience in Network-programing.
I'm currently trying to create a Game, where the Player's data is stored on the client, and can join different games (not concurrent) with his/her character. (Likely to Terraria)
So I can't use the automatic Player creation of the default NetworkManager class. After clicking "Join/Host" in our Main-Menu I want to change to the scene the player has played in, Hosting/joining a server and create the player on the server with the specific position...
I have tried now multiple attempts to do this, but none of mine seemed to work.
Am I the even possible to have the players in different scenes with ease?
Where/When should I create the Player so isn't null on the Server?

sentences:
XNA Move List of Rectangles I have a game in which sprites will be removed and added under different circumstances, and so I created Rects of type List<Rectangle> to hold the bounding rectangle for each sprite.

List<Rectangle> Rects = new List<Rectangle>();

Within Initialize():

playerTexture = Content.Load<Texture2D>("player");
cowTexture = Content.Load<Texture2D>("cow");
player = new Player(playerTexture, new Vector2(100, 100));
Rects.Add(player.Bounds);
for (int i = 0; i < 5; i++)
{
    Cow cow = new Cow(cowTexture, graphics);
    cows.Add(cow);
    Rects.Add(cows[i].Bounds);
}

What I want to do is iterate through every rectangle in the list and move it when the player approaches the edge of the screen. This is the code with which I have tried to do this:

for (int i = 0; i < Rects.Count; i++)
{
    if (player.Bounds.Left < 60)
    {
        Rects[i].Offset(2, 0);
    }
    if (player.Bounds.Right > GraphicsDevice.Viewport.Width - 30)
    {
        Rects[i].Offset(-2, 0);
    }
    if (player.Bounds.Top < 60)
    {
        Rects[i].Offset(0, 2);
    }
    if (player.Bounds.Bottom > GraphicsDevice.Viewport.Height - 30)
    {
        Rects[i].Offset(0, -2);
    }
}

But when my player gets to the edge of the screen, he very happily leaves and none of the sprites move. What am I doing wrong?

sentences:
How to project a 3D circle/ellipse to 2D? The 3D ellipse is represented by its center and the vectors for its major and minor axes and the 2D ellipse by its center, the length of the major and minor axes and the angle between the major axis and the x-axis. I need the general projection on an axis-aligned plane, discarding a coordinate.
The problem is that the axes after projection are no longer are aligned to the true axes of the 2D ellipse.

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:
Move with velocity based on rotation So I have a simple script to move a character. The problem is that no matter where i'm looking at (my y rotation) it always makes me go the direction if I try to go forward, but I want it to go toward where i'm looking when I go forward or relative to where i'm looking for any direction. HOw can I do this ? (also I do not want to use a already existing fps controller) transform.forward works but only if I go forward or backward, not for left right or diagonal.
(placed on player)

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

public class player : MonoBehaviour
{
public float speed;
Rigidbody rb;

void Start()
{
    rb = gameObject.GetComponent<Rigidbody>();
}

void Update()
{
    float x = Input.GetAxis("Horizontal");
    float z = Input.GetAxis("Vertical");
    rb.velocity = new Vector3(x*speed.rb.velocity.y,z*speed);
}
}

for my camera, I am using a script I found online:
(placed on player)

using System;
using UnityEngine;

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;
Rigidbody rigidbody;
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);
    }
}

void Start ()
{
    Cursor.lockState = CursorLockMode.Locked;
    rigidbody = gameObject.GetComponent<Rigidbody>();
    if(GetComponent<Rigidbody>())
    {
        GetComponent<Rigidbody>().freezeRotation = true;
    }
}
}

sentences:
What are Layout Qualifier in GLSL used for? So I'm reading up on GLSL 4.0 standard and I see things like "layout (location = 0) in vec3...."

I understand they dictate where certain values are placed but...

Do particular locations hold special meaning (as in the index #s)?
Since I'm sending data by getting that attribute/uniform location by name, what advantage does it provide me?
What are some use cases / tricks done by using it?

On a side note: I see gl_FragColor is depricated, is gl_position deprecated too? Is there a particular name for the frag. shader output or is any vec4 output considered the final result?

sentences:
How to remove gameobjects that have the same transform position as each other? If I have 4 copies of the same gameobject in my scene and they all have the exact same transform position as each other, how can I remove the 3 duplicates so that only one unique gameobject remains? This is what I tried so far...

private void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        RemoveDuplicate(GameObject.FindGameObjectsWithTag("Path"));
    }
}

private void RemoveDuplicate(GameObject[] other)
{
    for (int i = 0; i < GameObject.FindGameObjectsWithTag("Path").Length; i++)
    {
        if (GameObject.FindGameObjectsWithTag("Path")[i] == other[i]) continue;
        if (GameObject.FindGameObjectsWithTag("Path")[i].transform.position == other[i].transform.position)
        {
            Destroy(other[i]);
        }
    }
}

But it doesn't work at all. Any ideas?

sentences:
Securing HTTP data from a JavaScript game to server Suppose I am doing a JavaScript game, and I wish the game to update the server if the user has successfully completes the game and his outcome.

How should I ensure that the request came from the JavaScript game, and that the data sent has not been tampered with. I am using PHP as the server-side language.

I do understand that no strategies are going to be 100% fool-proof, and any measures taken is more of a deterrence than absolute protection.

On Edit: Let's supposed we're not using server verification of each user's step (as in a traditional MMO). The game could be a mini-game as part of a web game or educational game (space invaders or a real-time game, for example) and requiring a server-side component for each of those games could be tedious.

Example: Supposed, when the game is completed, a request is sent to the server via. AJAX

game_finished.php?user_id=1&outcome=success&score=88

A user could 'fake' the server in believing that the game has been completed correctly by sending that request to game_finished.php. How could this be made more difficult?

sentences:
Write colors with alphablending but don't write into the alpha channel I am using XNA 4.0, hence DX9 and HLSL. I have a RenderTarget2D "MAIN" that I want to add semi-transparent objects "TRANS" to. I want them to blend with MAIN using the TRANS's alpha and inverseAlpha BUT I want to preserve information kept in the MAIN's alpha channel.

If I simply use BlendState.AlphaBlend, MAIN's alpha channel becomes 1 everywhere where TRANS is written. I know there is a property in the BlendState class that prevents writing to color channels Is there an option that prevents writing to alpha?

Thanks.

sentences:
How is a DirectX Adapter Different from a Device? I'm relatively new to DirectX programming, and this is one of the more confusing issues I've encountered to date. According to the MSDN Documentation for DirectX 11:

  "A device is used to create resources and to enumerate the capabilities of a display adapter."

and from the MSDN Documentation for DirectX 9:

  "An adapter is a physical piece of hardware. Note that the graphics card might contain more than a single adapter, as is the case with a dual-headed display. "

From my neophyte perspective, these two concepts seem to overlap a fair amount. Am I correct in understanding that a device is an abstraction/encapsulation of a single adapter, which in turn is a software abstraction of a particular graphics card in the system?

sentences:
How would one create a "start button" on a website similar to some Korean games? Some games have buttons that would actually let you click them and you'd log right into the game.  How does the web browser get permission to do this without plugins? Perhaps the client  registers a custom protocol URL?

They used to be popular a few years back - I can't remember any implementations off the top of my head. On desktop browsers, if your game client was installed clicking 'Play' on the home page would boot up the game begin it with you already signed in. It was popular with arcade games so you could browse the sessions on the web and then simply hit 'Start'. You didn't need any browser plugins.

sentences:
C++ game architecture I'm trying to make a game, but I'm not sure of the best way to set up the main loop and classes. For really small games, I could put everything in the main() loop, including event handling, collision checking, etc. However, for large games, that's seems like a highly inefficient way to get things done. The architecture I want is kind like the way the Minecraft coders did it (I quote Minecraft code because I've seen the source code when downloading MCP).

They have objects entity classes EntityCow and EntityChicken and they have methods like onDeath(), onLivingUpdate(); and item classes like ItemSword have methods like onItemUse(). I've never seen these methods get called directly, but apparently, they get stored in a class called DataWatcher, which, I think "watches" all the data (as the name implies) and calls the appropriate methods in the objects.

Is that how most games do it? If so, how is the DataWatcher class implemented? Any help or alternate suggestions is really appreciated.

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:
How do I create user-friendly, unique game IDs? How do I create unique game IDs which are also user friendly -- so that one user can easily give that game ID to someone else for joining the game.

I am creating my game in Silverlight with C#.

sentences:
Do iOS users use Facebook and Twitter buttons within games? Does anyone have any insight or experience into the successfullness of placing Facebook or Twitter "share" buttons within an iOS game?  For example, when a user gets a high score, presenting them with the option to share their score via Facebook or Twitter.

My reservations/bias against including Facebook or Twitter buttons in my game are:

Distrust of buttons that auto-post without giving one the chance to format the text yourself
I don't use themself because I tend to manually create tweets or Facebook wall posts on my own

On the other hand, the potential benefits of such buttons can obviously be profound.  The question is simply: do iOS users actually use such buttons?

sentences:
How to set my game to load low-level drivers from a different System32 folder path The title says it all
I'm doing a test with my game
and I need to know how to set it up
where my game loads low-level drivers from a System32 Folder that is
in another path instead of this

example: C:\Windows\System32

a new path I want to have my game load drivers from:
D:\Windows\System32

and can I make my game load low-level drivers from this path
with some c++ coding in visual studio?

sentences:
How to add several GameComponents of the same type? in order to load 3D-meshes to my project i created a BasicModel class. I made it a DrawableGameComponent so I can override methods like Draw & LoadContent. Plus I have access to the GraphicsDevice etc.

Now I realized that if I try to add several instances of the same GameComponent I get an exception that says that it is not allowed to do this.

Was it even a good thing to do, making the Class a GameComponent?
Is there a way to somehow differ single Components, so that I can add several copies of it to the game?

Thanks in advance.

sentences:
How to rotate player to face mouse on canvas? I'm building a basic game using plain javascript and I am trying to rotate my object to follow my mouse.

I've tried getting the client's mouse X and Y then subtracting the canvas width and height divided by two. Then taking those values and inputing it into Math.atan2(). However, I feel the issue may be in my transform and rotate. The code bellow is what I've tried.

WIDTH = c.height;
HEIGHT = c.width;
document.onmousemove = function(ve){
            let cX = -c.width / 2;
            let cY = -c.height / 2;
            let x = ve.offsetX;
            let y = ve.offsetY;
            var rX = cX + x - 8;
            var rY = cY + y - 8;
            player.angle = Math.atan2(rX, rY) / Math.PI * 180;
        }
function update(){
                        var now = Date.now();
                        dt = now - lastUpdate;
                        ctx.clearRect(0, 0, WIDTH, HEIGHT);
                        ctx.setTransform(1, 0, 0, 1, WIDTH / 2, HEIGHT / 2);
                        ctx.rotate(player.angle + 10);
                        drawCircle(player.x, player.y, 20, 0, 180, "red");
                        ctx.setTransform(1, 0, 0, 1, 0, 0);
}
setInterval(update, dt/10000);

The player spins around my mouse in wide circles with no apparent pattern.
Here's a gif showing what's happening.
https://gyazo.com/006c99879ecf219791d059de14d98b74

sentences:
Generating grammatically correct MUD-style attack descriptions I am currently working on a text based game, where the outcome of a combat round goes something like this

%attacker% inflicts a serious wound (12 points damage) on %defender%

Right now, I just swap %attacker% with the name of the attacker, and %defender% for the name of the defender. However, the description works, but don't read correctly. Since the game is just all text, I don't want to resort to generic descriptions (Such as "You use Attack on Goblin for 5 damage", which arguably solve the problem)

How do I generate correct descriptions for cases where %attacker% refers to

"You", the player? "You inflicts..." is wrong
"Bees", or other plural? I need somehow to know I should prefix the name with a "The "
If %attacker% is a generic noun, such as "Goblin", it will read weird as opposed to %attacker% being a name. Compare "Goblin inflicts..." vs. "Aldraic Swordbringer inflicts...."

How does text-based games usually resolve such issues?

sentences:
Card game design, converting cards back into gold I'm working on a collectible card game on the card game platform dulst. https://dulst.com/nasuverse

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

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

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

Thanks.

sentences:
Random movement of game Object staying in a circle I want to write a script which makes several objects move in a random direction but within a range around another game object. If the parent object moves then that range should also be changed accordingly.

How can I achieve such behavior?

Here is a video which demonstrates the behavior I am looking for.

It looks approximately like this:

   void Update ()
   {
        time += Time.deltaTime;

        if (time > 1.0f)
        {
            CalculateRandomRotation ();
            time = 0f;
        }

        FindSpiritsBound ();

    }

    void CalculateRandomRotation()
    {
        x       = Random.Range(-velocityMax, velocityMax);
        z       = Random.Range(-velocityMax, velocityMax);
        angulo  = Mathf.Atan2(x, z) * (180 / 3.141592f);
        time    = 0.0f;
        transform.localRotation = Quaternion.Euler(0, angulo, 0);
    }

    void FindSpiritsBound()
    {
        if (Vector3.Distance (parentObj.transform.position, gameObject.transform.position) < 3f)
        {
            gameObject.transform.localPosition += gameObject.transform.forward * 4f * Time.deltaTime;
        }
       else
        {
         transform.position = Vector3.MoveTowards(transform.position, parentObj.transform.position, 2.0f);
        }
    }

Here is my script which doesn't seem to work properly as on moving the main character, spirits are going wayward.

sentences:
Mixamo: can animations ("without skin") be re-used on any Mixamo rigged model? I've discovered Mixamo very recently. I plan to use its auto-rigging capability on all my unrigged characters.

The download option can either include the skin or just obtain the animation.

My understanding is that an animation is "simply" applying a composite timeline where each bone is modified separately.

Am I right to believe that downloading an animation from Mixamo makes it compatible with every Mixam-rigged character? Or am I to download the same animations for each variation in my skeletons (arm length, hip width, neck size, etc.) ?

Quick heads up: Mixamo

Mixamo is an auto-rigging tool. For instance, this Blender character will be imported as a .zip (containing my .obj and .mtl)

You are just expected to place the following colored circles on your humanoid:

After the auto-rigging completes, you can either download your static, rigged character (as an .fbx) or animate it using one of the many free animations. After applying an animation (one at a time), you can either download the character (mesh) plus its anim or simply the bare skeletal animation.

Thanks!

sentences:
Best way to detect if vec3 is between vec3(x) and vec3(y) in glsl As titled

I am sampling from a texture and if the color is somehow gray [vec3(.8), vec3(.9)] and an uniform is 1 I need to substitute that color with another one

I am not a glsl veteran but I am pretty sure there is a more elegant and compact (without mentioning faster) way than this:

vec3 textureColor = texture(texture0, oUV);

if(settings.w == 1 && textureColor.r > .8 && textureColor.r < .9
                    && textureColor.g > .8 && textureColor.g < .9
                    && textureColor.b > .8 && textureColor.b < .9)

sentences:
Adding false if statement to pixel shader produces a lag One of lines in pixel shader produces a lag (lower fps). I can't understand why.

if (TextureEnabled)
    color *= texDiffuse.Sample(texDiffuseSam, input.UV);

Interesting fact is: TextureEnabled is always false. I have already checked.

// they are null
Texture2D texDiffuse : register(t0);
sampler texDiffuseSam : register(s0);

Is it possible, or i have mistake in other place(?), or is it HLSL so slow?

sentences:
Modeling complex requirements for populating loot/drop tables I have a set of items and a data structure that describes where and how those items may be dropped.  I'm looking to implement a roguelike/randomizer element to the game and want to include the special items that control progression.*  Ensuring the game remains completable is an absolute requirement but I'm having trouble handling all the different constraints that mixing up the progression item locations brings.
I'm looking for a way to model the requirements that isn't just hard-wiring them into the randomizer logic and hoping I got it right.  Preferably some kind of DSL that is processed and kicks out a partial drop table that at least guarantees completion is possible that I can slot less important items into afterwards.  Does this kind of modeling tool exist?
*: for reference the game is a Metroidvania-style platformer, so progression items are things that unlock traversal abilities like a double-jump, swimming, immunity to lava, etc.  They are not necessarily acquired in order though many are locked behind others in the vanilla game.

Detailed explanation of specific problem:
Let A,B,C,... be special progression items.
Each location in the drop table has a boolean constraint describing what items are necessary to access that location.  For example A | (B & C) would imply two possible paths: get A, or get B and C.
Early-stage locations are easy to model because they generally have no or very short constraints.  Later-stage locations become very complex as the boolean expression must expand to cover every possible progression path and very quickly become something like (A | B | C) | (D & (E ^ F)) | ... with another 4-5 terms following after.  Getting these constraints wrong means it's possible to generate an impossible-to-complete game.
Trying to handle the constraints in code quickly become intractable and very difficult to debug. Thus the search for a better way to model the constraints.
In the end it's a kind of recursive boolean satisfiability problem.  In theory I could build a giant expression for the entire game complete-able state and repeatedly run it through a SAT solver until completion is achieved or it stalls.  Food for thought in case anyone else has this same problem.

sentences:
How can I test different TV display types for my XBLIG game? The XBLIG submission check-list asks to ensure all gameplay-critical graphics be visible in the 'TitleSafeArea'.

I've received a bug report during play-testing that says parts of my scrolling 2D map are only half-visible (chopped off from the left of the screen).

I've tested the game on a 47" TV and a 19" VGA monitor and both look fine. However, the bug report says the issue occurs on a standard 20" TV.

How can I test different sizes without buying differently sized TVs?

sentences:
There is no valid constructor to convert from (const float*) to DirectX::XMFLOAT4 I'm following the "3D game programming with DirectX 11" book (Frank Luna) and i'm having this issue.
There is no valid constructor to convert from (const float*) to DirectX::XMFLOAT4

namespace Colors {

    XMGLOBALCONST XMVECTORF32 White = { 1.0f, 1.0f, 1.0f, 1.0f };
    XMGLOBALCONST XMVECTORF32 Black = { 0.0f, 0.0f, 0.0f, 1.0f };
    XMGLOBALCONST XMVECTORF32 Red = { 1.0f, 0.0f, 0.0f, 1.0f };
    XMGLOBALCONST XMVECTORF32 Green = { 0.0f, 1.0f, 0.0f, 1.0f };
    XMGLOBALCONST XMVECTORF32 Blue = { 0.0f, 0.0f, 1.0f, 1.0f };
    XMGLOBALCONST XMVECTORF32 Yellow = { 1.0f, 1.0f, 0.0f, 1.0f };
    XMGLOBALCONST XMVECTORF32 Cyan = { 0.0f, 1.0f, 1.0f, 1.0f };
    XMGLOBALCONST XMVECTORF32 Magenta = { 1.0f, 0.0f, 1.0f, 1.0f };

    XMGLOBALCONST XMVECTORF32 Silver = { 0.75f, 0.75f, 0.75f, 1.0f };
    XMGLOBALCONST XMVECTORF32 LightSteelBlue = { 0.69f, 0.77f, 0.87f, 1.0f };
}

The error is here

Vertex vertices[] = {
    { XMFLOAT3(-1.0f, -1.0f, -1.0f), (const float*)&Colors::White },
    {XMFLOAT3(-1.0f, +1.0f, -1.0f), (const float*)&Colors::Black },
    {XMFLOAT3(+1.0f, +1.0f, -1.0f), (const float*)&Colors::Red },
    {XMFLOAT3(+1.0f, -1.0f, -1.0f), (const float*)&Colors::Green},
    {XMFLOAT3(-1.0f, -1.0f, +1.0f), (const float*)&Colors::Blue},
    {XMFLOAT3 (-1.0f, +1.0f, +1.0f), (const float*)&Colors::Yellow},
    {XMFLOAT3 (+1.0f, +1.0f, +1.0f), (const float*)&Colors::Cyan},
    {XMFLOAT3 (+1.0f, -1.0f, +1.0f), (const float*)&Colors::Magenta}
};

and this is the struct Vertex

struct Vertex {
        XMFLOAT3 Pos; XMFLOAT4 Color;
    };

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:
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:
In Ren'py, can I make a text tag that opens a displayable? I'm developing a visual novel in Ren'py that would benefit from an interactive glossary. Ideally, I'd like words in the text box that are included in the glossary to be highlighted, and if the user clicks on one, the glossary would open at the corresponding entry.
I see that a URL text tag is available, so I'm wondering if it would be possible to do something similar to HTML, where an <a> tag can call a Javascript function rather than an actual URL.
Failing that, I know it is possible to make custom tags, but I have not been able to find a way to use these to create an action rather than a new style.
Any advice would be most appreciated, even if it's just to say impossible, so that I can let it go and consider other options.

sentences:
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: Can I put real monuments like white house, statue of liberty in my open world game? I'm currently working on open world game. But I am confused about one thing that, is it ok if I put real monuments and sculptures like white house, statue of liberty etc. in my game? Please help if anyone knows and confident about his/her answer. Thanks in advance!

sentences:
How can I read values from a running instance of an existing game? I play an indie flight simulation game in Windows. I want to add a specific feature by means of creating a third-party add-on.

This apps will "link" and gather current altitude and position data from the game. My program will play sounds during certain altitude and airplane configurations (it's called GPWS).

I have seen the same thing done in an online RPG game where an external program counts damage dealt in the game (which requires peeking at the game's variables), so I think this is very possible.

My question is:

What is this data-gathering called? I googled many terms like hijacking or linking but the result is not what I meant.
How do i create program like this? I don't mind if its in other languages like Java or Visual Basic, but my main experience is in C++.

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 do I set up a dedicated server for my multiplayer Unity game? I've made a multiplayer game with Unity and Mirror networking, and it all works perfectly when just running it on my own computer. However, I am trying to host on a dedicated server so that I can put the project on my portfolio and not have to worry about whether players can log in and test/play the game or not.
I tried a AWS Free server and I see that the Tanks example from Mirror is working just fine (although laggy), but my own project doesn't. I think this has something to do with the RAM limit of the free server but I'm not sure. I can see the task manager going up to 95% memory usage. When I remove some particle effects and geometry and enemies, it works.
I'm not sure if this is my code that is so cloggy or the server or both. In any case I would need a solution for this but I don't know what my options are.
Would be great if anyone can point me in the right direction. Thanks!

sentences:
Advertising before seeking a publisher I'm nearing competition of my first title and I'd like to seek out publishers but I'm also eager to show it off on social media.

Should I hold off until I've spoken to publishers or is it mostly harmless?

sentences:
How to use a buffer in GLSL to do a LUT-lookup? I am currently on a medical application which needs different kinds (up to totally individual) lookup tables (LUT) for image display. And this done with 10bit finish. So it is most of the time required to use 16-bit gray scale pixels.

I chose to use modern OpenGL and thus I'll want the lookup to happen in a GLSL shader program.

I had a try in uploading a 1D-Tedture (R16) using sampler1D to do the lookup as such:

        uniform sampler2D tex;
        uniform sampler1D lutData;
        in vec2 fragTexCoord;
        out vec4 finalColor;
        void main()
        {
            float primaryLvl = texture(tex, fragTexCoord);
            // index image 'color' in Lut-Texture
            float red = texture(lutData, primaryLvl);
            finalColor = vec4(red, red, red, 1.0);
        }

It works about as expected - however Textures (also 1D aparently) are limited to 8192 in size (on my machine). So the requirement for full range 16-bit images is not met.

For this above test I upload my images as R16 (for me it is gray) - normalized float 0-1.0.

Would it be feasible to upload a buffer (arbitrary data) and do the lookup there?
How would I do this (Syntax)?

And will my current pixel format interfere with my idea so I have to upload it as R16_INT instead. Or can (and should) I convert it in the shader from Normalized to Int (how is this done)?

Thanks

sentences:
Unity how to change material properties at runtime I'm working on a unity game where I want to change the color of a material from within a script. The material applies to a line renderer.

I currently have the following script:

using UnityEngine;
using System.Collections;

public class LaserProperties : MonoBehaviour {
    public Vector3 RGBStrengths;
    public LineRenderer lineRenderer;

    /*
     * returns the color in RGB.
     */
    Color getColor(){
        Color c = new Color (0, 0, 0, 1);
        float highest = Mathf.Max (RGBStrengths.x, RGBStrengths.y, RGBStrengths.z);
        c.r = RGBStrengths.x / highest;
        c.g = RGBStrengths.y / highest;
        c.b = RGBStrengths.z / highest;
        return c;
    }
    /*
     * returns the total amount of energy in the beam
     */
    float getStrength(){
        return RGBStrengths.magnitude;
    }
    void Update(){
        updateBeam ();
        Debug.Log (getColor());
    }
    /*
     * set color of the beam to the color of the laser
     */
    public void updateBeam(){
        lineRenderer.SetWidth (getStrength (), getStrength());
        lineRenderer.material.color = getColor ();
        lineRenderer.material.SetColor ("_Albedo", getColor ());
        lineRenderer.material.SetColor ("_Emission", getColor ());

    }
}

And here is the material .

However changing the properties does not result in any chance to the material in question.

Any idea what I'm doing wrong?

sentences:
Reseting a multiplayer scene in UNET, without losing connections I have a game with only one scene, which has the basic Network Manager HUD.

After I click "Host", and a few players join one by one, I want to restart the scene, so the early joiners won't have advantage.

Specifically: I want to reset the scene so it's in the "server was just started* " state, every player is connected and their gameobjects have just spawned on the spawn location.

I tried this line, but it fully restarts the scene, and even worse, now the HUD won't even pop up:

NetworkManager.singleton.ServerChangeScene(SceneManager.GetActiveScene().name);

Is there a simpler way than manually resetting everything to a hardcoded initial state?

(*the state in which the scene is after I click "Host")

sentences:
Custom mesh format - yea or nay? In the process of writing my game prototype, I have found the OBJ format to be insufficient for my needs - it does not support any sort of animation, it doesn't support triangle strips (I'm targeting my ancient hardware). MD2 wouldn't fit the bill because it doesn't have support for named model pieces. MD3 would probably work, but like OBJ, it doesn't have support for triangle strips. Considering the limitations of the formats above, I've come to the conclusion that it may be necessary to write my own format to accommodate my requirements, but that feels like reinventing the wheel.

So, I need a format which can specify indexed tri-strips, supports textures, UV-mapping, collision data, can have multiple named segments and supports animations (have I forgotten anything?). Is there any format like that which already exists, or do I have to write my own?

sentences:
How good do I have to be at Math to create a 3D game using three.js? A question I've often had, how good at Math do I need to be to create 3 dimensional games? I get along with 2d games just fine. I understand everything I'm doing without problems after practise. However, jumping into 3d does seem a little scary and I'm worried my "bad at maths brain" will take it. I love creating games, I really don't want this to hold me back.

Is it possible to learn as I go along or do I need to have some natural math talent to be able to create 3d games? Also... if anyone can find a good place to start for a guy like me I'd really appreciate that too.

Thanks

sentences:
How can I get a cone shape of arbitrary size in an hex board? I'm implementing engine tools for my hex board game and this one is becoming messy. I want to get a list of all the positions that a cone of size N would have, given "caster" origin X,Y and origin in X0, Y0 taking direction into account. So far I have been able to get a size one cone using a "simple pattern" approach, but it doesn't translate well for N-sized cones.

This is the original cone

and the code

public PositionArray getArcAdjacents(int originx, int originy, int targetx, int targety,
        int range) {
    final FloatPair direction = this.getDirectionVector(originx, originy, targetx, targety);
    final PositionArray highlights = new PositionArray(gameMap);
    highlights.add(new Pair(targetx, targety));
    int offset = 0;
    if ((targetx % 2) == 0) {
        offset = 1;
    }
    if (direction.x > 0) {
        if (direction.y >= 0) {
            highlights.add(new Pair(targetx - 1, (targety + 1) - offset));
            highlights.add(new Pair(targetx, targety - 1));
        } else {
            highlights.add(new Pair(targetx, targety + 1));
            highlights.add(new Pair(targetx - 1, targety - offset));
        }
    } else if (direction.x < 0) {
        if (direction.y >= 0) {
            highlights.add(new Pair(targetx + 1, (targety + 1) - offset));
            highlights.add(new Pair(targetx, targety - 1));
        } else {
            highlights.add(new Pair(targetx + 1, targety - offset));
            highlights.add(new Pair(targetx, targety + 1));
        }
    } else {
        if (direction.y > 0) {
            highlights.add(new Pair(targetx + 1, targety - offset));
            highlights.add(new Pair(targetx - 1, targety - offset));
        } else if (direction.y < 0) {
            highlights.add(new Pair(targetx + 1, (targety + 1) - offset));
            highlights.add(new Pair(targetx - 1, (targety + 1) - offset));
        }
    }
    return highlights;
}

sentences:
libgdx game process dies on loading texture atlases I try to load a lot of texture atlases (10) with approximately 5 (~2048x~2048)(not using PoT) .pngs each. I'm using AssetManager and there is no trouble with it on my pc but when I try it on my tablet the app just dies without any error messages or crash reports and there aren't any outOfMemoryExceptions.

Here's my log:

DropBox link

the max memory: 67 is

Runtime().getRuntime().maxMemory() / 1000000

I'm running out of ideas of what to do. Maybe I don't fully understand the way mobile games work: is that a lot of atlases (I have other textures not atlases apart from these atlases)? because everything looks quite fine in the memory segment as much as I know. Anyway I'm open to suggestions and maybe some tips. And I'd really like to keep these atlases in my game.

EDIT: the game loads on my tablet but not phone when I use 1 png per atlas (8192x8192) but my tablet doesn't show images larger than 2048x2048 for some reason oh and the images in the atlas aren't even 1024x1024 so idk why it doesn't show them must be because the atlas is 8192x8192.

EDIT #2: I load only atlases now, no separate .png files and I am now using PoT (2048x2048). 17 atlases some have 2 pngs some even have 1 png but there are some that have 5+ and that's my level plus player animations plus I'm using a gradient for my whole level that is ~10000px in width combined and I use FBO to do a Lighten shader on the level and my level has animations. Is that too much? Anyway this time the game died @ 94% on my phone(Galaxy S2) and @ 58% on my tablet(Lenovo IdeaTab A2109) and here's my new log but this time from my phone:

DropBox link log_new

I'm confused because there aren't any outOfMemory exceptions and I'm disposing every possible thing there is to dispose. btw my app in the logs is com.comraz.slashem
Is theree something I can do? f.e. downscale textures or use mipmaps or something? my level textures are 1024x768 when zoomed in and 1024x1536 when zoomed out. If you have any ideas or any questions please do ask or tell me. Oh and my camera size is 1280x768

sentences:
How to make an object in box2d have constant velocity even after collision? I have iOS game where I have a bouncing character. Everything is being handled by box2d. The problem is when the character hits a wall of another character it's velocity changes, but I don't want this. I need the velocity to stay constant even after collisions.

I was thinking the only way to do this was to keep setting the velocity after each collision unless there's another way to do this that I'm not aware of?

sentences:
I need a map generation algorithm for towerdefense I'm making a simple JavaScript tower defense game, I've experimented on some map generation my self, i seem to get one that works properly.

What I want is for you to provide a start point (possibly an end point) and an algorithm to generate a random path between them in a tower defense like style.

Examples

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:
Set / Get UserPointer - What Do They Do? I see a lot of talk about glfwGetWindowUserPointer() and glfwSetWindowUserPointer() but I can't for the life of me understand what these functions actually do.

From http://discourse.glfw.org/t/what-is-a-possible-use-of-glfwgetwindowuserpointer/1294:

  "If you are trying to use glfw in a program that follows object-oriented design, for example, you can use this pointer to store the address of the instance that is handling a particular window, and forward the callbacks (which have to be static functions, because of the way the API works) to the appropriate member functions."

The author of that comment then posts the following example:

/* Constructor for the MyWindowHandler class */

MyWindowHandler (GLFWwindow * window)
{
....
    glfwSetWindowUserPointer(window, reinterpret_cast<void *>(this));
}

/* Key event callback wrapper function */

static void key_callback (GLFWwindow * window, int key, int scancode, int
                                                        action, int mods)
{
    MyWindowHandler * handler =
    reinterpret_cast<MyWindowHandler *>(glfwGetWindowUserPointer(window));

    if (handler)
        handler->keyEvent(key, scancode, action, mods);
}

What confuses me is that (at least as far as I can tell) I was able to achieve the exact same outcome in my program without using glfwSetWindowUserPointer() or glfwGetWindowUserPointer() at all.

/* Class constructor (just provided for reference) */

GLFW::GLFW(int right, int top)
    : m_Window(0)
{
    if (!glfwInit())
    {
        std::cout << "GLFW initialisation failed!\n";
        __debugbreak();
    }

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    m_Window = glfwCreateWindow(right, top, "OpenGL Window", NULL, NULL);

    if (!m_Window)
    {
        glfwTerminate();
        std::cout << "Could not create window!\n";
        __debugbreak();
    }

    glfwMakeContextCurrent(m_Window);
    glfwSwapInterval(2);

    if (glewInit() != GLEW_OK)
    {
        std::cout << "GLEW initialisation failed!\n";
        __debugbreak();
    }

    std::cout << glGetString(GL_VERSION) << std::endl;
}

/* My callback member function */

void GLFW::MouseMovement(int x, int y)
{
    std::cout << "Mouse moved\n";
    // do other stuff...
}

/* Main.cpp */

static void MouseMovementCallback(GLFWwindow* window, double x, double y)
{
    GLFW* glfw = nullptr;
    glfw->MouseMovement(x , y);
}

int main()
{
    GLFW glfw(1200, 600);
    glfwSetCursorPosCallback(glfw.GetWindowID(), MouseMovementCallback);

    // ......
    // ......
}

In the above code my 'MouseMovement' callback function was called... so I'm rather stumped as to what the purpose of the glfwGetWindowUserPointer() and glfwSetWindowUserPointer() functions actually is.

I'm sure there is something rather obvious that I am missing here, hopefully someone can enlighten me.

Thanks in advance.

sentences:
OpenGL position from depth is wrong My engine is currently implemented using a deferred rendering technique, and today I decided to change it up a bit.
First I was storing 5 textures as so:
DEPTH24_STENCIL8  - Depth and stencil
RGBA32F           - Position
RGBA10_A2         - Normals
RGBA8 x 2         - Specular & Diffuse
I decided to minimize it and reconstruct positions from the depth buffer. Trying to figure out what is wrong with my method currently has not been fun :/
Currently I get this:

which changes whenever I move the camera... weird

Vertex shader
really simple
#version 150

layout(location = 0) in vec3 position;
layout(location = 1) in vec2 uv;

out vec2 uv_f;

void main(){
    uv_f = uv;
    gl_Position = vec4(position, 1.0);
}

Fragment shader
Where the fun (and not so fun) stuff happens
#version 150

uniform sampler2D depth_tex;
uniform sampler2D normal_tex;
uniform sampler2D diffuse_tex;
uniform sampler2D specular_tex;

uniform mat4 inv_proj_mat;
uniform vec2 nearz_farz;

in vec2 uv_f;

... other uniforms and such ...

layout(location = 3) out vec4 PostProcess;

vec3 reconstruct_pos(){
    float z = texture(depth_tex, uv_f).x;
    vec4 sPos = vec4(uv_f * 2.0 - 1.0, z, 1.0);
    sPos = inv_proj_mat * sPos;

    return (sPos.xyz / sPos.w);
}

void main(){
    vec3 pos = reconstruct_pos();
    vec3 normal = texture(normal_tex, uv_f).rgb;
    vec3 diffuse = texture(diffuse_tex, uv_f).rgb;
    vec4 specular = texture(specular_tex, uv_f);

    ... do lighting ...

    PostProcess = vec4(pos, 1.0); // Just for testing
}

Rendering code
probably nothing wrong here, seeing as though it always worked before
this->gbuffer->bind();
gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);

gl::Enable(gl::DEPTH_TEST);
gl::Enable(gl::CULL_FACE);

... bind geometry shader and draw models and shiz ...

gl::Disable(gl::DEPTH_TEST);
gl::Disable(gl::CULL_FACE);
gl::Enable(gl::BLEND);

... bind textures and lighting shaders shown above then draw each light ...

gl::BindFramebuffer(gl::FRAMEBUFFER, 0);
gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT);

gl::Disable(gl::BLEND);

... bind screen shaders and draw quad with PostProcess texture ...

Rinse_and_repeat(); // not actually a function ;)

Why are my positions being output like they are?

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:
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:
Libgdx storing rendered frames quickly to use them later I have implemented a gif-button for my libgdx game that allows the player to store the last few seconds of gameplay as a gif.

It works by storing frames in memory, and encoding them into a gif if the player presses a Button.

The problem is, that my method of storing the frames takes around 20ms, far to slow for my 60fps game. This leads to stuttering.

Currently im storing the frames like this:

private static LinkedList<Pixmap> frames = new LinkedList<>();

private static float delay = 0;
static Pixmap pixmap;
static int width = Gdx.graphics.getWidth();
static int height = Gdx.graphics.getHeight();

// called every frame
public static void act(float delta) {
    delay -= delta;
    if (delay <= 0f) {
        // the actual storing of the frame. ~20ms
        Gdx.gl.glPixelStorei(GL20.GL_PACK_ALIGNMENT, 1);
        pixmap = new Pixmap(width, height, Pixmap.Format.RGBA8888);
        Gdx.gl.glReadPixels(0, 0, width, height, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixmap.getPixels());
        frames.add(pixmap);

        // remove old frames and reset delay
    }
}

I have tried to allocate as little memory as possible but its still way to slow.

Concurrency is not an option for this approach since the gl methods need to be called on the rendering thread.

I would be very thankful for a solution or ideas for other possible ways to achieve my goal.

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:
Representing Wind in a Block-Based Game I'm creating a game inside of a game called "ROBLOX".  The game gives you some scripting tools to allow me to basically create anything I want.  The world is created up by decently large blocks.  There are few exceptions to this (such as ramps, spheres, tubes, etc.)

I want to create a subtle hint of wind.  It will be affecting the game play a little bit and I want the wind to be predictable.  I first thought of creating a flag, but, a flag isn't very well made in such a game as ROBLOX.

So my question is, what different kinds of way can I imply that there is wind?  What other methods will provide me with a natural representation of wind (I don’t want to put a meter or something, I want them to have to find it/figure it out for themselves).

sentences:
What is the alternative to Time.time for scrolling texture? In my game, I'm using the standard SetTextureOffset method to smoothly scroll texture on background quad.

However, on game over, instead of reloading the scene, I'm just reseting all values initial position to give illusion that scene was reloaded. With this approash, i'm unable to use Time.time or Time.timeSinceLevelLoad because, the level was not reloaded and this value stays high. So scrolling is too fast right in the beginning.

Are there any time independent methods to smoothly scroll texture? Thanks.

sentences:
How do I move my infinite runner player when the game zone shares the screen with a match 3 game? So I am seeking to make a Match 3 with an infinite runner element. The match 3 portions are all already totally done, but I'm running into trouble figuring out how to best approach the Runner portion.

I'm not entirely new to Unity, but I'm newer, though I'm not new to programming.
This is what the game generally looks like:

(Source)

My problem is I am unsure the best way to do the movement. My immediate thought was, I should have the player run in place, and the world move around him, so that the camera and the match 3 portion don't have to have any movement.

Is there another option that is simple that I'm over looking? Following the player as he moved seems like it would be really weird for the match 3 dots, as the camera is flying off into the X along with the player, and keeping the dots up with them sounds like it would be more trouble than its worth.

Any help is appreciated, thanks!

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:
Unity RigidBody2d.MovePosition() not working on dynamic rigid body As it says, .MovePosition() won't move my character. I know other ways to move but I want .MovePosition() in particular as I think it will solve the camera's jittery movement when the player pushes through a collision.

This script works on a kinematic rigidbody but not on a dynamic one.

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

public class PlayerMovement : MonoBehaviour {

    Rigidbody2D rbody;
    Animator anim;
    public float speed = 0;
    SpriteRenderer sr;

    void Start () {
        rbody = GetComponent<Rigidbody2D> ();
        anim = GetComponent<Animator> ();
        sr = GetComponent<SpriteRenderer>();
    }

    void Update(){
        sr.sortingOrder = ((int)Camera.main.WorldToScreenPoint (sr.bounds.min).y) * -1;
        Vector2 movementVector = new Vector2 (Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
        if (movementVector != Vector2.zero) {
            anim.SetBool ("isWalking", true);
            anim.SetFloat ("inputX", movementVector.x);
            anim.SetFloat ("inputY", movementVector.y);
        } else {
            anim.SetBool ("isWalking", false);
        }
        Vector2 newPos = rbody.position + movementVector *Time.fixedDeltaTime;
        rbody.MovePosition(newPos);
        //rbody.position = Vector2.MoveTowards(rbody.position, newPos, Time.deltaTime*speed);
    }
}

FYI I'm on Unity 5.6 if that helps.

sentences:
Cross-platform, free (for commercial use) C/C++ 2d game library or rendering engine? I need a C/C++ engine that should be really cross platform (or at least windows, android, and iphone).

The 2d engine should be written in C or (better) C++, should permit the rendering of animated sprites, permit transparency, collisions (but I can integrate box2d for that), rotations (eventually with opengl support to accelerate things), handle tile-based games. If it could be a game engine (with support for events/actions, scripting and generally have the features needed when developing a 2D game) it would be fantastic.

There are a lot of open source free 2d engine out there, but soon or later you find that:

the documentation is not so good and/or the tutorials are not so good (or there are no tutorial at all), the examples are missing (or are too few or are missing)
the community is too small and not so supportive
the engine doesn't abstract system things enough. That is bad, because you
soon find out that there is support for X and Y but not Z. With abstraction, you can use even Z adding system specific code
the engine is a game engine but does not have an associated editor. scripting is good, but an editor would save a lot of time I think
the engine writers have spent too much time to develop a complex (that will probably fails) compilation tools.

It would be useful to have something that:

#define WIN_PLATFORM
#define IOS_PLATFORM
#define ANDROID_PLATFORM
#define UNKNOWN_PLATFORM

In that way, using an empty implementation of the relevant interfaces, you
can simply code what you need

6 . You come to the conclusion that usually there is not a sufficient conceptual separation from what really needs to be abstracted and what can be supposed to be found on almost all systems (e.g. opengl).

Ok. The question is, regarding a free, open source 2D rendering engine or a 2D rendering engine+2D game engine for at least iOS and Android: in your experience, what would be a good/wise choice?

sentences:
Need to combine a color, mask, and sprite layer in a shader My task: to display a sprite using different team colors. I have a sprte graphic, part of which has to be displayed as a team color. The color isn't 'flat', i.e. it shades from brighter to darker. I can't "pre-build" the graphics because there are just too many, so I have to generate them at runtime. I've decided to use a shader, and supply it with a texture consisting of the team color, a texture consisting of a mask (black=no color, white=full color, gray=progressively dimmed color), and the sprite grapic, with the areas where the team color shows being transparent.

So here's my shader code:

// Effect attempts to merge a color layer, a mask layer, and a sprite layer
// to produce a complete sprite

sampler UnitSampler : register(s0); // the unit
sampler MaskSampler : register(s1); // the mask
sampler ColorSampler : register(s2);    // the color

float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 tex1 = tex2D(ColorSampler, texCoord);    // get the color
    float4 tex2 = tex2D(MaskSampler, texCoord); // get the mask
    float4 tex3 = tex2D(UnitSampler,texCoord);  // get the unit
    float4 tex4 = tex1 * tex2.r * tex3; // color * mask * unit

    return tex4;
}

My problem is the calculations involving tex1 through tex4. I don't really understand how the manipulations work, so I'm just thrashing around, producing lots of different incorrect effects. So given tex1 through tex3, what calcs do I do in order to take the color (tex1), mask it (tex2), and apply the result to the unit if it's not zero?

And would I be better off to make the mask just on/off (white/black) and put the color shading in the unit graphic?

sentences:
Exclude removed objects from list counting? I want to count the number of objects on my list. But because I remove and add, my script keep count those empty elements.
update: This happen when I destroy the object when it inside the collider. This object does not get out from "OnTriggerExit2D".
public List<GameObject> Sorts;
public List<GameObject> ItemsInside;
public int NumSorts, NumItems;

// Update is called once per frame
void Update()
{
    NumSorts = Sorts.Count;
    NumItems = ItemsInside.Count; // it doesn't give correct number

}

void OnTriggerEnter2D(Collider2D other)
{
    if (other.CompareTag("Sort"))
    {
        Sorts.Add(other.transform.gameObject);

    }
    if (other.transform.name == ("GameItem"))
    {
        ItemsInside.Add(other.transform.gameObject);

    }
}

void OnTriggerExit2D(Collider2D otherOut)
{

    if (otherOut.CompareTag("Sort"))
    {
        Sorts.Remove(otherOut.transform.gameObject);
    }
    if (otherOut.transform.name == ("GameItem"))
    {
        ItemsInside.Remove(otherOut.transform.gameObject);
    }

}

sentences: How to create transfer function for temperature in 2D space I am looking for ways that can transfer temperature from tiles to tiles in space such as in Rim World, when you click on a tile, it will display the temperature on that particular tile and you can regulate the temperature in a confine space by installing air conditioner. Wonder is there any method in unity that can perform such function? Would like to learn it by myself. I am new to programming so not even sure where should I start my search.

sentences:
Play game by coding your strategy I am building a simple strategy game, the goal of the game to teach programming basics to kids.

The concept of the game is simple, there will be a set of colony individuals - different type (resource gathering, fight, defend, scout ..etc).

I want to build a Campaign mode for this game, simple set of scenarios and missions as beta version.

As I said, the purpose is to teach programming basics, so player need to code there strategy to play the game, means that each colony individual's behavior will be programmed separately.

I am thinking of creating a basic syntax for code conditions, commands and actions (custom language), player will simply code individual's behavior by simply grouping these conditions, commands and actions in logical order. An example:

if FindEnemy
    if stamina > 0.6
       dobattle;
    else
       returnToNest;
    endif;
endif;

My question is that I am building the game using HTML5/CSS3/JS, and wondering I can implement it a client-side library to parse custom language and convert it to animation? or whether there is already built JS library or engine that can do similar requirement?

sentences:
Fullscreen triangle SV_POSITION and deferred shading So I'm trying deferred shading in DirectX11.

I am using the following method (used in the FXAA shader and described here: http://www.altdev.co/2011/08/08/interesting-vertex-shader-trick/) to render a fullscreen triangle for my deferred shading pass.

FullscreenTriangleVSOut main(uint VertexID: SV_VertexID)
{
    FullscreenTriangleVSOut output;

    output.mTexcoord = float2((VertexID << 1) & 2, VertexID & 2);
    output.mPosition = float4(output.mTexcoord * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);

    return output;
}

And then in the pixel shader, I want a proper texture coordinate to sample my diffuse, normal, position textures from the GBuffer.

In GLSL, I simply do:

ivec2 texcoord = ivec2(textureSize(unifDiffuseTexture) * (gl_FragCoord.xy / UnifAmbientPass.mScreenSize));

But for some reason, in HLSL my SV_POSITION is always (0.5, 0.5). I looked in visual studio 2013 and debugged the pixel shader at various pixels, and yes at all places the SV_POSITION is (0.5, 0.5). Why is this?

sentences:
The General Idea Behind Google Game Services Turn-Based Matchmaking I am just starting to develop a Turn-Based game with the Google Play Game Services, and I am utterly confused about the steps to initiate the match.

My game has a maximum of 2 players at once, and I am using the default UI for match-making.

How can I actually wait for the another player to join? My game currently "starts", even with only the local player.. meaning: Why is the "match initiated callback" invoked, even if no another player has even joined the game? What event is invoked when another player joins the game, so I can possibly display a "waiting for another player" UI? Should I have a need for such an UI? I have this nagging feeling that I am misunderstanding something essential here.

sentences:
Libgdx RotateToAction does not directly rotate between 179 and -179 It took me a bit of debugging to realize why I'm having trouble with my rotations and it seems that rather than just moving the 2 degrees between 179 and -179, it prefers to rotate all the way in the other direction, the full 358 degrees.

Is there any way to make it go the short way in this case?

Code I have so far:

public void rotateTo(float targetRotation)
    {
        RotateToAction rotateToAction = new RotateToAction();
        rotateToAction.setRotation(targetRotation);
        rotateToAction.setDuration(2f);
        if(Math.abs(this.getRotation()-targetRotation) > 180)
        {
        /*failed attempt to force rotation*/
            SequenceAction sequenceAction = new SequenceAction();
            RotateToAction rotateToAction2 = new RotateToAction();
            rotateToAction2.setRotation(180);
            rotateToAction2.setDuration(1f);
            sequenceAction.addAction(rotateToAction2);
             sequenceAction.addAction(rotateToAction);
            this.addAction(sequenceAction);
        }
        else
        {
            this.addAction(rotateToAction);
        }
}

sentences:
How can I load a file in memory on the Apple IIGS? I recently got an Apple IIGS and have it booting GS/OS off of a compact flash with 10 32MB ProDOS volumes. It's a great little setup and I've installed ORCA/M, 816 Paint, Merlin 16+ and Complete Pascal (also known as TML Pascal II) so I can get started programming games for it.

My first goal, for now, is to just display an image on the screen that I've saved from 816 Paint. But I don't even know how to load a file as binary into memory. How can I accomplish that using Pascal and the other tools I've listed above?

sentences: Is there a known most efficient version of A* search algorithm? Is there a known 'most efficient' version of the A* search algorithm? I know some people write papers on the most efficient way to compute common operations, has this been done for A*?

sentences:
Detect when any part of a collider leaves a trigger zone on Unity 3D I've searched all over for a simple solution on this, and found posts as old as 2011, with a bunch of hackish ways to badly work this out.

I want to detect when ANY part of a collider leaves a trigger area.

Some solutions I found and why they won't work on my case:

Using onTriggerExit will only trigger when the collider is COMPLETELY out of the trigger area, making it not ideal for boundaries of maps.

Calculating using bounds may work, but a bit complex when using a polygon collider with convex shapes.

I'm new to Unity and I'd guess this would be a pretty simple, default behaviour for many games.. Really surprised me that I found zero good answers for this on the web (both in stack exchange and Unity forums). Any help would be appreciated.

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:
Implementing fog of war on HTML5 canvas I have been wrestling with creating fog of war for a while now. I actually did create it, but I consider the implementation too resource-heavy to be usefull.

For initial information: I use createjs / easeljs framework / library for the project and the fog of war is now implemented so, that there is a layer with the "fogged" image and data of the map on bottom and on top of that is the non-fogged / clear layer of the map. In the clear layer I only show certain parts by filtering the layer with shapes and the rest is invisible. So only the areas that are visible are shown.

Also note that even the fogged parts are partially visible, e.g. the whole terrain of the map is always visible beneath the fog of war.

This creates 2 different layers with the same information of the map, instead of creating a separate fog of war layer, that would only contain the fog and be filtered to show the non-fogged parts.

I have been unable to make this work so far.

So basically I can now use filters to show certain parts of a layer, but not to make parts of it have an alpha value. E.g. If I have a fog-layer (that contains the fog) and want to show it except certain circular parts (which would reveal the map below, with alpha = 0), how is that achieved? Now I can only show certain parts of a layer with filtering, instead of hiding them / making the have alpha or reverse the filtering.

sentences:
Unreal Engine: Third person example project and multiplayer I was fiddling around with multiplayer stuff in Unreal Engine. I looked into events that run only on server, multicasting events, replication of variables...

But there is something that I dont quite understand: When I load the Third Person example proyect, and enable more than one player, I can see the position and movements of the players being replicated on all clients.

While I understand that the position and the rotation of the players being replicated successfully (since the replication option is enabled in the pawn's blueprint option), I don't really understand why the animations are being replicated. I don't see any reference in the blueprint making animations replicated over the network.

Are pawn animations implicitly replicated on clients when replicating the actor's position? Am I missing some option/configuration I'm missing?

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:
JS Canvas - Creating 2D Game lighting effect like Terraria I just started working with canvas in HTML5 and with javascript. I'm pretty satisfied with my game so far: http://xenopal.dk/game-v1.1/. But I'd like to implement lighting as well in the style of Terraria or Minecraft
http://www.nerd-age.com/wp-content/uploads/2011/09/Terraria-New-Torches.png
where you can have multiple light sources, even with color, without it being like realistic shadows that gets casted by the light.

I've tried to do per-pixel lighting, but that didn't go so well since it made my whole game lag like crazy and unplayable. I might have done the per-pixel lighting wrong since I'm fairly new to creating games in canvas.

I hope that you're able to help me or maybe pass on some links to other places that might be able to help. Thank you :)

// Edit - Probably forgot to mention that it should of course be a 2D lighting. I've read somewhere that even with three.js and pixi.js I might be able to create this kind of lighting, but I have no idea on how to do it.

sentences:
Performance drawing in Pygame Relevant background information

I'm developing a game for a high school computer science performance task in python & pygame. I'm using objects and all the code is working well for me.

The game consists of a top down (bird's eye view) 2D shooter of a player that rotates and shoots at zombies that spawn and make their way to him. Kind of like dead ops arcade from the original black ops.

Though I'm developing the levels using a list string type designer (there's probably a name for the common technique I'm unaware of), than I load it and I have an array of rects. Here is some background code.

            x = 0 # Start X at 0
                    y = 0 # Start Y at 0
                    for row in levelData: # run a for loop for all the rows in level data
        for col in row: # run a for loop for all the colums in the row
            if col == "1": # check if the column section is labeled 1
                self.Rects.append(pygame.Rect((x, y),(self.tileWidth, self.tileHeight))) # append a rectangle
            if col == "2": # check if the column section is labeled 2
                self.Rects.append(pygame.Rect((x, y),(self.tileWidth, self.tileHeight))) # append a rectangle
            if col == "3": # check if the column section is labeled 3
                self.zombieSpawners.append(ZombieSpawner(x, y, self.zombieManager, int(self.maxZombies / self.levelDesigns.getSpawnerAmount(self.level)), self.zombieSpawnTimeMin, self.zombieSpawnTimeMax, self.zombieVelMin, self.zombieVelMax, self.zombieHealth)) # Initalize a zombie spawner with given data
            x += 64 # adjust x
        y += 64 # adjust y
        x = 0 # reset row
    self.levelLoaded = True

            def draw(self, canvas, playerRect):
    canvas.blit(self.backgroundImage, (0, 0)) # draw background image
    for rect in range(len(self.Rects)): # for loop to run all rects
        canvas.blit(self.blockImage, (self.Rects[rect].x, self.Rects[rect].y)) # draw a block
    for spawner in range(len(self.zombieSpawners)):
        canvas.blit(self.spawnerImage, (self.zombieSpawners[spawner].getX(), self.zombieSpawners[spawner].getY()))

The indenting is all screwed up but you should understand what I'm doing.

The problem

The code above works perfectly. The game ran really smooth with just the player and zombies. Though when I run the background image above, it becomes a huge performance decrease, the fps becomes a solid 3-5. Drawing the blocks and the spawners cause some performance issue's as well, not as bad as the background image but still unplayable.

I think the background image does so much performance damage because it's an actual picture and not a little cartoon like the blocks and spawer's.

What I'm trying to do

Is there anything I'm doing wrong or something I should do that can get my performance back? Like some sort of spritebatch for pygame or something. I can't figure out anything online other than pygame doesn't have that good of a performance.

sentences:
Getting Early User Feedback on Games Disclaimer: It may be that I'm already doing all the "right" things, but just don't have enough traffic for it to pay off with people giving feedback.

My question is: how do you attract early and quality feedback into games, from end-users? Ideally, I'm looking at a model where the seed of an idea comes from you (or from them, even) and you build it into a game, molding it along the lines that people tell you are best.

Because you're just one opinion. And game developers have a reputation for doing weird and sub-par quality stuff, sometimes.

I'm currently practicing the following:

VIP List: I have a "VIP" mailing list (mostly friends) who agreed to try out game releases and give me feedback. They seem hesitant to say anything negative, and most of them are not really gamers, just doing it because they know me and like my niche.
2-4 Week Releases: I use a form of agile and release iterations every two to four weeks. This means every release is functionally small, but somewhat polished.
Press-Releases: With every release, I also post a small "press release" post identifying the good, the bad, what's next, and screenshots (along with a link to play the latest release version).

I'm not getting that much feedback. What am I missing?

sentences:
Character movement relative to cursor position I want my top-down shooter character to move towards the mouse when pressing the up arrow and strafe relative at right angles to it when pressing the left and right arrow keys.

I can't figure out how to do this.

Here is my code (The character is character_mc):

import flash.events.MouseEvent;
//Event Listners
stage.addChild(crosshair_mc);
crosshair_mc.mouseEnabled = false;
crosshair_mc.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

function fl_CustomMouseCursor(event:Event)
{
    crosshair_mc.x = stage.mouseX;
    crosshair_mc.y = stage.mouseY;
}
Mouse.hide();

stage.addEventListener(MouseEvent.MOUSE_MOVE,facecursor);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler);
//Functions
function facecursor(event):void
{
    character_mc.rotation = (180 * Math.atan2(mouseY - character_mc.y,mouseX - character_mc.x))/Math.PI + 90;

}

function fl_KeyboardDownHandler(event:KeyboardEvent):void
{
    trace("Key Code Pressed: " + event.keyCode);
    if (event.keyCode == 38)
    {
        character_mc.y = character_mc.y - 5;
    }
    if (event.keyCode == 40)
    {
        character_mc.y = character_mc.y + 5;
    }
        if (event.keyCode == 39)
    {
        character_mc.x = character_mc.x + 5;
    }
        if (event.keyCode == 37)
    {
        character_mc.x = character_mc.x - 5;
    }

}

I'm new to actionscript, so example code would be helpful.

sentences:
Cycling UV-coordinates with instanced drawing c++/opengl/glsl I'm trying to animate 2d sprites using glDrawArraysInstanced(), and I'm having trouble separating for each "cycle" ran through the pipeline.

according to one of the tutorials I'm reading, it says:

"Send the age of each particle along with the position, and in the shaders, compute the UVs"

But without clarifying exactly how to do so. This is what my vert shader looks like atm:

#version 400 core
layout ( location = 0 ) in vec3 vertex_position; //vertices, 1 box
layout ( location = 1 ) in vec2 tex_cord; //1 tex cord
layout ( location = 2 ) in vec4 color_vec4; //1 vec4 color per texture
layout ( location = 3 ) in mat4 in_mat; //4 vec4 to make 1 mat4

//flat out int InstanceID; //use but how?

out vec2 UV;
out vec4 color4;

void main()
{
    gl_Position=in_mat*vec4(vertex_position,1.0);

    color4=color_vec4;
    UV=tex_cord;
}

And my frag shader:

#version 400 core
in vec2 UV;
in vec4 color4;

uniform sampler2D png_tex;  //texture atlas

void main()
{
    gl_FragColor=texture(png_tex,UV)*color4;
}

Does anyone know how to get the vec2-uv coordinate to change/cycle, when using instanced drawing?

Solution:

adding this to my vert shader:

UV=vec2
(
(tex_cord.x/info_vec4.z)+(1.0/info_vec4.z*info_vec4.x),
(tex_cord.y/info_vec4.w)+(1.0/info_vec4.w*info_vec4.y)
);

I know this can be done cleaner, but I'm not sure exactly how atm. This works however, and its alot faster than having to pass a new png/texture per update. The explanation for it is: info_vec4 is an ivec that I pass as an attribute with information of the current primitive/triangle. It holds: x=xcord (1-5), y=ycord (only 1), z=number of x frames total, and w=number of y total. The trick was figuring out how to iron out UV.x=0, basically by adding 1*somevalue to 0.

sentences:
What is the legality regarding allowing players to mod a game with real-life players in a sports game? Let's say I'm doing an Indie sports game, and ship it with fictional players, but make the game capable of reading a config file, so that players are able to edit in real names to suit themselves.
The game is a free multi-player, peer-to-peer (p2p) game, and so once the game is published, there is no central server authority which controls what the players are doing, thus allowing them to mod the game as they please.
What's the legal situation with something like that? The file is literally just a plain text file with some names in it. I would imagine that if I were to host that file, and have my game download and consume it on start up, that would be unacceptable, as it would be the same as shipping the game with real player names?
So that makes me wonder, would such a file be illegal for people to share? If I were to make such a file, and distribute it to the community via a forum, would that be illegal? What about if I didn't do that, but a customer did?

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 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:
Random numbers on C++ Recently I got used to modern languages which include a stock good random generator, which usually is the Mersenne Twister; now that I got back to C++ I have to decide what to use.

I searched for Mersenne Twister implementations and I noticed there are so many: is there one which is more used and widespread, or am I supposed to pick one assuming they are all equally good?

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:
Is the standard collision detection in Slick2D too heavy for broadphase? I was wondering two things about the built in shape detection of Slick2D. When executed on a lot of shapes, how performant are the intersects and containsmethods, and what kind of algorithm is behind those.

I have implemented SAT collision detection but I don't want to execute this detection on all my entities. So I thought I would use the built in methods to look for entries which are near my player, and for those do the SAT detection.

But if the built in methods are as good as or better than SAT, this wouldn't be good. Also if the built in methods need more time or are kind of heavy for the cpu.

What is the proper way to have my collision detection on the smallest amount of game objects. How would I filter only the near objects?

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:
Restrict the rotation of the camera using button I've been trying to limit the Y-axis of the camera rotation but I'm out of depth until now. I'd looked up many tutorials and I found the clamping method, but I seem can't get it to work on my code, and all the tutorials I found is using them in Update(), while I'm using a button to rotate the camera. Here's the code:

public void RotateLeft()
{
    cameraY = Mathf.Clamp(cameraY, minAngle, maxAngle);
    if(cameraY >= minAngle)
    {
        Camera.main.transform.Rotate(0,-cameraY,0);
    }
}
public void RotateRight()
{
    cameraY = Mathf.Clamp(cameraY, minAngle, maxAngle);
    if(cameraY <= maxAngle)
    {
        Camera.main.transform.Rotate(0,cameraY,0);
    }
}

Does clamping works outside an Update()? What am I missing?

Thank you in advance.

sentences:
Game performs poorly when sideloaded My game runs smooth when I deploy it to my windows phone directly from Visual Studio 2012 in debugging mode.

But when I sideload/deploy the same .xap file with the Application Deployment Tool, the game runs much worse.

Why is that happening?

sentences:
Is there a name for turn based combat that uses a speed attribute like ATBs but doesn't involve waiting? I've seen this in a number of games now - for me, I think the first (and one of the better examples) was Blue Dragon - where characters take turns in an order determined by their speed attribute such that a fast character will not only go first, but also take turns more often than a slow character.  This is much like an ATB (Active Time battle) (with Wait=true) BUT the turns still take place immediately after one another (as opposed to each character having a time-bar that runs down in real time).  And in the example of Blue Dragon, a number of tokens appear in a queue to indicate probable turn order (this would fluctuate if a character used a quicker or slower than normal action).

Is there a name for this turn-based-with-time-simulation-combat in games?

Edit: The closest I've come to a satisfactory term for this is a Combatant Cooldown System (https://tvtropes.org/pmwiki/pmwiki.php/Main/CombatantCooldownSystem) with a Visual Initiative Queue (https://tvtropes.org/pmwiki/pmwiki.php/Main/VisualInitiativeQueue)  I like these but both came from TV Tropes and don't appear to be (commonly) in use elsewhere...

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 I use collision lines to implement line-of-sight in GameMaker? I am making a GameMaker game that involves the enemies having line of sight so that they don't target the player through a wall. I have this code that uses collision line to detect whether there is a wall between the enemy and the player, then sets CanSee to 1 if true.

if collision_line(x, y, obj_parent.x, obj_parent.y, obj_wall_parent, false, true)
    global.CanSee = 1;

However, this code does not ever affect the value of CanSee. Am I using this code wrong?

Edit:
Here is my room setup. The walls all have obj_wall_parentas their parent.

Here are some of the objects:

sentences:
Are all conditions in an if statement checked? If I have an if statement like this:

bool conditionOne = true;
bool conditionTwo = false;
bool conditionThree = false;

if(conditionOne || conditionTwo || conditionThree)
{
    //do something
}

Will conditionTwo and conditionThree actually be checked even though conditionOne is already true, and thus has met the requirements of the if statement to run the code inside it? It would be pointless to check if conditionTwo and conditionThree are true because either way the code inside the if statement would be run.

I'm thinking this would be useful to know if I have some really long and quite expensive checks to do.

sentences:
How change LOD in geometry? I'm looking for a simple algorithm for LOD, for changing geometry vertexes and decreasing frame time. I've created an octree, but now I want model or terrain vertex modify algorithm, not for increase (looking on tessellation later) but for decrease.

I want something like this:

Questions:

Can the same algorithm apply to both model and terrain correctly?
Do indexes need to be modified?
Must I use octree or simple check distance between camera and object for desired effect?
Is a new value of indexcount for the DrawIndexed function needed?

Code:

     //m_LOD == 10 in the beginning
     //m_RawVerts - array of 3d Vector filled with values from vertex buffer.

     void DecreaseLOD()
     {
         m_LOD--;
         if(m_LOD<1)m_LOD=1;
         RebuildGeometry();
     }

     void IncreaseLOD()
     {
         m_LOD++;
         if(m_LOD>10)m_LOD=10;
         RebuildGeometry();
     }

     void RebuildGeometry()
     {
         void* vertexRawData = new byte[m_VertexBufferSize];
         void* indexRawData = new DWORD[m_IndexCount];
         auto context = mp_D3D->mp_Context;

         D3D11_MAPPED_SUBRESOURCE data;
         ZeroMemory(&data,sizeof(D3D11_MAPPED_SUBRESOURCE));

         context->Map(mp_VertexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(vertexRawData,data.pData,m_VertexBufferSize);
         context->Unmap(mp_VertexBuffer->mp_buffer,0);

         context->Map(mp_IndexBuffer->mp_buffer,0,D3D11_MAP_READ,0,&data);
         memcpy(indexRawData,data.pData,m_IndexBufferSize);
         context->Unmap(mp_IndexBuffer->mp_buffer,0);

         DWORD* dwI = (DWORD*)indexRawData;

         int sz = (m_VertexStride/sizeof(float));//size of vertex element

         //algorithm must be here.
         std::vector<Vector3d> vertices;
         int i = 0;
         for(int j = 0; j < m_VertexCount; j++)
         {
             float x1 = (((float*)vertexRawData)[0+i]);
             float y1 = (((float*)vertexRawData)[1+i]);
             float z1 = (((float*)vertexRawData)[2+i]);
             Vector3d lv = Vector3d(x1,y1,z1);

             //my useless attempts
             if(j+m_LOD+1<m_RawVerts.size())
             {
                 float v1 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD]]);
                 float v2 = VECTORHELPER::Distance(m_RawVerts[dwI[j]],m_RawVerts[dwI[j+m_LOD+1]]);

                 if(v1>v2)
                     lv = m_RawVerts[dwI[j+1]];
                 else
                     if(v2<v1)
                         lv = m_RawVerts[dwI[j+2]];
             }

             (((float*)vertexRawData)[0+i]) = lv.x;
             (((float*)vertexRawData)[1+i]) = lv.y;
             (((float*)vertexRawData)[2+i]) = lv.z;

             i+=sz;//pass others vertex format values without change
         }

         for(int j = 0; j < m_IndexCount; j++)
         {
             //indices ?
         }

         //set vertexes to device
         UpdateVertexes(vertexRawData,mp_VertexBuffer->getSize());

         delete[] vertexRawData;
         delete[] indexRawData;
     }

sentences:
Monetizing an Android library? I'm developing a library ( i.e. a JAR file that you put into the libs folder in eclipse ) which would extend surfaceView, which other people would hopefully use to make games.

I guess the best way to make any money off it would be to show banners on that surfaceview, right?

Maybe someone had similar experience? What advertising company would you suggest? admob, leadbolt? would they agree that I would integrate their sdk into my library ( not a finished app )?

Thanks!

sentences:
Bullet impact or force on cube in Blender Hoping someone here may be able to help. I'm new to Blender (and game development/3d modelling) and have been following some tutorials online to get me started. I am building a very basic FPS just to get started. I have a gun that shoots a cube object as a bullet, but when I shoot a different cube object that I added as a target, I have a number of issues. EDIT: The target cube is just set as a rigid body object. No other attributes as yet.

The cube only moves when I hit one particular face of the cube with a bullet. Otherwise, it doesn't register a hit. It's like the bullet passes right through it unless I hit the particular face.
When I hit the correct face, the cube flies way off the screen. I know this is controlled by the physics of each object but I can't find any explanations of it. It's like the box has no weight. If I increase the mass of it, walking against the cube is affected. The cube moves around slower/faster depending on the mass, but shooting it shows no change.

Could someone give a newbie some pointers?? Thanks so much guys.

btw I'm using Blender 2.6 but I reckon that's irrelevant really

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

sentences:
Random map generation - strategies for scattering/clustering random nodes I am doing a simple 4X strategy game in space where each node is a point-of-interest (a planet, an asteroid and etc.).

To randomly generate a map, I would follow the steps below

Decide how many type of each nodes the map will have (perhaps, say, 5 Earth-like planets, 10 barren planets etc.)
Place each type of node on the map.

For step 2 I would like to have an even spread of each node type. So for example, I would start by placing all the earth-like planets. If I simply do a rand(map.width, map.height) to determine the position, I may end up all the earth-like planets clustering together, which will give advantage to the player who starts in that area.

Are there any methods, such as using different graph functions or noise function, which could generate a sequence of (x,y) coordinates which are spread out from each other. Likewise, are there any ways to generates coordinates which are close to each other?

sentences:
Pathfinding and collision avoidance on mobile Currently I'm developing a Diablo like game for mobile platform(iphone5+).

A simple A* search will find the path, but collision avoidance still needs to be taken into consideration.

There will be about 50 monsters active at the same time, so performance is very important.

I found some methods that might work.

NavMesh + RVO

The recast/detour library works well on the pathfinding part, but its crowd simulation quickly reach the limit(more than 5ms for 30 agents).

Another library RVO2 seems fine(less than 2ms for 50 agents), but the library has some license issues.
Flow Fields + Physics Engine

Many RTS games use this method, but it seems that a physics engine is required to resolve  collisions. If many agents don't share a common goal, this method might cost more than traditional A* pathfinding.
Steering Behaviors + Physics Engine

Steering Behaviors includes many concepts, I think simple avoidance behavior might work(just turn left/right if there is something in front) , but the method still requires a physics engine to work together.

I'm still not sure which one to use, maybe there exists other pathfinding and collision avoidance methods.

P.S. Halo:Spartan Strike uses Havok AI(based on RVO?), but I didn't see many enemies in that game,
so I wonder whether the first method(NavMesh + RVO) will works well on mobile platform.

sentences:
Using XNA's XML content pipeline to read arrays of objects with different subtypes Using XNA's XML content importer, is it possible to read in an array of objects with different subtypes?

For instance, assume these are my class definitions:

public abstract class MyBaseClass
{
    public string MyBaseData;
}

public class MySubClass0 : MyBaseClass
{
    public int MySubData0;
}

public class MySubClass1 : MyBaseClass
{
    public bool MySubData1;
}

And this is my XML file:

<XnaContent>
    <Asset Type="MyBaseClass[]">
        <Item> <!-- I want this to be an instance of MySubClass0 -->
            <MyBaseData>alpha</MyBaseData>
            <MySubData0>314</MySubData0>
        </Item>
        <Item>  <!-- I want this to be an instance of MySubClass1 -->
            <MyBaseData>bravo</MyBaseData>
            <MySubData1>true</MySubData1>
        </Item>
    </Asset>
</XnaContent>

How do I specify that I want the first Item to be an instance of MySubclass0 and the second Item to be an instance of MySubclass1?

sentences:
Zoom to Mouse on a Globe using a Perspective Projection I am trying to create a strategy game that takes place on a globe (i.e. a textured sphere). I would like to be able to zoom to mouse like on google maps. My camera always points towards the center of the globe, and its position is defined in spherical coordinates. I have implemented zoom to mouse using an orthographic projection (technically scaling) which is easier since screen distance corresponds to world distance. I would like to be able to use a perspective projection, but the math seems to be a bit beyond me.

So far I am able to determine what point on screen my mouse is on my globe by ray-casting, however I am not sure how far my camera should be moving in order to keep that point fixed on screen while still having the camera point towards the center of the globe. I know that the basics of zoom to mouse involve translating to the position of the mouse, zooming, and then translating back, however being on a sphere with perspective introduces lots of distortion when translating.

Has anyone had any luck implementing zoom to mouse on a globe using a perspective projection? Or is this an exercise in futility...

sentences:
Tower Defense: Sorting Algorithm with multiple weights (enemy AI) I'm writing a sorting algorithm for a tower defense mobile game. As a quick synopsis, I have a "tower" that can shoot at incoming threats that are within X distance from the base of the tower.
Each incoming enemy, will have an associated {distance_from_tower} and {enemy_weight}. The {distance_from_tower} will be a value between 0 and X (X being the max range of the tower). The {enemy_weight} is a valued weight of "how important" it is to target that enemy mob. For example:
Three enemies:
Archer: {distance_from_tower} = 3 , {enemy_weight} = 1
Knight: {distance_from_tower} = 7 , {enemy_weight} = 5
Zombie: {distance_from_tower} = 10 , {enemy_weight} = 3
Currently, I have a simple sorting algorithm that only sorts enemies by their distance from the tower. (So, in the above example, the tower would target: Archer --> Knight --> Zombie)
Which is a "fine" first logical step, but I want my towers targeting to be more robust. I want the sorting to take into account both the {distance_from_tower} AND the {enemy_weight}. (For reference as well, these two values are updated at every Z seconds during the game, so they are constantly being recalculated).
I would like for the tower to be "smarter" and have a more robust sorting mechanism, that takes into account both weights, as said above. That could potentially lead to the tower targeting an enemy mob that is further away because the {enemy_weight} value of that respective enemy mob is of "high priority". (So, in the above example, the inclusion of using both weights could lead to the tower targeting in this order: Knight --> Archer --> Zombie).
I've been digging around for a few possible solutions, such as using a Travelling Salesman approach, Dijkstra's algorithm, or Floyd's algorithm, and I can't figure out the best way to go about sorting using both weights in a manner that makes sense to me. Any intuition or help is greatly appreciated! Thanks!

sentences:
Rendering a dynamically sized box So in games where there are textboxes with different sizes appearing, how does one actually render them efficiently? Games like Final Fantasy IX have dynamically sized speechbubbles for example, each with a size so it exactly matches the rendered text.

I know the basic idea is to render the frame around the bounding box of the text and with different images for each component of a box: corners, edges, center. Though how should one design that rendering if the edges aren't of 1 pixel in size when one has to compute how often an edge piece needs to be drawn next to each other to form the whole edge of the box.

Here is my naive implementation of a hopefully good enough abstracted method:

public void drawBox(Renderer renderer, int x, int y, int width, int height){
    int es = this.components.getEdgeSize();
    renderer.renderSprite(this.components.getTopLeftCorner(), x, y);
    /* Render top edge of box */
    int i;
    for(i = es; i < width - es; i += this.components.getTop().getWidth()){
        renderer.renderSprite(this.components.getTop(), x + i, y);
    }
    renderer.renderSprite(this.components.getTopRightCorner(), x + i, y);
    /* Render left edge of box */
    int j;
    for(j = es; j < height - es; j += this.components.getLeft().getHeight()){
        renderer.renderSprite(this.components.getLeft(), x, y + j);
    }
    renderer.renderSprite(this.components.getBottomLeftCorner(), x, y + j);
    /*Render bottom edge of box */
    for(i = es; i < width - es; i += this.components.getBottom().getWidth()){
        renderer.renderSprite(this.components.getBottom(), x + i, y + j);
    }
    renderer.renderSprite(this.components.getBottomRightCorner(), x + i, y + j);
    /*Render right edge of box */
    for(j = es; j < height - es; j += this.components.getRight().getHeight()){
        renderer.renderSprite(this.components.getLeft(), x + i, y + j);
    }
    int k = i;
    int l = j;
    for(i = es; i < k; i+= this.components.getCenter().getWidth()){
        for(j = es; j < l; j += this.components.getCenter().getHeight()){
            renderer.renderSprite(this.components.getCenter(), x + i, y + j);
        }
    }
}

I feel that some loops did not have to be done and the loop filling the center feels like it could potentially kill the framerate.

sentences:
How can I make sure my game runs on older GPUs than mine? My game must stay at 75fps to be playable (I'm developing for the Oculus Rift) and I'm optimizing with that hardware in mind.

My mid-range Nvidia GTX 650 Ti struggles a little with some Rift demos, but most do OK at medium-low graphics settings. I believe it's a reasonable optimization target if I want to enable more people to play my game.

Now, I've acquired a better-performing GTX 970, but I'd like to still optimize for older hardware. I don't want to be spoiled by my current better performance and develop something that could run only on high-end cards. In a few days, I won't have my old card available to me anymore.

While developing, how can I test if my game still runs at acceptable frame rate on older GPUs?

What I have in mind is to benchmark my GTX 650 now with some software, then underclock my GTX 970 until I get to the older card benchmark score. Is that a good approach? Would it effectively have the same performance?

If yes, what about memory and shader clocks? How can I objectively benchmark them separately?

(If relevant, I'm using Unity and Unreal Engine 4.)

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:
How can I boost cache performance when storing objects in a scene with managed languages? So, for reasons that I won't go into (has to do with my team more so than a good objective reason, unfortunately), I'm building a soft game engine in C# on top of SharpDX. C++ wasn't an option. I can't store objects contiguously in C# when it comes to reference types like classes, so I'm thinking about taking a data-oriented-design approach to storing objects in my scene. Thus, my scene looks a bit like this right now (all of the fields are structs because I can store them by value type, and thus contiguously):

public delegate void UpdateMethod (ref ModelData md, ref Transform t, ...)

class Scene
{
    ModelData[] models;
    Transform[] transforms;
    //...some other fields here
    UpdateMethod[] updateMethods; //delegate array

    void UpdateAll()
    {
         for (int i = 0; i < NUM_GAME_OBJECTS; i++)
        {
            if (updateMethods[i]!= null)
            {
                updateMethods[i](ref models[i], ref transforms[i], ...);
            }
        }
    }
}

The idea being that I can now store the objects contiguously as opposed to just an array of contiguous references to the data if I made each component a class.

Is this even a viable technique, or am I abusing the DOD paradigm? I'm storing all of my objects like this, not just my dynamic ones. Perhaps I could split it up into two sets of arrays for dynamic and non-dynamic, so I'm not tempting branch-predictor slow-downs on the if statement for UpdateAll()?

Will an approach like this create more issues than it attempts to solve? I will note that, while updating occurs here, I outsource the actual carrying out of the component functionality to other systems. For example, an input subsystem determines keys pressed, so an object could check in its unique update method denoted by the delegate; the update doesn't do everything, just behavior specific to that bundle of game object data.

This seems analogous to operating over columns in a row-major language, in that I'm killing performance gain of data locality; am I correct in concluding it would it be beneficial to wrap all of these fields into some GameObjectData wrapper struct, and just store those in an array?

sentences:
How free is BSD / CC-BY usage? I looked at blendswap.com where there are models that I want to make walk along a wall in this level.
AFAIK I can take this file and sell it or did I misunderstand licensing?

sentences:
Vulkan imageLoad data of r32f format in compute shader I am doing add with a compute shader. All input-output data are stored in VkImage, the format is VK_FORMAT_R32_SFLOAT. In the shader, the corresponding layout is r32f.
I have two questions about this:

When imageLoad a r32f data, imageLoad always returns 4 components vec4 data. So will this waste some memory? It seems imageLoad doesn't support return a single component of data.
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/imageLoad.xhtml
The real output data, every 4 data followed by 4 0.0. Does it mean r32f is 64 bits?

The used shader (The test project: https://github.com/math3d/VulkanCompute/blob/master/examples/add_imager32f/add_imager32f.cpp):

layout(local_size_x = 1, local_size_y = 1) in;
layout(binding = 0, r32f) uniform image2D outputValues;

layout(binding = 1, r32f) uniform readonly image2D values;
layout(binding = 2, r32f) uniform readonly image2D filterValues;

void main() {
  uint row = (gl_GlobalInvocationID.x);
  uint col = (gl_GlobalInvocationID.y);
  vec4 x = imageLoad(values, ivec2(row, col));
  vec4 w = imageLoad(filterValues, ivec2(row, col));
  vec4 res = x + w;
  imageStore(outputValues, ivec2(gl_GlobalInvocationID.xy), res);
}

The result:

Compute input:
0.000000        1.000000        2.000000        3.000000        4.000000        5.000000        6.000000        7.000000        8.000000        9.000000        10.000000       11.000000   12.000000        13.000000       14.000000       15.000000       16.000000       17.000000       18.000000       19.000000       20.000000       21.000000       22.000000       23.000000   24.000000        25.000000       26.000000       27.000000       28.000000       29.000000       30.000000       31.000000

Compute filter:
0.000000        1.000000        2.000000        3.000000        4.000000        5.000000        6.000000        7.000000        8.000000        9.000000        10.000000       11.000000   12.000000        13.000000       14.000000       15.000000       16.000000       17.000000       18.000000       19.000000       20.000000       21.000000       22.000000       23.000000   24.000000        25.000000       26.000000       27.000000       28.000000       29.000000       30.000000       31.000000

Compute output:
0.000000        2.000000        4.000000        6.000000        0.000000        0.000000        0.000000        0.000000        8.000000        10.000000       12.000000       14.000000   0.000000         0.000000        0.000000        0.000000        16.000000       18.000000       20.000000       22.000000       0.000000        0.000000        0.000000        0.000000    24.000000        26.000000       28.000000       30.000000       0.000000        0.000000        0.000000        0.000000        32.000000       34.000000       36.000000       38.000000   0.000000         0.000000        0.000000        0.000000        40.000000       42.000000       44.000000       46.000000       0.000000        0.000000        0.000000        0.000000    48.000000        50.000000       52.000000       54.000000       0.000000        0.000000        0.000000        0.000000        56.000000       58.000000       60.000000       62.000000   0.000000         0.000000        0.000000        0.000000

```

sentences:
Implementing an existing (but out of print) game electronically One of my favorite games is the old Avalon Hill class, PanzerBlitz.

I would like to implement it electronically, and have a couple questions related to that:

Would I be in legal trouble if I do this? (note - this is not for sale or distribution)
How would I go about implementing the hex grid and piece database most effectively (each piece has a variety of 'factors' (movement, carryability, attack, defense, unit type)?

The game play and mechanics are already well-defined in the written rules - so I'm not writing the game from scratch - just programming it to follow the board game.

sentences:
Can't read .cso files but I can read their .hlsl versions? Well I've been trying to read a .cso file to use as a shader for a DirectX program I'm currently making.

Problem is no matter how I implemented a way to read the file it never worked. And after fidgeting around I discover that it's only the .cso files I can't read.

I can read anything else (which means it works) even their .hlsl files. Which is strange because the .hlsl (high level shader language) files are supposed to turn into .cso (compiled shader object) files.

What I'm currently doing is:

vector<byte> Read(string File){
    vector<byte> Text;
    fstream file(File, ios::in | ios::ate | ios::binary);

    if(file.is_open()){
        Text.resize(file.tellg());
        file.seekg(0 , ios::beg);
        file.read(reinterpret_cast<char*>(&Text[0]), Text.size());
        file.close();
    }

    return Text;
};

If I then implement it.

Read("VertexShader.hlsl"); //Works
Read("VertexShader.cso"); //Doesn't Works?!?!

And I need the .cso version of the shader to draw my sexy triangles. Without it my life and application will never continue and I have no idea what could be wrong.

(I've also asked this at stack overflow but still no answers.)

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:
Why doesn't the current player on the server spawn after a new client connects? I have a running server that can change maps. When a client joins the server, it automatically loads the scene because the server uses ServerChangeScene () to change the scene.

The problem is that the client does spawn the objects on the server, but it spawns them on the first scene it loads into. How can I make it spawn the objects on the actual scene it loads into?

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:
Why isn't my tilemap collider appearing? I am trying to make a 2d game but my player falls through the tilemap every time.
My tilemap collider doesn't seem to show up.
What is going on and how do I fix this?
The first image is rigidbody currently falling through the tilemap and the tilemap. The second image is rigidbody currently falling through the tilemap and the rigidbody.

sentences:
Unity 4.6 New GUI Issue with GIT I am using Unity 4.6 new UI. I have my project setup on bit bucket (using GIT). It was working fine but when I cloned the project on another macbook. All the unity new UI scripts went missing. Is there any workaround for this issue ?

I am using same unity version on both macbooks. Editor Settings screenshot attached

Ref of inspector where scripts went missing.
[Editor Settings

sentences:
Which is the way to pass parameters in a drawableGameComponent in XNA 4.0? I have a small demo and I want to create a class that draws messages in screen like fps rate. I am reading a XNA book and they comment about GameComponents. I have created a class that inherits DrawableGameComponent

public class ScreenMessagesComponent : Microsoft.Xna.Framework.DrawableGameComponent

I override some methods like Initialize or LoadContent. But when I want to override draw I have a problem, I would like to pass some parameters to it.

Overrided method does not allow me to pass parameters.

        public override void Draw(GameTime gameTime)
        {
            StringBuilder buffer = new StringBuilder();

            buffer.AppendFormat("FPS: {0}\n", framesPerSecond); // Where get framesPerSecond from???

            spriteBatch.DrawString(spriteFont, buffer.ToString(), fontPos, Color.Yellow);
            base.Draw(gameTime);
        }

If I create a method with parameters, then I cannot override it and will not be automatically called:

        public void Draw(SpriteBatch spriteBatch, int framesPerSecond)
        {
            StringBuilder buffer = new StringBuilder();

            buffer.AppendFormat("FPS: {0}\n", framesPerSecond);
            spriteBatch.DrawString(spriteFont, buffer.ToString(), fontPos, Color.Yellow);
            base.Draw(gameTime);
        }

So my questions are:

Is there a mechanism to pass parameter to a drawableGameComponent? What is the best practice?
In general is a good practice to use GameComponents?

sentences:
Replace generated meshes with imported meshes in Unity I generated a lot of meshes for my project, but they have no import settings and I happen to need them. So I exported the objs, deleted the old assets and imported those files (that were exported using OBJexporter), making sure that the names DO match. Issue is, none of my scene objects recognize the new objects.

I could easily undo the harm, but I really need to change those mesh assets to the ones with import settings. How do I do that, so the engine does recognize them?

sentences:
How can I convey to a player that they need to hold the screen? My game has similar mechanics as Flappy Bird game. When you tap or hold the screen with your finger, character goes up. Everybody who tested the game forgot to hold touching the screen, instead they played it only tapping the screen which made some parts of the game difficult to pass.

I want to display a tutorial at the beginning of the game. English is not my native language so I am a little bit confused. Which message is grammatically correct?

Hold the screen to fly

or

Hold on to the screen to fly

or

Hold your finger on the screen to fly

If anybody displayed a similar message in their game, can you share it with me?

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:
Deterministically shuffling of array I couldn't find an answer to this so I'm asking here, I've made a voxel engine and it's working reasonably well, except for a small detail: I have yet to figure out how to seed my simplex noise engine, the internet gave me two suggestions:

Generate simplex of one dimension higher with the fourth axis being the seed, this worked but was painfully slow in comparison.

Shuffle the permutation table, I like this idea. It should (if my understanding of math is correct) yield 512! permutations, however I don't know how to shuffle an array reliably in a deterministic manner, I want the shuffle to be the same every time I use the same seed.
so something like shuffle(perm, 12) would return the same every time the seed is 12 but something different when the seed is 22321.

So what I really wish to know is either how to shuffle the permutation table in a fast, reliable and deterministic manner using a seed or a better method for seeding simplex noise.

sentences:
OpenGL assets and new OpenGL context So I have a bunch of meshes, materials, etc and then all of a sudden the window needs to be torn down and then recreated (such as switching on fullscreen with GLFW) which means I will get a new OpenGL context and my old OpenGL data is invalid.

What is the best way to reload all my OpenGL assets - do I save all the mesh and material data in system RAM (which is quite a waste isn't it? if you do not recreate the window during the game, it does absolutely nothing for alot of RAM) -OR- do you map the filepaths to all assets, and then re-read from disk when you reload them? (could lead to alot of file i/o)

Or is there a better alternative? What is the best-practice here?

sentences:
Is it legal to use other game's title word in my game's name? Is it legal to use e.g. the word "Fortress" in my game’s title?

There is a game called Team Fortress and I think it’s trademarked. I’m thinking of replacing the word "Team" with another word and using that name in my game (with an intent to make money).

Would I get in trouble?

sentences:
Why is mesh baking causing huge performance spikes? A couple of seconds into the gameplay on my Android device, I see huge performance spikes caused by "Mesh.Bake Scaled Mesh PhysX CollisionData"

In my game, a whole level is a parent object containing multiple ridigbodies with mesh colliders. Every FixedUpdate(), my parent object rotates around the player.

Rotating the world causes mesh scaling. Here is the code that handles world rotation.

 private void Update()
    {
        input.update();

        Vector3 currentInput = input.GetDirection();

        worldParent.rotation = initialRotation;

        worldParent.DetachChildren();
        worldParent.position = transform.position;
        world.parent = worldParent;

        worldParent.Rotate(Vector3.right, currentInput.x * 50f);
        worldParent.Rotate(Vector3.forward, currentInput.z * 50f);
    }

How can I get rid of mesh scaling ?
Mesh.Bake physx seems to take effect after some time, is it possible to disable this function ?

The profiler looks like this:

Bottom-left panel shows data before spikes, the right after

sentences:
How to add font assets to a Unity based Android app on runtime? I am working on an android app that contains a Unity scene. The unity scene has some TextMeshPro text fields where user can enter information. Users also have the option to select fonts for these text fields.

I want to support a lot of fonts. Right now I add all the font assets in Unity. But these font assets add up to increase the app size a lot.

I am trying to find out if there is a way to download these fonts at runtime as per the user's choice so that the initial app size is small? Is this possible?

I would appreciate any links, tutorials, or help. I've not been able to find any information regarding this so far. Thanks!

sentences:
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:
Why I am I told "Color0 is missing" when I run the following code? In the code below, I want to draw a box on my screen. But when I run it, there is an error message:

  The current vertex declaration does not include all the elements
  required by the current vertex shader. Color0 is missing.

Here is the code in question:

    private SpriteBatch _sb;
    private Vector3 _position;

    public Vector3 Position
    {
        get { return _position; }
    }
    private Matrix _world;

    public Matrix World
    {
        get { return _world; }
    }
    private Texture2D _image;
    private VertexPositionColor[] _vertices;
    private short[] _indices;
    private Game _game;
    private IndexBuffer _ib;
    private VertexBuffer _vb;
    private BasicEffect _basicEffect;
    private BoundingBox _boundingBox;

    public BoundingBox BoundingBox
    {
        get { return _boundingBox; }
    }

    public Blackhole(Game game, Vector3 position, Matrix view, Matrix projection)
    {
        _game = game;

        _vertices = new VertexPositionColor[4];
        _vertices[0] = new VertexPositionColor(new Vector3(-100, 100, 0), Color.Red);
        _vertices[1] = new VertexPositionColor(new Vector3(100, 100, 0), Color.Green);
        _vertices[2] = new VertexPositionColor(new Vector3(100, -100, 0), Color.Blue);
        _vertices[3] = new VertexPositionColor(new Vector3(-100, -100, 0), Color.Yellow);

        _indices = new short[6];
        _indices[0] = 0; _indices[1] = 1; _indices[2] = 2;
        _indices[3] = 0; _indices[4] = 2; _indices[5] = 3;

        _vb = new VertexBuffer(game.GraphicsDevice, VertexPositionColor.VertexDeclaration, 4, BufferUsage.WriteOnly);
        _vb.SetData<VertexPositionColor>(_vertices);

        _ib = new IndexBuffer(game.GraphicsDevice, typeof(short), 6, BufferUsage.WriteOnly);
        _ib.SetData<short>(_indices);

        game.GraphicsDevice.SetVertexBuffer(_vb);
        game.GraphicsDevice.Indices = _ib;

        _basicEffect = new BasicEffect(game.GraphicsDevice);
        _basicEffect.View = view;
        _basicEffect.Projection = projection;
        _basicEffect.World = _world;
        _basicEffect.VertexColorEnabled = true;
        _basicEffect.TextureEnabled = false;

        RasterizerState newState = new RasterizerState();
        newState.CullMode = CullMode.None;
        game.GraphicsDevice.RasterizerState = newState;
        _boundingBox = new BoundingBox(new Vector3(_position.X, _position.Y, -1), new Vector3(-_position.X, -_position.Y, 1));
    }

    public void Update(GameTime gt)
    {
        _world = Matrix.Identity * Matrix.CreateTranslation(_position);
    }

    public void Draw(Matrix view, Matrix projection)
    {
        _basicEffect.View = view;
        _basicEffect.Projection = projection;

        foreach (EffectPass f in _basicEffect.CurrentTechnique.Passes)
        {
            f.Apply();

            _game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
        }
    }

What is the cause of my error?

sentences:
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:
How to unfold a spiral of balls? I have a spiral made of balls. It's a spiral with equally distributed balls using the following formula (see link on math.stackexchange).

This is how it looks like:

Now, the spiral is rolling forward with some speed forwardSpeed.
I want to unfold the balls on the ground so they are placed one after another so I have to somehow synchronize the rotation speed of the spiral and the timing of the 'undocking' part of the individual balls.
To make it super clear, I just want the spiral to create a "trail" of balls behind itself.
I've tried various approaches including triggers on the ground so the balls stick to it or even
calculating the distance from "previous ball drop" and if the distance is higher than some threshold then I'd drop another ball.
But these approaches didn't work well and also seemed quite bad.
I want to do it with proper math so I will sleep well made sure that it will work with every possible spiral size.
To calculate the Y position of the spiral on the ground I do a little trick:
var spiralRadius = Mathf.Abs(firstBall.position.y - lastBall.position.y); // first and last balls connected to the spiral

and then I use it to set the Y position of the spiral in Update().
This works pretty well for removing balls from the tail - the Y position is adjusted accordingly so the spiral is always on the ground:
yPositionOffset.transform.position = new Vector3(0f, spiralRadius, 0f); // in Update

Ok now back to the problem
I have smth like this:
private float GetCircumference(float r)
{
    return 2f * 3.1415f * r;
}

void Update()
{
    float spiralHeight = GetSpiralHeight();

    this.rotationWrapper.transform.Rotate(new Vector3(3.1415f * Time.deltaTime, 0f, 0f));

    // SAND_BALL_DIAMETER is the scale of the ball
    float ballUndockInterval = SAND_BALL_DIAMETER / (spiralHeight * 3.1415f);

    if (Time.time > nextBallUndock)
    {
        nextBallUndock = Time.time + ballUndockInterval;
        UndockBallFromTail();
    }
}

void FixedUpdate()
{
    var forwardTranslation = forwardSpeed * Vector3.forward * Time.fixedDeltaTime;
    targetPos += forwardTranslation;
    var finalPos = Vector3.Lerp(rb.position, targetPos, Time.fixedDeltaTime * SpeedLerp);
    rb.MovePosition(finalPos);
}

And here's the result I get which looks like one of the trigonometric functions... what the hell?

Does anybody have any idea what is going on here?

sentences:
a simple 2D rectangle collision algorithm that also determines which sides that the rectangles collide? I initially tried out implementing rectangular intersection, which works well. However, when I have to apply the physics system, such as velocity, acceleration, and directional vectors, I would have to find a way to determine which side of the rectangles collide. Now, in my system, there is no rotated rectangle, so this simplified the problem. However, I couldn't find an easy way to determine which rectangle side collided. I have once deal with this problem before but failed miserably.

What I did in the past is determine the distance between each parallel rectangular sides and check if the distance is close to 0 (use some initially defined distance range) or is 0. However, for floating-point arithmetic, this proves to be unstable because of unknown time elapse. Sometime, the rectangles would actually intersect each other before it meets the defined range.

On the other hand, I was thinking about spawning multiple rectangles, each rectangle for each sides. However, after thinking again, it would be the same thing as having a parallel side with distance range checking, just that that distance range is the width of each mini-rectangle.

Therefore, any suggestion to this problem?

sentences: Is point texture filtering the same as nearest? Is point texture filtering the same as nearest (different names for the same technique)?

sentences:
Find Coordinates of Exit Point I'm trying to make a bullet penetration system. Taking a look at the picture below could help explain what I want better.

If we know the coordinates of a square shape as well as AB vector with direction coefficient, how do we find X,Y for C point?

Basically I'm trying to find the X,Y coordinates of the point of the opposite side of an object of another point. As you can see I'm not exactly going for realism as it's linear. Below are a couple more examples to clarify my objective.

===========================================================================

Any help is greatly appreciated :D

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:
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:
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:
Godot: How do I get the id mask for a physics layer by name? I would like to figure out whether a collider is in a physics layer by the name (string) I set in project settings:

func _physics_process(delta):
    var collision = move_and_collide(direction * delta * speed)
    if collision and (collision.collider.collision_layer & get_collision_layer("Walls")) != 0:
        direction = direction.bounce(Vector2.LEFT)
    # more behaviors based on other layer tests

Walls is the name of the physics layer and I am trying to find get_collision_layer.

I am using Godot 3.2.1.  self is a KinematicBody2D & colliders are StaticBody2D's & also KinematicBody2D's.

I have figured out the collision id (as an int) but still think it would be cleaner to use layer names, preferably using a built-in function.

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:
Problems with Unity3D Animator controller states I have an object (a simple card) equipped with the Rigidbody, Collider and Animator components. In particular, Animator performs two simple clips: Cover and Uncover that rotates the card 180 degrees. The first starting from 0 degrees to 180, the second from 180 to 0.

So the clips should cover or uncover the card. The problem is that the card returns to its original state.

For example, the original state of the card is the "uncovered state" so when I click on it to cover it covers as expected. The I register the state "covered" programmatically. However, immediately after the animation ends, it returns to its original state (uncovered). The card now has an internal (C# variable) state as "covered", but I see it to still be uncovered. When I click it again, will be fired the correct animation clip: "uncover".

What should I do to leave it covered at the first click?

I have uploaded here a short clip that shows the behavior of the card, also below find some screenshots that refer to the various views of the IDE that may have useful information. The video clip is uploaded to Dropbox for the while.

The video of the behavior: Dropbox link

The code of the Flip script:

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

public class Flip : MonoBehaviour {

    private Animator anim;
    private enum cs_e {covered, uncovered};
    private cs_e coveringState;

    // Use this for initialization
    void Start () {
        anim = this.GetComponent<Animator>();
        coveringState = cs_e.uncovered;
    }

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

    }

    private void OnMouseUp()
    {
        Debug.Log("Mouse up");

        if (coveringState == cs_e.uncovered)
        {
            anim.Play("Cover");
            coveringState = cs_e.covered;
        } else {
            anim.Play("Uncover");
            coveringState = cs_e.uncovered;
        }

    }

    private void OnMouseDown()
    {
        Debug.Log("Mouse down");
    }

    private void MouseDrag()
    {
        Debug.Log("Mouse drag");
    }
}

Some screenshots:

sentences:
Scene2d How to make it work for a Visual Novel I kinda understand that you can use Scene2d for a Hud or stuff like that, I'm new to Java and so far I've done games that update in real time like let's say Flappy bird (simple games), so i wanted to try something different and now I'm kinda stuck, instead of having all the level be decided at the start of the game i want to instead have a forward and backwards button (Visual Novel) that lets me update the screen on each click, the problem is that i don't know how to do it in a clean way, is there a way to update the button on real time or any technique to have an entire "dialog level" scripted?
(sorry if this sounds confusing i don't know how to phrase it properly, if you have played or seen a visual novel you would understand what I'm talking about)

sentences:
What happened to the Journal of Game Development? The lengthy mission statement from its website states:

  The lack of game-specific research has prevented many in the academic community from embracing game development as a serious field of study. The Journal of Game Development (JOGD), however, provides a much-needed, peer-reviewed, medium of communication and the raison d'etre for serious academic research focused solely on game-related issues. The JOGD provides the vehicle for disseminating research and findings indigenous to the game development industry. It is an outlet for peer-reviewed research that will help validate the work and garner acceptance for the study of game development by the academic community.  JOGD will serve both the game development industry and academic community by presenting leading-edge, original research, and theoretical underpinnings that detail the most recent findings in related academic disciplines, hardware, software, and technology that will directly affect the way games are conceived, developed, produced, and delivered.

The Journal of Game Development was established in 2003. It's hard to find any information about the issues but at four issues per year, I estimate the last issue was distributed sometime in 2005 or 2006. It had a good editorial board of college professors and a founding editor from Ubisoft. The list of articles looks good. The price was reasonable.

So what happened to it? Its website recently went down but you can see the last Archive.org version.

The editor-in-chief is a professor at my school so I intend to ask him in person in a week or two, but I thought I'd see what you might be able to dig up about it first. Of course I will be sure to add an answer with his official word on the matter at that time.

sentences:
Biased, conservative random walk I have a sprite which has Velocity and Position, either stored as Vector2. At each Update cycle, velocity is added to the position.

I would like to give the sprite a third vector, Target. New targets may be given at any iteration. I would like the sprite to essentially move in a random walk pattern, however two parameters must be exposed:

A typical random walk is equally likely to increase or decrease the distance to any given Target (plus the small chance of tangential movement). I must be able to bias my random walk such that, while still random, the direction on which the sprite "decides" should be more likely to bring it closer to Target.
The random walk should be "smooth"- the sprite should not rapidly change direction, as this will look like it's "flickering" or "trembling" to the player. It should gradually veer this way or that, moving randomly, while slowly getting closer when averaged.

What is a good, simple way to do this? If possible, give the answer as a Vector2 RandomWalk(Vector2 target) method.

I already have a NextGaussian(mean, stdev) method available, if that is helpful.

sentences:
Clamp quaternion relative to plane normal How would one be able to clamp a quaternion based on the angle relative to a plane surface (defined by a normal)?
My diagram below provides more of a visual explanation of exactly what I am talking about.
The quaternions are clamped based on the angle between the planes surface, and the quaternion's forward vector (i.e. q * (0, 0, 1)).  The quaternions are global quaternions.  The plane normal (vector) N defines the upwards direction of the plane surface.  Angles that go opposite of the normal vector is negative, whereas in the direction is positive.  With that in mind, the quaternion's angle cannot be greater than MAX degrees and less than MIN degrees.  These bounds are visualized by the cones (MIN is -90˚ in the diagram, so the cone is infinitely thin).

Thoughts:
My thought is that this algorithm would have to work in regards to the quaternions delta (unless the quaternion is in the MIN/MAX zones, which I will talk about later).  If the change (delta) of the quaternion results in the quaternion entering, or passing, the bounds, the change is capped (clamped) so the final quaternion never has a resulting angle that dissatisfy the bounds.
Clamping the delta could be achieved by determining the beginning and end angles, and obtaining a ratio to be used as the t value (the interpolator) of a Slerp function, so the final quaternion's angle is that of the bound.  The issue I see with this is how the roll would be manipulated due to the Slerp.  Would the intended, final roll of the quaternion be lost due to this Slerping?
This idea of change seems more important in the example of if the quaternion was to go from -89˚ to -91˚.  The final quaternion should be snapped back to -90˚ (if the bound was -90), instead of considering the new quaternion as -89˚ but from the other side.  Without this proper interpretation of the quaternion's angle, the quaternion could rotate around constantly and consistently due to the angle never being considered less than -90˚ and greater than 90˚.
Edge Case:
If the quaternion was to start inside the MIN/MAX zones (the cones), the quaternion would not have a change to define as the direction that the quaternion needs to move to get back to legal territory/angles (see angle a3 in diagram).  My thoughts is that a fallback plane normal that is orthogonal to plane normal N would have to be used, so the quaternion has a plane to rotate around.
Use Case:
Orbiting camera with user or author definable pitch angle clamping, and a varying change in "up".  Example of varying change of "up": Mario Kart 8 Deluxe.

sentences:
In unity i have this code that has to make a lot of allocation but no new variables are creates, but still the RAM usage just keeps climbing So I have this code that has four for-loops inside each other, so there are a lot of actions, but no new Space should be needed. Still, when trying to run this, Unity stops responding and in the Task-Manager I just see the RAM-Usage steadily climbing up while the CPU-Usage is pretty much constantly on 10%.

This is the Code:

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

public class SceneGenerator : MonoBehaviour
{

    public GameObject spawnee;

    // Start is called before the first frame update
    void Start()
    {
        pos4d mpos = new pos4d();
        float r = 1;

        pos4d campos = new pos4d();
        campos.s = 3;

        pos4d viewpos = new pos4d();
        viewpos.s = 3.5f;

        //pos4d[,,] grid = new pos4d[10,10,10];
        pos4d dir = new pos4d();
        pos4d raypoint = new pos4d();

        for (int i = 0;i < 10;i++) {
            for (int j = 0;j < 10;j++) {
                for (int k = 0;k < 10;k++) {
                    /*
                    grid[i,j,k] = new pos4d();
                    grid[i,j,k].x = i/10-0.5f;
                    grid[i,j,k].y = j/10-0.5f;
                    grid[i,j,k].z = k/10-0.5f;
                    grid[i,j,k].s = 3;
                    */

                    dir.x = (i/10-0.5f - viewpos.x)/10;
                    dir.y = (j/10-0.5f - viewpos.y)/10;
                    dir.z = (k/10-0.5f - viewpos.z)/10;
                    dir.s = (3 - viewpos.s)/10;

                    raypoint.x = i/10-0.5f;
                    raypoint.y = j/10-0.5f;
                    raypoint.z = k/10-0.5f;
                    raypoint.s = 3;

                    for (int step = 0;step < 1000;step++) {
                        Debug.Log("" + (i+j+k+step));
                        if (Mathf.Sqrt(Mathf.Pow(raypoint.x - mpos.x,2) + Mathf.Pow(raypoint.y - mpos.y,2) + Mathf.Pow(raypoint.z - mpos.z,2) + Mathf.Pow(raypoint.s - mpos.s,2)) <= r) {
                            Instantiate(spawnee,new Vector3(i/10-0.5f,j/10-0.5f,k/10-0.5f),Quaternion.identity);
                            break;
                        }
                        raypoint.x += dir.x;
                        raypoint.x += dir.y;
                        raypoint.x += dir.z;
                        raypoint.x += dir.s;
                    }
                }
            }
        }
    }

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

    }
}

public class pos4d {
    public float x = 0;
    public float y = 0;
    public float z = 0;
    public float s = 0;
}
```

sentences:
How to use collision masks and overlap_area in pygame? So, I've been prototyping a game, and I've been using sprite collision, and it's not cutting it any more. I read up on the documentation about masks and overlap area: https://www.pygame.org/docs/ref/mask.html#pygame.mask.Mask.overlap_area

How exactly do I use this? The documentation says "This can be used to see in which direction things collide, or to see how much the two masks collide. An approximate collision normal can be found by calculating the gradient of the overlap area through the finite difference."

I don't quite follow this description. How can I tell the direction of the collision? What does the return value actually contain? How would I implement this collision for two Pygame Sprites with images and transparency?

Is there a more in-depth explanation (preferably with sample code) anywhere? I can't find anything more detailed than the documentation.

sentences:
Implications of using a single ID3DXSprite object to render multiple images I wanted to know if using a single Sprite object to render all 2D textures on screen is better than using one sprite for each 2D texture in performance.

EDIT:
Using single sprite refers to using a single ID3DXSprite Object to render all textures.

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:
Broken alpha of two-sided OpenGL mesh How do I get rid of this alpha transparency artifacting with classic fixed function OpenGL?

I tried all kinds of settings but I'm not sure why it's good in the upper half of the mask but not in the lower half.

alpha illustration | 1.7M GIF

I have a two-sided concave mesh and want to fade out the edges with an alpha vector on the vertex colors. I get the same artifact with an RGBA texture also.

sentences:
how to render small texture on another texture? can anybody help me to render small texture on another texture.
i.e
I have one background image, when user touches on the screen it should draw small(circle or any object) on it.

can anybody suggest me good tutorial to starts with it?

sentences:
Way to structure items in code? I have an "Item" class here that is used to create items.

public class Item {
    private String name;
    private int id;
    private int worth;

    //constructor
    Item(String _name, int _id, int _worth) {
        name = _name;
        id = _id;
        worth = _worth;
    }

    public String getName() {
        return name;
    }
}

This works fine and dandy.. but I don't know how to give them unique ID's, I thought about using

private static Item[] items;

and then when they're created add them to this array, but is that the only way? Also where do I put my code to initialize all the various items in the game? Should it be in the main method, or have a loader of some sort, or have them declared straight away in the Item class using

private static Item apple = new Item("Apple",0,3);

?

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:
How do I wrap textures inside shader GLSL? I'm trying out GLSL and one of the problems I'm facing is wrapping a random texture sampler in the shader. Searching for answers on the web first, this leads me to using these:

glTexParameter()
GL_TEXTURE_WRAP_S GL_REPEAT
GL_TEXTURE_WRAP_T GL_REPEAT

I'm not sure where to put this or how to use it. I'm using a custom engine for this shader and I would assume I could wrap the texture in the shader.

My main concern on this is my final output render having left and bottom artifacts. I got some previous advise it has to do with wrapping a random texture that is used for noise if that helps in my case.

sentences:
Rotating a swinging sword in LWJGL gives wierd results I'm making a 2d top down game in Java using LWJGL(OpenGL, essentially). I recently tried adding a swinging sword mechanism. My coordinate system is set to the bottom left FOR ALL objects. The rotation worked, but it happens with respect to the bottom left corner of the Sword Quad. I want it to rotate with the center of the bottom line as the pivot for rotation. I tried a lot of solutions from the internet like:

translating the object to origin(0,0 of the screen), then rotating, then translate to the point of pivot.
translating object normally, then rotating, then again translating to the point you want it to pivot at.

But they all yield weird results.

Here's the code:

The Sword Class:

public class Sword extends GameObject {

    private static int speed = 5, deg = 0;;

    private Texture tex;

    public Sword(float x, float y, ObjectId id)  {
        super(x, y, id);

        //tex = ImageLoader.loadTexture(null, null);
    }
    protected void update(ArrayList<GameObject> objects) {
        if(deg < 360) deg += 1;
        else deg = 0;
    }

    protected void render() {
        Draw.rect(x, y, 10, 32, deg, 1, 0, 0);
    }

    public Rectangle getBounds() {
        return null;
    }

}

The Draw.rect method:

public static void rect( float x, float y, float width, float height,
                         float deg, float r, float g, float b) {
        glDisable(GL_TEXTURE_2D);

        glPushMatrix();
        {
            glTranslatef(0, 0, 0);
            glRotatef(deg, 0, 0, 1);
            glTranslatef(x + (width/2), y, 0);

            glColor3f(r, g, b);

            glBegin(GL_QUADS); // Specifies to the program where the drawing
                               // code begins. just to keep stuff neat.
                               // GL_QUADS specifies the type of shape
                               // you're going to be drawing.
            {
                glVertex2f(0, 0); // Specify the vertices. 0, 0 is on BOTTOM
                                  // LEFT CORNER OF SCREEN.
                glVertex2f(0, height); // 2f specifies the number of args
                                       // we're taking(2) and the type
                                       // (float)
                glVertex2f(width, height);
                glVertex2f(width, 0);
            }
            glEnd();
        }

        glPopMatrix();

        glEnable(GL_TEXTURE_2D);
    }

EDIT: Here is an image of what "weird result" is. In the pic, I'm translating first to origin[(0, 0) of the WORLD], then rotating(by 90 degrees), then translating to translating to [x - (width/2) , y]. As you can see, the red block that represents the sword is out of the "arena", even though I've set the x, and y of the sword to near the player. The image:

sentences:
How to calculate a simple swivel rotation? (no physics engine) Assuming i know the geometry and the rotation angle of a cart, how can i calculate the rotation angle of a swiveling wheel?

To get the rotation angle of the wheel, i tried by calculating the distance from the rotation axis, and to apply a friction coefficient:

var dx = cartCX - wheelCX,
    dy = cartCY - wheelCY,
    dist = Math.sqrt(cartCX * wheelCX + cartCY * wheelCY);

var wheelRotation = Math.atan2(-dy, -dx) * dist * friction;

But all this has not brought me any acceptable result.

Which is a simple way to get the wheels rotation angle about the Y axis when the cart is rotating?

I don't need exact physics simulation, just a smooth rotation angle which i can tween. I think there should be no need to use any physics engine, or i'm wrong?

sentences:
What is a good method for coloring textures based on a palette in XNA? I've been trying to work on a game with the look of an 8-bit game using XNA, specifically using the NES as a guide.

The NES has a very specific palette and each sprite can use up to 4 colors from that palette. How could I emulate this? The current way I accomplish this is I have a texture with defined values which act as indexes to an array of colors I pass to the GPU. I imagine there must be a better way than this, but maybe this is the best way?

I don't want to simply make sure I draw every sprite with the right colors because I want to be able to dynamically alter the palette. I'd also prefer not to alter the texture directly using the CPU.

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:
What is the "main" implementation of OpenGL? What is the main implementation of OpenGL?

I see GLUT everywhere, but I want to use whatever is closest to an official implementation, or what ever I will have the most control over.

I might not be asking this right since it's contributed to by different parties. Which is why I have been looking at DirectX, but I see more people using OpenGl so I'd like to use that instead.

sentences:
Structuring game narrative. Handling NPC, Quest, General Dialogue. Is Json/XML the right way to go? Or any other solutions? Hello guys I'm try to make some games that have more to it than just simple high score scrolling shooters etc.

I'm trying to design my own systm of handling narrative. I want to be able to place NPC's in the game world, with scripts attached to them. Some of the NPC's would just have n random greetings. Others will be mission givers and will offer you a quest of sorts. (The quest could be go speak to Bob in the pub, or it might be bring me the Holy Grail and Crown Jewels, or something in between).

I've wracked my brain for a long while over this but sadly keep slipping back to the only way I know how, which is to manually code all the strings that people can say and have a horrible web of if statements and other such insanity to give me a rudimental dialogue system. Its not good enough even with just a few characters, but if I had dozens/hundreds of characters it would be even worse.

I've read lots about it already but I'm still very confused when I start trying on my own project. I've read that Json/XML might be the way to go and that I can add custom markups in the Json text to call methods in my code, but I dont even know if this is right and if so how I can do it.

The back of my brain is screaming at me that there is a simpler way to do it, but I've sat here for a very long time without managing to think of ideas.

Here is a diagram I drew which pretty much shows the flow of how I want my NPC to behave. If anyone can see this and then tell me how they might do something like this that would be fantastic!! (note: if Json is the correct advise, please give me a exact example of how exactly to format the Json in order to check the bools I mention in my flowchart - thanks!):

note: The circles denote an output from the data as Text for the dialogue system. The bools will need to be checked against by the data file to see which output to give (hope that makes sense and is possible)

sentences:
Calculate the distance/number of moves one square is from another Say I have a 9x7 grid (could be any size) I want to be able to calculate the distance any square is from another. In the image I have selected 5,4 is my target square. Now square (1,2) is 4 moves away (if you can move left, right, up, down and diagonal), as denoted by the orange dot. It is clear from the diagram that the distance from the target square is simply showed by a growing square surrounding the target square. Is there a function which will calculate me the distance of a particular square to my target square using the x and y values of both squares.

e.g. I want to know how many moves it will take from (8,5) to the target square, looking at the diagram I know this is three but is there a function I can use?

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:
Find alternate shortest paths in Unity I'm developing a game in Unity. It's a simple game where the rocket has to reach the point where the player touches on the screen. The movement of the rocket is physics based. When the rocket goes off screen on right side, it appears on left side and when it goes off on left side, it appears on right side. Similar for vertical axis.

In the picture above, the user touches on the bottom right corner. The rocket could either rotate and go there (Path 1) or it would directly go up left off the screen and appear on bottom right corner and reach there(Path 2).  I want to implement the Path 2. How would it calculate the distances and determine the shorter path and then proceed in that direction?

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

sentences:
Move Sprite from A(x,y) to B(x1,y1); I have a sprite with an UpdateHandler that can change it's position every 0.1 seconds.

My Question is , given the Sprites current position, how can I move it to another position(like from 10,10 to 250,250).

I found out the rotation angle for my sprite like this:

double alfa = (float) Math.atan2(endY - startY, endX - startX) * 180 / PI;

And an example of moving the position is:

sprite.setPosition(sprite.getCurrentX()+1, sprite.getCurrentY());

This would move my sprite every 0.1 seconds to the right.
I need to make it work between any 2 points.

Thanks!

sentences:
Different methods of ammo resupply I'm writing a small game at the moment. Presently, I have one or two design elements that aren't locked down yet, and I wanted to ask for input on one of these.

For dramatic effect, the player's character in my game is immobilised, alone and has a supposedly limited amount of ammo for their weapons. However, I would like to periodically resupply the player with ammo (for the purpose of balancing the level of difficulty and to allow the player to continue if they're doing well).

I'm trying to think of a method of resupply that's different to the more familiar strategies of making ammo magically appear or having the antagonists drop some when they die. I'd like to emphasise the notion of the player's isolation as much as possible, and finding a way of 'sneaking' ammo to the player without removing too much of that emphasis is basically what I'm trying to think of (it's definitely a valid argument that resupplying the player removes it anyway)

I have considered a sort of simple in-game 'store', where kills get you points that you can spend on ammo for your favourite weapon. This might work well, and may also be good for supporting a simple micro-transaction business model within the game. However, you'd have to pause the game often to make purchases, which would interrupt the action, and it works against the notion of isolation.

Any thoughts?

sentences:
Write error log on crash in libGDX? I've been having problems building my game. I've built it successfully before, until I added the LuaJava.dll and LuaJava.jar files (so I can use Lua in my game).

Now, it just briefly opens with black screen and immediately closes. Even though it works just fine in Eclipse.

What I used to do before, was set my jar file in my assets and it would just work fine. But now, it refuses to work, and I have no idea what the error is.

Is there a function I can call to output the error into a log file?

sentences:
Platform game: applying gravity and jumping I am making a 2D platform game in Java but I don't know how to apply gravity and jumping on my player and other living creatures in game that it looks natural and that it is physical correct.
I have formula: speed = v0 + gt^2/2
but i don't know how to implement it in my code...

Thanks for any help.

sentences:
Best way to handle tick-based resource generation in an online multiplayer strategy game I'm building an online multiplayer strategy game. The game has no offline mode and requires syncing up to a server. Part of this game is constructing buildings which will generate resources each second. These resources would be generated whether the player is online or offline.

If this was a purely offline game, this would be easy: get the delta between when the app was closed and when it was opened again and multiply by resources per second and just fast forward everything.

Since it's an online game, and other players can be affected by the resources an offline user has, these calculations have to occur on the backend.

My question is: if I have 10,000 players, each with 20 buildings generating resources on a per second basis, how on earth should I handle 200,000 things all at once and syncing to a database?

sentences:
Unity point light baking into lightmap I'm developing a puzzle with a ball with cracks on it. Inside the ball there's a point light. Its light rays come out of the cracks and hit some platforms (walls/ceiling/floor).

To solve the puzzle the player must rotate the ball to match the light coming out of the cracks with some pre-lit pattern on the platforms.

I don't know how to do the pre-lit pattern. I don't want it to be manually done using a texture editing tool like Photoshop or GIMP. I remembered this could probably be done using light baking. I think what I need is to bake the light from only that point light into a lightmap and use it only on those platforms, but don't know how to do that.

Can someone help me with a solution?

sentences:
get back unity default interface i installed unity recently .and interface of unity looks like that  [see the image] in all tutorials i see on the internet.

but this is my one(I'm not in the game tab I'm in the scene tab)it's look like brown and i don't like it.i want default interface the interface in first pic which is black .how can i get black interface back ?

sentences:
How does directX API implement supersampling in GUP layer?Does it allocate a scaled-framebuffer other than user-specified framebuffer? For example,if I create a backbuffer of size 800 * 600 and turn on 4x-supersampling, is it the case that the graphics driver actually allocates a backbuffer of size 3200 * 2400 under the hood then downsamples to samller buffer?
PS:3200 calculated from 800 * 4,   2400 calculated from 600 * 4

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: 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 to keep a shape inside a rectangle? So I'm making a game which is based on randomly generated rooms and I need a way to keep the player inside them and make the player glide when he collides with the room's bounds. I currently have a SAT algorithm in place to detect collisions, but I don't know how to do collision resolution for being inside rooms.

Full code here

sf::Vector2f Collision::GetMtv()
{
    return (Mtv(small, smallestPerpendicular[smallestIndex]));
}

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:
How can I blend the center color of a 2 side gradient so it isn't as harsh looking in Unity Shader Graph? I am using the gradient node in Unity's Shader Graph.  It is 2 sided, with it being black-white-black.  The white is quite harsh, it makes a line that stands out.  I will be using this as a mask, and would like the white to not be so strong where it appears as a line.  I don't know if this would be better to do outside of the gradient node or not.
I don't want to use an image (don't know how to create one), as I want more control in the shader.
Edit:  I can add more points and make them less white to try and get a better blend, but this is very tedious and isn't perfect.
Here is what it currently looks like:

Here is what I want to achieve (even this is a little harsh, but closer to what I want):

I tried adding more points but still can't get it right:

sentences:
LibGdx and in-game fonts - any proven methods? I use 3 sizes for fonts in my game: small, medium, and large. I take the base font size and attempt to scale the font based on screen size and density, but this is proving to be pretty hard.

Does anyone have a proven formula for scaling fonts? Right now I'm simply using the pixel width of the screen to put the device into 1x, 2x, and 3x font scale bucket sizes, but I feel like I should be using the screen density in the calculation as well.

sentences:
The most efficient and accurate game loop? Obviously for a game to work you need a game loop... Normally, my game loop would consist of something like this:

while(running){
    update();
    render();
    Thread.sleep(10);
}

This seemed to work fine at first, but then after I started to make my games a bit more complicated the frame rate of my game dropped by 90% in most cases, sometimes they would hang at around <10fps on a high spec system just by simply rendering a couple of 2D image. So I thought to myself: "Should I try putting the render loop on a different thead?". With that in mind, I made a system similar to this:

new Thread(new Render()).start();
new Thread(new GameLogic()).start();

private class Render implements Runnable{
    public void run(){
       while(running){
          render();
      }
    }

private class GameLogic implements Runnable{
public void run(){
   while(running){
      update();
      Thread.sleep(10);
  }
}
}
}

This then caused the graphics to become out of sync with the game update, which then caused the occasional jitter which got quite annoying, later on, I then discovered a use where there is no wait in the loop itself and everything runs as fast as it can, but then you multiply everything in the gameLogic by a deltaTime variable to ensure the game movement is solid. Basically I want to know which way of implementing a game loop is most efficient and whether or not you should render and do gameLogic on the same loop.

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 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:
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:
Determining how loud an AudioClip is I have some code that uses GetSpectrumData from an AudioSource playing a song to create a level layout for the player to play. I want to add a functionality where the players can upload their own songs and play the levels created with the data from these songs. Unfortunately, when comparing different audio files, I encountered this:

As you can see, the amplitude differs drastically from clip to clip, subsequently creating levels that are trivial to complete or almost impossible. I want to find a way to determine this "loudness" so I can tone it down or amplify it with a multiplier after getting the data from the song. Also, is there a way to extract this data without playing the song?

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:
LineRenderer sorting order - lines always in front of everything I have 3 cameras and 3 canvases.

Back Camera: depth = -5, Back Canvas: Sorting layer - BackLayer,
Camera: depth = 0, Middle Canvas: Sorting layer - MiddleLayer,
Camera: depth = 10, Front Canvas: Sorting layer - FrontLayer,

Orders in canvases are also set (for SpriteRenderers, images, ui etc.)

Back is for a background image and stars, middle for mountains and front for the UI. Everything is working perfectly with one exception:

No matter where I draw lines with a LineRenderer - they're always at the front of everything (each canvas).

The one situation where the line moves deeper is when I set it's points Z to some huge values like 30000 and then - they're just behind everything.

My goal is to place these lines along with the background image and stars on the BackLayer or BackCanvas.

What I've already tried:

Setting LineRenderer sorting layer and it's order from the code. I read somewhere on Unity forums that lineRenderer has to have a special material for this to work but I tried most of them - not working.
I also tried setting their positions manually, from the inspector, from the code, incrementally in the Update() method - they're always in front or complately hidden (with huge numbers mentioned above).
I tried assigning them to different canvases (back, middle, front) as children  didn't work too.

On Unity forums I also read a post which says that we shouldn't use sorting layers with linerenderer and use only Z positions.

If someone has any experience with this, I would be grateful. I really have no idea if I'm doing something wrong or what.

sentences:
Scrolling in 3d Shmup with 32Bit era effects How can I create a scrolling effect like in Ikaruga, where the background is on Rails and the foreground is fixed with the player in Unity?

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

Some more features would be:

Phases where the background scrolling is infinite: https://youtu.be/H6d0PkEPKSk?t=97
Transitioning from one background to another by changing the camera: https://youtu.be/H6d0PkEPKSk?t=57
Supporting side view, top down and starfox-like perpectives and changing between them seamlessly like in Asterbreed: https://youtu.be/c0-1RWnqoSk?list=PLPrREYqN5Wqa0Yvjq2YsTR8pgQXet5Lim&t=56
Being able to use the Unity Editor as Leveldesign tool liek in this tutorial:
https://pixelnest.io/tutorials/2d-game-unity/parallax-scrolling/

Also would I work with mesh, skybox and terrains to create a similar effect or would that be something like a Big Sphere/Cube and using textures diarama-like as they did back in the days of playstation 1 and saturn.

sentences:
Can I legally call ninja techniques "jutsus" in a game? I'm making a game inspired by the anime Naruto and I want to use the word jutsu, used in the anime to mean ninja techniques. Can I do that?

Does the answer change if I change the techniques' specific names, but use the same concept of the hand seals?

sentences:
How to understand huge code bases? I read about game loops, read tutorials of simple games like Asteroids and programmed them by myself. Nevertheless if I try to start reading code of a game with many many thousand lines of code, I have no clue at all where to start, what files to open first and which next to understand how it all work together.

My question is, are there any projects/tutorials out there, that gives a rookie some guidance (by example) how to start reading code of large open source game projects?

sentences:
How to transfer the player into a new scene, loaded in the background? I'm porting an old BuidBox 2 game to the Godot game engine. I already added all assets and scenes to the Godot project. The game is a 2.5D (isometric) endless runner. What I want now is to add a mechanism to load the next scene offscreen, remove the player's character from the current scene, and add it to the next scene seamlessly, without breaking the game physics or causing the player character to go behind or in front of other game objects that it's not supposed to.
For instance if I have this scenes:
Scene1
|-bg
|-player
└-fg

Scene2
|-bg
|-player
└-fg

I would like to load Scene2, remove player from Scene1 and replace player from Scene2 with the player node I removed from Scene1, without the player node changing its velocity or position abruptly in the physics world or appearing behind the bg node in Scene2 or in front of the fg node in Scene1.

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:
Enable SteamVR hand collision for when holding objects Just getting started on a game project with SteamVR in Unity. I've run into an issue with the collisions though. The hands and the objects that can be held collide with everything in the scene as they should. But when an object is picked up, the hand and the object stop colliding with everything.

How would I go about fixing this? I could leave it as is, but if an object is let go of inside another, it gets flung out of the object it was inside.

The other odd behavior happens after you let an item go. The hand that was holding it continues to not collide with anything until you move the hand away. After that it'll collide with everything normally again.

sentences: What does a Mesh consist of? I have seen various implementations of mesh loaders in a few open source game engines. But all of them behave meshes differently. Is there a general definition for a mesh that explains what meshes have, what a submesh is, skeletons etc. I still can not understand the difference between a 3d model and a 3d mesh.

sentences:
Component systems: No inheritance hierarchy at all, or a basic one? (I asked a similar question, but it had more questions inside it and I feel it wasn't clear enough, so I'm opening a new one).

Until recently I implemented all my games using an inheritance hierarchy. Those were simple games.

For example:

          Entity
          /    \
      Movable  Static
      /  \        /  \
    Orc  Mage   Tree  Wall

This worked for simple games.

However recently I read about 'entity component systems'. Using this approach, a class doesn't inherit from another class in order to receive functionality. Instead it is composed with it, which allows for more flexible designs.

My question is this:

I know that each component is a class (derived from a common base class).

However, there is one thing I don't understand: In the 'component system' approach, is there one class that all entities are instances of - and the only difference between entities is the components they contain?

For example: There is a class Entity. All entities in the game are instances of this class.

The only differences between them is that they are composed with different Component objects.

For example:

Component aiComponent = new AIComponent();
Component movementComponent = new MovementComponent();
Component physicsComponent = new PhysicsComponent();
Component rangedAttackComponent = new RangedAttackComponent();

Entity orc = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(movementComponent);
orc.addComponent(physicsComponent);

Entity shootingCastle = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(rangedAttackComponent);
orc.addComponent(physicsComponent);

As you can see, both orc and shootingCastle are instances of the Entity class. But they are composed with different components.

Is this how 'entity component systems' are supposed to be? No inheritance hierarchy at all? Or is there still a basic inheritance hierarchy, but most of the logic is inside components?

sentences:
Using an FBO texture and write to it I wanted to know if it's possible to use a texture of an FBO for post-processing and using that texture again for writing or do I need at least two textures?

I hope you understand what I mean.

sentences:
Is the 'partially checked' build sufficient to run the debug version of Direct3D 9? To run Direct3D 9 in debug, it is necessary to "install a 'checked' version of the OS".

The checked version of Windows comes in both full and partial flavors. It seems that the partial version is much less obtrusive to install than the full version. But, will that be sufficient to run Direct3D 9 in debug mode?

sentences:
Help on TileMapRenderer In my project, I'm trying to render a map using TileMapRenderer. But it doesn't show anything when I render it. But when I use some other files from a tutorial they are rendered correctly.

When debugging my TileAtlas instance shows the size as 0.

I have used Texture Packer UI for packing the images. Comparing with the tutorial's files, I can see that the index starts from 1 in my file and 0 in the tutorial. But changing it to 0 wouldn't work also.

map.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Map
  rotate: false
  xy: 0, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 1
Map
  rotate: false
  xy: 32, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 2
Map
  rotate: false
  xy: 64, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 3
Map
  rotate: false
  xy: 96, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 4
Map
  rotate: false
  xy: 128, 0
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 5

Here is the begining of the tmx file.

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="32" tileheight="32">
 <tileset firstgid="1" name="a" tilewidth="32" tileheight="32">
  <image source="map.png" width="256" height="32"/>
 </tileset>
 <layer name="Tile Layer 1" width="20" height="20">
  <data>
   <tile gid="2"/>
   <tile gid="2"/>

Apart from that the tutorial files and my files seems to be similar.

Can anyone help me here.

sentences: Is there a design flaw when an entity's state doesn't fully utilize enter(), execute() and exit()? I'm following Mat Buckland's Programming Game AI by Example, and I find that I don't always have use for enter(), execute() and exit() on an entity's state. For example, in an RPG, a weapon may have an equipped state, and I may use enter() and exit() for that state to add or subtract to a player's ability modifier, but there isn't really a need for execute(). Is this a design flaw in my engine, or a shortcoming of this approach?

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:
Unity, NavMeshAgent SetDestination acts funny I had a scene set as the following picture.

And a NavMesh baked as the following picture.

But my "player" (The left-bottom corner sphere) don't go where I want it want to go!

Test vedio

Source Codes:

public Camera cam;
public NavMeshAgent agent;
public GameObject particle;
// Update is called once per frame
private void Start()
{
    particle.GetComponent<Renderer>().material.color = Color.red;
}
void Update ()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if(Physics.Raycast(ray,out hit))
        {
            Vector3 v = hit.point;
            agent.SetDestination(v);
            Instantiate(particle,v,transform.rotation);
        }
    }
}

Could somebody please help me out!?

Much appreciated!!!

PS.

I found out through my "particle" that after first few hits, the "hit position" starts to "float"!

That's why my "particle" became bigger!

It doesn't "hit" the plane no more!

It always hit at somewhere above the plane!

That's why my "player" can NOT go to the destination!

Could somebody teach me how to fix it please!

Much appreciated!

sentences:
Why does my isometric rendering technique leave large gaps between tiles? I've followed tutorial after tutorial for converting from cartesian coordinates to isometric coordinates.

The cartesian behavior of my game works fine... that part is easy... For the most part, I can even get the isometric display to work, following along with the math I've found online. But it comes with some serious problems.

I use the following formulas in the getIso() functions:

isoX = (X-Y) - xOrientation
isoY = ((X+Y)/2) - yOrientation

I also apply the following transformation and draw each terrain square with its filter:

double axis = (double) GameWorld.GRID_SIZE;
transform.scale(1, 0.5);
transform.rotate(Math.toRadians(-45), axis, axis/2);
op = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);

It comes out looking like this when the terrain is drawn:

Each block should be neatly side-by-side. If I change the scale values (while maintaining the 2:1 ratio) then either the terrain image is clipped or they start to overlap one another, but it's never perfectly aligned. Here's the function I use to draw the terrain:

void draw(Graphics2D G)
{
    int x = world.getIsoX(xCoord, yCoord);
    int y = world.getIsoY(xCoord, yCoord);
    if (isVisible() == true) G.drawImage(op.filter(sprite.buffer, null), x, y, null);
}

sentences:
My sweep and prune is giving false positives My code is just giving false positives.
Every frame it reports an imaginary collision.

Here is my code

Sweep And Prune:

 public static void updateObjects() {

     List<BoundingBox> activeList = new LinkedList<>();
     boolean adding = true;
     for (BoundingBox box : axisList) {
        box.getOverlappingPairs().clear();
        if(adding) {
            activeList.add(box);
            adding = false;
        }else {
            for(BoundingBox e : activeList) {
                if(box.collides(e)) {
                    box.setOverlappingPairs(e);
                    System.out.println("COLLISION " + box + " : " + e);
                }else {
                    activeList.remove(box);
                }

Edit:

My AABB boxes are colliding with themselves.
I have debugged my classes and have narrowed it down to the sweep and prune class.

I would appreciate if someone would help me.

sentences:
What can I do to ensure that everyone can run my OpenGL game? I am currently learning OpenGL from here. That website teaches OpenGl 3.3 with GLSL 3.3 and says that it is best to learn those because they are well supported and that older versions work in a less efficient way.

So far, this has been going well, but, when I tried to get my OpenGl programs to run on my laptop with Intel HD Graphics 3000, I ran into issues with the lack of GLSL 3.3 support (glGetShaderiv() and such claim that GLSL 3.3 is unavailable. When I ignore these errors, anything beyond the background color isn't rendered).

I am learning OpenGl in order to create a video game for which my target market will contain many older non-gaming computers (in addition to users with brand-new GTX 1080s). It wouldn't surprise me if a few users were still on Windows XP. It is essential that I make sure that everyone can run my game without buying extra hardware. It is equally essential that it looks good on hardware that can support it. What single, non-deprecated graphics API is available on all hardware (using software emulation if needed) along with Windows, Mac, and Linux?

If no single such API is available, what can I do to ensure that my game will work properly everywhere while also taking advantage of new features when available without learning multiple APIs? I would strongly prefer to stay close to the hardware by avoiding higher level APIs such as Ogre3D. If to do this I need to learn multiple APIs, then, what are those and why hasn't the industry standardized this by creating an API then releasing drivers for old hardware?

Some possible solutions are:

A well-enough-performing software implementation of OpenGL 3.3 along with GLSL 3.3
A OpenGL 3.3 implementation that uses OpenGL 1.0 in the background that can be easily swapped out automatically at runtime if newer versions aren't directly available.
A simple to use older version of GLSL that allows me to load separate shaders as needed.

sentences: Frustum culling with an octree: one AABB per bone or one AABB per object? I've constructed an octree for use in frustum culling. The question is, should I insert an AABB for each bone of each object, or just the one AABB for the object?

sentences:
Rotate OpenGL quad around its center Sorry, I searched it but couldn't figure how to apply it to my code reading the other answers to similar questions. I what to rotate a quad, my code is the following:

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, player_texture);
glBegin(GL_QUADS);
    glColor4ub(255, 255, 255, 255);
    glTexCoord2d(0,0); glVertex2f(hero.xValue(), hero.yValue());
    glTexCoord2d(1,0); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue());
    glTexCoord2d(1,1); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue()+hero.hValue());
    glTexCoord2d(0,1); glVertex2f(hero.xValue(), hero.yValue()+hero.hValue());
glEnd();
glDisable(GL_TEXTURE_2D);

I'm not sure about how to use the glTranslatef function, I tell it what is the center of my object?

In that case it would be:
hero.xValue()+hero.lValue()/2 (x) and hero.yValue()+hero.hValue()/2  (y)

I know I have to use both glTranslatef and glRotate, by the way. When I try, setting glTranslatef with the values I mentioned above, I get a texture floating far from where the hero actually is.

Any help on this matter will be appreciated, thank you.

Obs: hValue = height, lValue = lenght

Edit: New information to show the changes I made after @user55564's comment:

I call init() once, on there I set basic openGL and SDL stuff, among them:

glViewport(0, 0, WIDTH, HEIGHT);
glMatrixMode(GL_MODELVIEW);

then I call my draw function, it has in it:

while (running) {
    glLoadIdentity();

.
. stuff non-related to drawing
.

glClear(GL_COLOR_BUFFER_BIT);
    glClearColor(0, 0, 0, 0);
    glPushMatrix();
    glOrtho(0, WIDTH, HEIGHT, 0, -1, 1);

    // draws the player
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, player_texture);
    glTranslatef(hero.xValue(), hero.yValue(), 0);
    glRotatef(0, 0, 0, 1);
    glTranslatef(-(hero.xValue()+hero.lValue()/2), -(hero.yValue()+hero.hValue()/2), 0);
    glBegin(GL_QUADS);
        glColor4ub(255, 255, 255, 255);
        glTexCoord2d(0,0); glVertex2f(hero.xValue(), hero.yValue());
        glTexCoord2d(1,0); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue());
        glTexCoord2d(1,1); glVertex2f(hero.xValue()+hero.lValue(), hero.yValue()+hero.hValue());
        glTexCoord2d(0,1); glVertex2f(hero.xValue(), hero.yValue()+hero.hValue());
    glEnd();
    glDisable(GL_TEXTURE_2D);
    glPopMatrix();

// then I use pushmatrix again to draw the enemies and the health bars of both enemies and player (these don't need rotation);
glPushMatrix();
    glOrtho(0, WIDTH, HEIGHT, 0, -1, 1);
.
.
.

sentences:
What happened to procedurally generated textures? I recall some time ago that procedurally generated textures were becoming a big deal that a lot of people/companies were really interested in with some serious benefits (smaller deployments, potentially faster loading, higher quality, scalable textures, potentially cheaper to produce, etc.).

From what I can tell, the buzz is dead and no games on my radar are using them. What happened?

I was hoping I'd see procedural textures go the way that NaturalMotion's stuff has (slow but steady adoption).

sentences:
Placing tiles on 2D Simplex noise I have been experimenting with 2D Simplex noise for a mini-project and while I cannot say I understand the maths behind it, I begin to feel quite confident with how I can manipulate it to get different types of output.

While noise generation/algorithms/manipulation are quite easy to find, I am having trouble finding any good resources on the next step, i.e. placing 2D tiles based on the noise output (for the purpose of making some kind of 2D terrain).

I realize a crude and simple way would be to just loop through my array and place a tile on every coordinate where the noise value is above a certain point, but the output would look very rough, tiles would be overlapping each other, etc.

Does anyone have any good resources or information to share on this subject?

Thanks,

sentences: Shipping images with a C++ program I've done hobby development in Java for a couple of years now, and I've just started learning C++. I understand syntax fairly well, but I'm extremely confused as to many structural facets of a typical program, namely shipping images/textures with the executable. Do I extract them to a data directory? Or do I encode them into the executable? And if the latter is the case, how do I include them in the compilation process? I'm sorry to ask such a basic question, but I'm having a particularly hard time finding the answer on Google.

sentences:
Replacing UI GameObjects with Scriptable Object script In my game I'm trying to make a series of mock web pages. To make it easier, I thought I'd make all the webpage UI into Scriptable Objects and have a game manager script determining what content to display on the UI. However, I'm doing a small test that isn't going as planned.

Because the content, style, and layout of each page may be quite different, I decided to make a webpage-styled template and have the content manager switch out scriptable object properties as a GameObject so that it takes everything that will be in the prefab. This doesn't seem to be working and I'm not sure what I'm doing wrong.

For now, I'm just testing this method with a very basic script. It's not changing the main content as a GameObject, though it is doing it on my tab textmesh property. It seems to have an issue with transplanting a prefab into the defined content space, but no errors are popping up. I'd appreciate some advice here.

Web Content Scriptable Object Script:

using UnityEngine;
using UnityEngine.UI;

[CreateAssetMenu]
public class WebContent : ScriptableObject
{
    public string tabTitle; //WebPage Title
    public GameObject canvasContent; //Web Page UI Content I want to change via prefab attached to a  Scriptable Object
}

Content Display Script:

using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class ContentDisplay : MonoBehaviour
{
    public WebContent content;
    public TextMeshProUGUI TabName;
    public GameObject mainContent;

    // Update is called once per frame
    void Update()
    {
        TabName.text = content.tabTitle.ToString(); //This works
        mainContent = content.canvasContent; // This doesn't work

    }
}

sentences:
Orthographic Camera Movement inside Rotated Boundary Rectangle Weird Behaviour [Unity3d] Basically I have an orthographic camera that is looking at a simple square. The camera is sitting above the square and tilted by x: 45° and y: 45°, so the camera sees the square as a rhombus / diamond shape.
I want the camera to be moveable within a rectangular boundary that appears to be leveled with the camera, so it would need to be rotated by 45° around the y-axis (up-vector in Unity) in World-coordinates. I already figured out the math to constrain the camera to this shape, but there is a weird thing going on when the movement gets clipped: The camera doesn't follow the outline perfectly, but in a rounded shape (see screenshot). Could this be due to a rounding error? Code snipped below.

using System;
using UnityEngine;
using static UnityEngine.Mathf;

public class InputController : MonoBehaviour
{
    private const float CamHeight = 10f;
    [SerializeField] private GameObject gameBoard;
    [SerializeField] private GameObject camBounds;
    [SerializeField] private float camBoundRadius = 5f;
    private Vector3 _camOrigin;
    private MeshCollider _collider;
    private Vector3 _difference; // Change in position of mouse relative to origin
    private Camera _mainCamera;
    private Vector3 _origin; // Place where mouse is first pressed
    private Plane _worldPlane;

    private void Start()
    {
        _mainCamera = Camera.main;
        if (_mainCamera is null) throw new Exception("No main camera could be found!");
        // Set the camera so that the board is always in the center
        _camOrigin = new Vector3(
            -CamHeight / Sqrt(2f),
            CamHeight,
            -CamHeight / Sqrt(2f));
        _mainCamera.transform.position = _camOrigin;
        _collider = gameBoard.GetComponent<MeshCollider>();
        _worldPlane = new Plane(Vector3.up, 0); // For dragging the camera around
    }

    private void LateUpdate()
    {
        if (Input.GetMouseButtonDown(0)) _origin = MouseWorldPosition();
        if (Input.GetMouseButton(0))
        {
            _difference = MouseWorldPosition() - transform.position;
            var newPos = _origin - _difference;
            var absDiff = newPos - _camOrigin;

            var angle = Angle2Pi(Vector3.right, absDiff);
            var constraint = SawTooth(angle);

            if (absDiff.magnitude < constraint)
                transform.position = newPos;
            else
                transform.position = _camOrigin + absDiff.normalized * constraint;
        }
    }

    private Vector3 MouseWorldPosition()
    {
        var clickedPoint = Input.mousePosition;
        var ray = _mainCamera.ScreenPointToRay(clickedPoint);
        var worldPos = Vector3.zero;

        if (_worldPlane.Raycast(ray, out var raycastHit)) worldPos = ray.GetPoint(raycastHit);

        return worldPos;
    }

    private float SawTooth(float theta)
    {
        var x = 4f / PI * camBoundRadius * (1f - 1f / Sqrt(2f));
        x *= Abs(theta % (PI / 2f) - PI / 4f);
        x += camBoundRadius / Sqrt(2f);
        return x;
    }

    private static float Angle2Pi(Vector3 from, Vector3 to, Vector3 normal = default)
    {
        if (normal == default) normal = Vector3.up;

        var angle = Vector3.Angle(from, to) * (PI / 180f);
        var sign = Sign(Vector3.Dot(normal, Vector3.Cross(from, to)));
        angle = 2f * PI - angle * sign;

        return angle;
    }
}

sentences:
Project rotated matrix to isometric coordinate I have a group of soldiers, and each has a vector describing their position in the squad. When the group rotates, I do this math to calculate the desired position of each soldier.

var unitPositions : Array<CGPoint> = []

let cosRadian = cos(rotation)
let sinRadian = sin(rotation)

for var index = 0; index < self.positions.count; ++index {

    // Find the vector for this unit, translate it, then store it
    let targetVector = self.getVectorAtPosition(index) - translate
    let newX  = targetVector.dx * cosRadian - targetVector.dy * sinRadian
    let newY = targetVector.dx * sinRadian + targetVector.dy * cosRadian

    unitPositions.append(CGPoint(x:newX, y:newY))
}

This produces the following result:

The problem with this is that units in an isometric world facing south east should match up with the reference grid. So the next step was to add a multiplier. In the loop above, I changed it to:

    let isoX = newX * 1.414213562373095;
    let isoY = newY

    unitPositions.append(CGPoint(x:isoX, y:isoY))

This produced closer results:

But, it's still not 100% accurate. So, right now I'm going through and trying to get my fundamentals of math, matrices, vectors, etc all figured out in hopes of producing this desired result:

I would love any pointers on what I should be searching for, as right now it is all a bit overwhelming. Thanks much!

UPDATE

Due to the awesome comment by @DMGregory, here are my findings:

If I want to "hack" this and continue to use screen coordinates, I can do so using 1.414213 (the magic number found here) combined with your true isometric projection.

let isoX = newX * 1.414213562373095
let isoY = newY * (1.414213562373095 * 1/sqrt(3))

That will produce:

That approach will work, but won’t solve everything else you mentioned (i.e: units will move faster when going certain directions). To handle that, creating the original formation with isometric vectors, and then just rotating that matrix will produce the same results. So, it looks like I have a lot of work converting my game calculations and coords to default as isometric coordinates. Thanks again!

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:
Why / how does XNA's right-handed coordinate system effect anything if you can specify near/far Z values? I am told repeatedly that XNA Game Studio uses a right-handed coordinate system, and I understand the difference between a right-handed and left-handed coordinate system.  But given that you can use a method like Matrix.CreateOrthographicOffCenter to create your own custom projection matrix, specifying the left, right, top, bottom, zNear and zFar values, when does XNA's coordinate system come into play?

For example, I'm told that in a right-handed coordinate system, increasingly negative Z values go "into" the screen.  But I can easily create my projection matrix like this:

Matrix.CreateOrthographicOffCenter(left, right, bottom, top, 0.1f, 10000f);

I've now specified a lower value for the near Z than the far Z, which, as I understand it, means that positive Z now goes into the screen.  I can similarly tweak the values of left/right/top/bottom to achieve similar results.

If specifying a lower zNear than zFar value doesn't affect the Z direction of the coordinate system, what does it do?  And when is the right-handed coordinate system enforced?

The reason I ask is that I'm trying to implement a 2.5D camera that supports zooming and rotation, and I've spent two full days encountering one unexpected result after another.

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:
Game Server on Windows Azure What do you guys think of using Windows Azure for deploying a custom built game server. It's being built in C#, and I want to get a few things down before stretching too far into the project.

I like the idea of being scalable, but I also know that I will never get to the scale of anything to the scale of WOW, or something quite as big. It will just be an interesting journey to test something like this.

So, will Windows Azure work for that, or is there any other services that can provide something like that?

sentences:
Hardware for iPhone 2d games development Do I need the cutting edge MacBook Pro or iMac for 2D games development?

Would a iPod touch (with Wi-Fi support) do instead of a full-fledge iPhone?

sentences:
Why does SDL_RenderCopy result in a blank screen? I'm trying to render a texture(picture), but SDL_RenderCopy keeps the window's background black.

Here's the relevant code:

SDL_Rect rect; rect.x = 0, rect.y = 0;
while(!quit)
{
    SDL_RenderCopy(g_renderer, g_texture, NULL, &rect);
    SDL_RenderPresent(g_renderer);
    // Window stays dark although i've rendered via RenderCopy
    SDL_Delay(500);

    while(SDL_PollEvent(&event) != 0)
    {
        if(event.type == SDL_QUIT)
            quit = true;

        else if (event.type == SDL_KEYDOWN)
            move_picture(event.key.keysym.sym, rect);
    }
}

If I change the SDL_RenderCopy function call to:

SDL_RenderCopy(g_renderer, g_texture, NULL, NULL);

The picture is visible in the center of the window, but its not the result I'm looking for, as I would want the image to render to the position I set to my rectangle.

After a couple of searches I've found that this is a known behavior.
I've tried changing the way I'm loading a texture from CreateTextureFromSurface to IMG_LoadSurface, but the rendering still doesn't work.

sentences:
Unity - SetLookAtPosition() - Body Jittering? I'm working on a third person controller and I'm trying to make character look at the same point as the camera. The problem is that the character jitters all the time the SetLookAtPosition() starts working. Here is a pic:

Everything works great if don't call the LookAt function. Even commenting all the other code on FixedUpdate() and Update() functions the problem remains. The code goes like this:

void FixedUpdate()
{
    // Commented Code

    // Movimiento de Cabeza
    HeadOrientation();
}

private void HeadOrientation()
{
    animator.SetLookAtPosition(animator.GetBoneTransform(HumanBodyBones.Head).position + gameCamera.transform.forward);
    animator.SetLookAtWeight(1f, .4f, 1f, 1f, .8f);
}

Hope someone knows what's happening. Thanks and sory for my bad english!

After trying differents things, it seems that the SetLookAtPosition() function needs to be call in the Update() function, not in the FixedUpdate().

I would appreciate if someone could explain why it needs to be like this.

sentences:
shadowing billboards I have a lot of billboarded 3D spheres (they have a heightmap so work properly with depth and penetration; although each is made of just a quad (with slight distortion), they look and feel and are true 3D spheres): http://www.youtube.com/watch?v=88idbFlvQV0

The choice of using billboards is for throughput on low-end hardware.

How can I effectively cast shadows from these?  It occurs to me that using proper shadow-volumes will take a lot of fill-rate and complexity.  I am fill-rate sensitive.

I was wondering if there is any way to billboard the shadows cast by my billboards?

sentences:
How to use model matrix with integer coordinates I'm trying to generate a real-sized planet with WebGL. After researching, I came to the conclusion that the best way to get around 32-bit float precision issues (since GPUs don't support double precision) is to use 64-bit integer coordinates. I would generate these coordinates on the CPU, then send them as integers to the GPU. After that, I would get the position of the vertices relative to the camera by doing:

vertexPosition-cameraPosition

Since the result is small, I can now safely convert to 32-bit floating point and render it. All was good until I realised that since the coordinates are large integers, I can't multiply them by a model matrix if I want to rotate the planet around it's center since the floating point coordinates are no longer relative to the planet's center.

Is it possible to scale the model matrix by a large value, then convert it to integer, multiply by the position, and then divise by that same large value? I know there is a solution but I can't find it.

Thanks

sentences:
Fragment shader for lighting in isometric perspective What I'm trying to do is to achieve basic lighting in 2D from an isometric perspective.

Here I have 2 textures that are used as tiles for the ground:

Color:

Normal map:

I have a fragment shader that was adjusted a bit to my needs, but mostly made from this tutorial: https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6

Here is my fragment shader:

uniform sampler2D texture;
uniform sampler2D normal_texture;

//values used for shading algorithm...
uniform vec2 Resolution;      //resolution of screen
uniform vec4 AmbientColor;    //ambient RGBA -- alpha is intensity

uniform vec3 LightPos[3];        //light position, normalized
uniform vec4 LightColor[3];      //light RGBA -- alpha is intensity
uniform vec3 Falloff[3];         //attenuation coefficients

void main()
{
    vec4 DiffuseColor = texture2D(texture, gl_TexCoord[0].xy);

    vec3 NormalMap = texture2D(normal_texture, gl_TexCoord[0].xy);

    vec3 Sum = vec3(0.0);
    for (int i = 0; i < 3; i++) {
        //The delta position of light
        vec3 LightDir = vec3(LightPos[i].xy - (gl_FragCoord.xy / Resolution.xy), LightPos[i].z);

        //Correct for aspect ratio
        LightDir.x *= Resolution.x / Resolution.y;

        //Determine distance (used for attenuation) BEFORE we normalize our LightDir
        float D = length(LightDir);

        //normalize our vectors
        vec3 N = normalize(NormalMap * 2.0 - 1.0);
        vec3 L = normalize(LightDir);

        //Pre-multiply light color with intensity
        //Then perform "N dot L" to determine our diffuse term
        vec3 Diffuse = (LightColor[i].rgb * LightColor[i].a) * max(dot(N, L), 0.0);

        //pre-multiply ambient color with intensity
        vec3 Ambient = AmbientColor.rgb * AmbientColor.a;

        //calculate attenuation
        float Attenuation = 1.0 / (Falloff[i].x + (Falloff[i].y*D) + (Falloff[i].z*D*D));

        //the calculation which brings it all together
        vec3 Intensity = Ambient + Diffuse * Attenuation;
        vec3 FinalColor = DiffuseColor.rgb * Intensity;

        Sum += FinalColor;
    }

    gl_FragColor = gl_Color * vec4(Sum, DiffuseColor.a);
}

This shader WORKS with traditional 2D perspective. That's because in traditional perspective the ground tiles normal map would have a color scheme closer to something like this, just wouldn't be tilted to fit an isometric perspective of course.

The issue: How do I go about adjusting the math in my fragment shader to fit an isometric perspective and work with the "greenish" ground normal maps.

Here's what I'm currently getting with this shader. Light should be equally going in all directions, but it's as if it's going down a slope.

sentences: what is the difference between CCSprite and a PhysicsSprite? I am new to Cocos2D and I've realized that most of the codes written before the Cocos2d update used CCSprites. Recently I realized a lot of more recent codes after the update are using PhysicsSprite. What is the difference? What advantages does one have over the other, if any?

sentences:
SFML game only runs smooth at high framerate (Windows 10) I am trying to make my game smooth on low and high fps. Right now, it only runs smooth when I don't limit the framerate. If I run it at 60, then my sprite is noticeably "sluggish". I believe this happens because of the FPS spikes like crazy. It goes from 20-65 FPS and sometimes to the thousands.

I tried to implement a fixed timestep as per this tutorial: http://gafferongames.com/game-physics/fix-your-timestep/, which made it better. However, you can still notice that it is not smooth if the framelimit is limited.

So it only runs smooth like this:

window.setFramerateLimit(0);
window.setVerticalSyncEnabled(false);

Otherwise, it doesn't.

I do believe, though, this is only being caused on Windows 10. I had someone try it on their Linux machine with a Nvidia graphics driver and they said it ran smooth even with a framelimit. I have a Nvidia graphics driver as well but my OS is Windows 10.

Here's the code:

Game.h: https://gist.github.com/anonymous/4dce9df0ee983016466f19d4fd43940d

Game.cpp: https://gist.github.com/anonymous/9724aa1336c231b3cf96b726316ba14b

Player.h: https://gist.github.com/anonymous/610ffaecdd85c741058afec32eace912

Player.cpp: https://gist.github.com/anonymous/cf0a6e3e7ffaeaa39088a6e92c069556

Whole project (6 files with code): https://dl.dropboxusercontent.com/u/735021/Spritesheet.zip

Any help would be appreciated! Thank you!

sentences:
Python mini RPG enemy movement. (how to have two infinite loops running at the same time) I have a problem with my RPG.

I want enemies to wander randomly. So I put:

enx_speed = random.randint(-2, 2)
eny_speed = random.randint(-2, 2)

in the main loop (while true:).
However, that loops every 20 milliseconds (it's what I use to redraw, find key presses, etc).

How can I have two infinite loops running at the same time with different loop times?

sentences:
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: How does Unity store references to GameObjects in a scene A Monobehaviour can have references to GameObjects in the same scene, but Prefabs, ScriptableObjects can't reference GameObjects in a scene. While  Assets, Objects and serialization  covers references to assets, i.e. actual files, it doesn't explain how references to scene objects work. But it has to be some kind of serialization, for example, do they also consist of a GUID part and a local id part when serialized?

sentences:
Why is my partially transparent image blitted fully opaque? I have a part in my program that should display the currently playing song's name for the first 4 seconds, then fade out. Even though Surface.get_alpha() returns expected results, the image still does not fade out.

Why is this? How can I make it work?

My code looks like this:

for event in settings.events:
    if pygame.mixer.music.get_pos() < 4000 and sounds.music.volume != 0:
        #This part creates the surface and determines the position
        show = 40 * 4
        font = pygame.font.SysFont(typeface, 15)
        songname = font.render(sounds.music.playlist[0], True, settings.color)
        font_pos = songname.get_rect()
        font_pos.right = screenx - 10
        font_pos.top = 10
        alpha = 255
    if event.type == USEREVENT + 1 and sounds.music.volume != 0:
        #The userevent is there to ensure it will fade out with the same speed
        #and not being related to fps
        #this decreases alpha
        show -= 1 if show > 0 else False
        if show < 40 * 4 and alpha > 0:
            alpha -= 1.6
        songname.set_alpha(int(alpha))

if pygame.mixer.music.get_volume() != 0.0 and show != 0:
    #This does actually return the correct results
    print songname.get_alpha(), alpha
    screen.blit(songname, font_pos)

sentences:
UE4 - Render grid decal per pixel on GPU or all at once on CPU? Using UE4 version 4.25.3, I am trying to project a 2D cartesian grid onto a landscape. The grid is currently just a series of black-bordered squares, but I am planning on adding an abundance of color effects to the grid cells based on movement and location of actors among other things. I need to communicate the location of the actors in question to the shader so that the material can update accordingly, but the only way I have found to be able to pass that information efficiently (it will eventually be used to pass location information for up to maybe 50 actors every tick, so I do not think using a bunch of constant vector parameters is a good idea here) is to use a texture that I build myself on a 2D canvas in CPU-bound code with this information encoded into it, and pass that to the shader as a texture parameter. I realized though that with just the location information available to the material, it is going to add a fair chunk of extra math per-pixel to the shader, though mostly just addition, multiplication, and division. Since I am already passing a texture to the shader, I could just compute the entire grid texture on the CPU with desired color and effects on specific cells using constant-complexity modular math, as opposed to checking extra conditions on every pixel. My intuition is that this technique of building the texture on the CPU will perform better frame-to-frame and will overall simplify the process of updating the look of cells on the grid with simple effects, but my question is really how many extra instructions per pixel do I need to see in a shader before I start to realistically need to worry about GPU performance? The TL;DR of the difference is that:

Computing on the CPU is constant time, just scale line segments by the cartesian coordinate of the cell to draw over the borders as I desire
Computing on the GPU is no longer constant because I have to check conditions against world location on top of addition and division operations on every pixel, but because GPUs are designed for this already it may just not be that much of an issue.

Which way should I go here? In general, I would like to try to set a precedent strategy when I have to pick between delegating work to the CPU vs the GPU - which one should I try to delegate the most to first as I continue to add more complex logic to my shaders and how those computations are tied to states of other actors?
Sidenote:
I had considered the method of passing a texture as a parameter before, and I decided to go that way after seeing a similar method on the UE forums that seemed to work out well for the user.
Though it does not quite answer the question, if there is a better way of delivering a variable-length array to a material as a parameter than passing a texture sample, then I would probably just go with whatever that alternative is and forego dwelling on the conundrum upon which this question seeks counsel.

sentences:
Directional light shader not behaving as expected I coded my first glsl shader which manage diffuse and specular effects of a directional light.
This is the fragment shader.
#version 120

//matrix
uniform mat4 model_matrix;

//directional light position in world coordinates
uniform vec3 light_position;
uniform vec3 eye;

//send to fragment shader
varying vec4 color;
varying vec4 normal;
varying vec4 vertex;

void main()
{

    float light_diffuse_intensity;
    float light_specular_intensity;
    float light_mod;

    vec3 world_normal;
    vec3 world_vertex;
    vec3 world_reflec;
    vec3 vertex_to_light;
    vec3 vertex_to_eye;

    world_normal = (model_matrix * normal).xyz;
    world_vertex = (model_matrix * vertex).xyz;

    vertex_to_light = light_position - world_vertex; //vector from vertex to light
    vertex_to_eye = eye - world_vertex; //vector from vertex to eye
    world_reflec = 2 * dot(vertex_to_light, normalize(world_normal.xyz)) * normalize(world_normal) - vertex_to_light; //reflection of vertex_to_light

    light_diffuse_intensity = dot(normalize(vertex_to_light), normalize(world_normal.xyz)); //computing angle between light and normal
    light_specular_intensity = dot(normalize(vertex_to_eye), normalize(world_reflec)); //computing angle between eye and reflection

    if (light_diffuse_intensity > 0){
        light_mod = light_diffuse_intensity;
        light_specular_intensity = pow(light_specular_intensity, 8.0);
    }
    else{
        light_specular_intensity = 0;
    }

    gl_FragColor = vec4(mix(color.rgb * light_diffuse_intensity, vec3(1.0,1.0,1.0), light_specular_intensity), 1.0);

}

As you can see from the screenshot below, in the first screen, where I look at the sphere from the direction of the light, the border of the sphere is white because of the specular effect. However if the shader were correct it should not look like that. It should be white only in the middle of the sphere.
In the second screen, I look at both the sphere and the source of the directional light (the yellow sun) and everything looks just fine.
I cannot find the error in my shader, could someone help please?
Thank you very much!

sentences:
Transparent objects in the scene only get lit half way by point light I have encountered a weird graphics problem, where all of our transparent objects in the scene only get lit half way (only from the y position downward) by a point light. This happens with all of our grass and tree shaders.
Also, when looking through translucent objects, they become really desaturated and gray-is which is an undesired effect.
Does anyone know how to deal with this problem? Please refer to the screenshots below.
I'm are using Unity 2020.1.14f, built-in render pipeline with a forward renderer.
For grass and trees we are using the Fantasy Adventure Environment, but all other grass shaders from other packages have the same problem.

sentences:
How to reapply force applied to one object to another object Edit: While I wasn't able to make the code work completely, I believe my question has been sufficiently answered.

I want to make two objects move, react to collisions and other stuff as if they were one.

For example, Objects A and B are entangled.

When Object C rams into Object A and starts moving with it, Object B should start moving with it. When Object B hits a wall, Object A should act like it also hit a wall.

I tried changing position/speed every frame, but this only works when done in one direction.

Now, I want all forces applied to any of the objects to also apply to the other objects entangled to it.

EDIT: The next step is making the thing work with one of the objects moving along a different axis(e.g. the opposite direction of the others) and at a different scale (e.g. speed is proportional to size). So fixed joints, while a working solution for the simplified version of the problem, don't work for me.

UPDATE: Here's the code so far, trying to figure out how to send the other object spinning in the same way as the first one, not sure how to set the position for the force(s?) applied

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

[RequireComponent(typeof(Rigidbody))]
public class EEScript : MonoBehaviour
{
    public List<GameObject> activeObjects;

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

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

    private void OnCollisionStay(Collision collision)
    {
        OnCollisionEnter(collision);
    }

    private void OnCollisionEnter(Collision collision)
    {
        Rigidbody rigidbody = gameObject.GetComponent<Rigidbody>();
        foreach (GameObject obj in activeObjects)
        {
            Rigidbody rb = obj.GetComponent<Rigidbody>();
            if (rb is null || rb.gameObject==gameObject) continue;
            Debug.Log(collision.gameObject.name+"->"+obj.name);

            for (int i = 0; i < collision.contactCount; i++)
            {
                ContactPoint co = collision.GetContact(i);
                Vector3 relativePoint = co.point - rigidbody.centerOfMass;
                Vector3 normal = co.normal;
                Vector3 impulse = collision.impulse;
                if (Vector3.Dot(normal, impulse) < 0f) impulse *= -1;
                rb.AddForceAtPosition(impulse, relativePoint + rb.centerOfMass, ForceMode.Impulse);
            }
        }
    }
}

sentences:
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:
Box2d on authoritative server for Unity client I'm creating a multiplayer platform and shooting game in unity, using unity2d's own physics system (box2d).
But the truth is that I am quite lost in the creation of an authoritative server in c ++.
I have quite clear and experience in the use of socket for communication between client and server, I do not know how to approach the issue of simulating the physics of my game on the server so that it decides the positions/movements of the clients.
Can anyone guide me to use box2d on the server, as I simulate the game on the server? Is this a good option or would it be better to implement my own game physics than to use the non-deterministic engine?
Thank you very much and sorry for my level of English

sentences:
How to properly transform vertices for a model loaded using Assimp? When I try to load a DAE model then vertices are not placed correctly. Here's the code snippet I use to load 3D models using Assimp  :

aiNode* CGameObject::findNode(aiNode* rootNode, const char *name) {
    if (!strcmp(name, rootNode->mName.data)) {
        return rootNode;
    }
    for (int i = 0; i < rootNode->mNumChildren; i++) {
        aiNode *found = findNode(rootNode->mChildren[i], name);
        if (found) {
            return found;
        }

    }
    return NULL;

}

void CGameObject::transformNode(aiMatrix4x4 *result, aiNode* rootNode) {
    if (rootNode->mParent) {
        transformNode(result, rootNode->mParent);
        aiMultiplyMatrix4(result, &rootNode->mTransformation);
    } else {
        *result = rootNode->mTransformation;
    }
}

Assimp::Importer importer;
    const aiScene* scene = importer.ReadFileFromMemory(buffer,
        size,
        aiProcess_CalcTangentSpace      |
        aiProcess_Triangulate           |
        aiProcess_JoinIdenticalVertices |
        aiProcess_GenUVCoords   |
        aiProcess_TransformUVCoords |
        aiProcess_FlipUVs |
        aiProcess_SortByPType);

    if (!scene) {
        return false;
    }

    const int iVertexTotalSize = sizeof(aiVector3D) * 2 + sizeof(aiVector2D);
    int iTotalVertices = 0;

    for(int i = 0; i < scene->mNumMeshes; i++) {
        _Mesh* m = new _Mesh;

        aiMesh* mesh = scene->mMeshes[i];

        aiNode* node = findNode(scene->mRootNode, mesh->mName.data);
        transformNode(&node->mTransformation, node);
        aiTransposeMatrix4(&node->mTransformation);

        int iMeshFaces = mesh->mNumFaces;
        for (int f = 0; f < iMeshFaces; f++) {

            const aiFace* face = &mesh->mFaces[f];

            for (int k = 0; k < 3; k++) {
                int vertexIndex = face->mIndices[k];
                iTotalVertices++;
                aiVector3D pos = mesh->mVertices[vertexIndex];

                aiTransformVecByMatrix4(&pos, &node->mTransformation);

                m->vertices.push_back(pos.x);
                m->vertices.push_back(pos.y);
                m->vertices.push_back(pos.z);
    ...

What am I doing wrong ? I will create a VBO for all the vertex positions later and render them.
When I load an OBJ model everything loads fine and there is no need for applying per-node transformations.

Also, I noticed that Assimp renames node names from "Cube.001" to "Cube_001", is this behavior normal/expected.
I'm using Assimp 3.1.1.

sentences:
android game: how to approach mutliplayer I'm making a single player game that is near completion, and I am already starting to think about giving the game multiplayer.  The multiplayer would basically be finding someone to play against, likely in a waiting room or just have a match-making function, and then having a pokemon style battle between the people in real time.  I think it would be relatively simple as I'm just sending information about each attack(move chosen and damage) and what it did back and forth, but I'm not sure what resources to consult for this.  I am very new to Android/Java development and really just learning as I go.

I have heard a bit about Skiller, but I'm still unfamiliar with using other SDK's and how easy it may be.  Does anyone have any suggestions as to what SDK's or methods for accomplishing this.  I currently have no money to spend on software development, but I'd like to get started on learning how to do this.

sentences:
GLUT multiple windows FPS drop sharply When only the main window is created, the fps is able to reach above 1000.However creating 1 more window, resulted in the fps dropping significantly down to about 100. The draw callback draws a blank black screen  and writes the fps onscreen.

Q1) What is the reason behind the sharp drop in fps?
Q2) Any possible ways to improve on this fps?

int main(void){
        int mainwindow,otherwindow1;
        glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);

        glutInitWindowSize(640,480);// set the initial window  size
        glutInitWindowPosition(0,300);//set the initial window position

        mainwindow = glutCreateWindow("main window");
        glutDisplayFunc(Draw);

        glutReshapeFunc(ChangeWindowSize);

        otherwindow1 = glutCreateWindow("Other window");
        glutDisplayFunc(Draw);
        glutReshapeFunc(ChangeWindowSize);

        setVsync(0);

        glutMainLoop();
}

void Draw(){
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    getFPS();

    glutPostRedisplay();
    glutSwapBuffers();
}

sentences:
How to check whether an angle lies within a specific negative to positive range? I'm trying to develop a script that detects if an object's angles are tilting too much.

I am new to Unity, and I am sure this is not the best way to test an object's angles, but I am trying to learn C# so I'd rather figure that out myself.

All I want to know is how to check whether a value is between -101 and 101.

I have tried this so many different ways, and even though it is working fine for positive integers, the if statement is not applying the moment that my z angle becomes negative.

Here is what I have tried so far:

(maxangle = 101, minangle = -101)

if(Player.transform.rotation.eulerAngles.z > Mathf.Sign(-101) &&
Player.transform.rotation.eulerAngles.z < maxangle),

if(Player.transform.rotation.eulerAngles.z > minangle &&
Player.transform.rotation.eulerAngles.z < maxangle)

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:
How to determine if an object is within field of view given xyz of object, player position, and 3D vector for player view? I only have the object's position, the player position, and the vector representing the player's view, and I have the FoV (120 degrees horizontal/60 on each side, and 60 degrees vertical/30 on each side).

As I'm dealing with data that has already been recorded, I cannot use any Unity built-in functions and have to calculate it manually. My thoughts were to convert the 3D coordinates into 2D vectors, so that I can calculate if an object is in the horizontal plane first (by taking the X and Z values) and then if it is, check if it is in the vertical plane (take the Y and Z coordinates).

After, I calculate the the angle between the object and the player view to see if the absolute value of that is within the field of view (for example, if the object is on the left side of the player view, and the horizontal FOV is 120 degrees, then if the absolute value of the angle is less than or equal to 60 degrees it is within view).

Is this on the right track? I've been getting strange results (like only one of the four objects I'm looking for shows as visible throughout a log of values even though they should all at some point be visible).

Here is some code to show what I'm doing:

    public static Double angle(Vector2D obj, Vector2D bodyPos, Vector2D headDir) {

    Double result = 0.0;

    // Get the vector between the body position and the object
    Vector2D temp = Vector2D.subtract(obj, bodyPos);

    // First find dot product
    Double dotProduct = Vector2D.dotProduct(headDir, temp);

    // Now find the length of each vector and get the product of them
    Double lengthProduct = Vector2D.vectorLength(headDir)*Vector2D.vectorLength(temp);

    // Find the intermediary result
    result = dotProduct / lengthProduct;

    // Apply arc cos to find the angle between the vectors
    result = Math.acos(result);

    // Convert angle to degrees
    result = (result * 180)/Math.PI;
    System.out.println("The angle is: " + result);

    return result;
}

And here is the code that determines if something is in view by using that angle function:

    public static boolean isInView(bodyPosition objPos, bodyPosition bodyPos, headDirection headDir){

    boolean inView = false;

    Double h_angle = 0.0;
    Double v_angle = 0.0;

    // Create 2D vectors for both the horizontal and vertical FOV measurements
    Vector2D h_objPos = new Vector2D(objPos.getDirectionX(), objPos.getDirectionZ());
    Vector2D v_objPos = new Vector2D(objPos.getDirectionY(), objPos.getDirectionZ());

    Vector2D h_bodyPos = new Vector2D(bodyPos.getDirectionX(), bodyPos.getDirectionZ());
    Vector2D v_bodyPos = new Vector2D(bodyPos.getDirectionY(), bodyPos.getDirectionZ());

    Vector2D h_headDir = new Vector2D(headDir.getDirectionX(), headDir.getDirectionZ());
    Vector2D v_headDir = new Vector2D(headDir.getDirectionY(), headDir.getDirectionZ());

    // determine angle of FOV+
    Double iHFOV = FOV_H_MID * 0.5;
    Double iVFOV = FOV_V_MID * 0.5;

    // Check horizontal FOV first; if it is within that, then check the vertical
    // If both pass, then it is in view
    h_angle = Vector2D.angle(h_objPos, h_bodyPos, h_headDir);
    v_angle = Vector2D.angle(v_objPos, v_bodyPos, v_headDir);
    if ( Math.abs( h_angle ) <= iHFOV) {
        if ( Math.abs( v_angle ) <= iVFOV) {
            inView = true;
        }
    }

    return inView;
}

I found some resources that I will be reviewing in the mean time, but any help is appreciated. I haven't done any linear algebra courses so I'm trying to wrap my brain around it.

sentences:
Writing Game Engine from scratch with OpenGL I want to start writing my game engine from scratch for learning purpose, what is the prerequisites and how to do that, what programming languages and things you recommend me? Also if you have good articles and books on that it will be great. Thanks in advance!

My Programming languages and tools are:

C/C++ is it good to use only C?
Python
OpenGL
Git
GDB

What I want to learn from it:

Core Game Engine
Rendering / Graphics
Game Play/Rules
Input (keyboard/mouse/controllers,
etc)

In Rendering/Graphics:

3D
Shading
Lighting
Texturing

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:
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:
Clarification on the correct way to call SpriteRenderer This is probably a dumb question, born from my own ignorance, but I haven't been able to find a satisfying answer yet.

In this post Savlon gives example code for using SpriteRenderer to cycle through two sprites. What exactly is the purpose of the line:

private SpriteRenderer spriteRenderer;

To me this looks like we are storing an instance of the class SpriteRenderer inside the private pointer spriteRenderer. Because in the Start loop they write

spriteRenderer = GetComponent<SpriteRenderer>();

which uses GetComponent to address properties of SpriteRenderer.

Is this correct? If so, what is the advantage to doing this over creating Savlon's code inside a subclass of the SpriteRenderer class?

Kensington

sentences:
How can I detect hex edges and corners for Catan map? The following messy code implements a decent hex map, but I have no way to detect edges and corners:

function blankMap($scenario_array){
    $hexMap = null;
    $hexCss = "";
      echo $hexCss.$hexMap;
    }
}

How do I move on from here so that I can click on edges and corners of the hexes?

sentences:
How do I rotate a single object in HLSL? I have a World with a 3D model of a head in it and that World rotates, like such:

protected override void Update(GameTime gameTime)
{
    //other stuff

    angle += 0.00005f;

    //more other stuff
}

protected override void Draw(GameTime gameTime)
{
    //other stuff
    Matrix rotation = Matrix.CreateRotationY(3 * angle);
    effect.Parameters["World"].SetValue(rotation * Matrix.CreateScale(10.0f));

    // other stuff
}

And then in my Effects file I create a spotlight:

float4 SimplePixelShader(VertexShaderOutput input) : COLOR0
{
    float4 lightDirection = { 1, 1, 1, 0 };
    float theta = 10.0f;
    float phi = 30.0f;
    float4 color;
    float4 lambert = DiffuseColor * 0.2 * max(0, dot(input.Normals, input.lambertLightDir));

    float angle = acos(dot(input.lightDir, normalize(lightDirection)));
    if(angle > radians(phi))
        color = AmbientColor * AmbientIntensity;
    else if(angle < radians(theta))
        color = lambert;
    else
        color = max(AmbientColor * AmbientIntensity, smoothstep(radians(phi), radians(theta), angle) * lambert);

    return color;
}

And naturally this spotlight also rotates with the world. However, I dont want it to rotate. I tried everything, multiplying, adding, subtracting the rotation matrix and/or the angle from the different lightdirections and angles and nothing works.

Now I could rotate just the model and not the world, that would even be a sensible thing to do, but I have no clue how :P So I'm either looking for a good way to rotate the model or a way to 'counter rotate' the spotlight so it seems to stand still.

Edit: my vertexshader:

VertexShaderOutput SimpleVertexShader(VertexShaderInput input)
{
//some other vertexshaderstuff

    float4 lightPoint = {-3, -2, -2, 0};

    output.lightDir = normalize(input.Position3D) - lightPoint;

    output.lambertLightDir = float4(30, 30, 20, 0);

    return output;
}

sentences:
What is the order-less rendering technique that allows partial transparency? I've seen somewhere rendering technique that allows order-less rendering of partially transparent sprites/objects.

Though I can't remember what the technique is called, so I'm having trouble Googling it.

sentences:
How can I make a collection of mini-games in XNA where the user can download packs of minigames and the main .exe can run them without being altered? I'm currently making a PC game in XNA. It's actually a collection of mini-games (there's 3 mini-games at the moment) however I plan to make and add more, in downloadable 'packs'.

My question is, what's the best way to achieve this?

Currently my thoughts are:

Create a 'game' interface
Build games to this interface but create them as .dlls
Have the main .exe file scan a directory and load in the .dlls at runtime.

I've not messed around with the idea much, but I know there are applications at-least that use this plug-in approach (Notepad++ seems to), but I'm not sure of any games that do (although I'm sure they must exist). However it seems that this is a problem that has been solved previously, so I'm wondering if there's any form of established best-practice.

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:
How to start a coroutine that will finish after the object is destroyed I have a simple game in which the player can collect power-ups. Each power-up gives the player a temporary advantage for several seconds. The power-up should disappear immediately after the player collects it.

My current implementation of the power-up logic is:

[SerializeField] float duration;

private void OnTriggerEnter2D(Collider2D other) {
    if (other.tag == "Player") {
            StartCoroutine(GiveTemporaryPowerup(other.gameObject));
            Destroy(gameObject);
    }
}

private IEnumerator GiveTemporaryPowerup(GameObject gameObject) {
    gameObject.ActivatePowerupFunction();
    yield return new WaitForSeconds(duration);
    gameObject.DeactivatePowerupFunction();
}

This does not work: the powerup is activated but not deactivated. Deactivation does work when I remove the line "Destroy(gameObject)". However, without this line the player can collect the same powerup several times, which I want to avoid.

I tried to put the coroutine on a component attached to the player object (rather than the power-up object), but this did not solve the problem - deactivate was not called. Here is the updated code on the power-up:

private void OnTriggerEnter2D(Collider2D other) {
    if (other.tag == "Player") {
            var playerComponent = other.gameObject.GetComponent<Player>();
            StartCoroutine(playerComponent.GiveTemporaryPowerup(duration));
            Destroy(gameObject);
    }
}

And the code on the Player component:

public IEnumerator GiveTemporaryPowerup(float duration) {
    ActivatePowerupFunction();
    yield return new WaitForSeconds(duration);
    DeactivatePowerupFunction();
}

What is the correct way to implement this?

sentences:
Issues with ECS performance I'm currently implementing ECS in "classic" sense, as defined by this wonderful post, where we have Entities, Components and Systems. And I'm having a serious (for me) performance issues. They come from the fact that System may need access to several components of the entity:

IList<int> es = _ecsManager.GetComponentEntities(ComponentType.RENDER);

int cacheRender = -1;
int cacheMovement = -1;
foreach (var entityId in es) {
    var rc = _ecsManager.GetEntityComponent<RenderComponent>(entityId, ComponentType.RENDER, ref cacheRender);
    var mc = _ecsManager.GetEntityComponent<MovementComponent>(entityId, ComponentType.MOVEMENT, ref cacheMovement);
    rc.Sprite.Position = mc.Position;
    QueueSprite(rc.Sprite);
}

the QueueSprite is my sprite batching, it's backed by regular arrays and Lists with no dynamic in long run. And GetEntityComponent is:

public T GetEntityComponent<T>(int entityId, int componentId, ref int idxCache) where T : PslComponent {
    var cs = GetEntityComponents(entityId);
    // try for cache
    if (idxCache != CACHE_NULL && idxCache < cs.Count) {
        var tmp = cs[idxCache];
        if (tmp.TypeId == componentId) {
            return (T)tmp;
        }
        // cache miss
        idxCache = CACHE_NULL;
    }
    // cache failed, sequental search
    for (var i = 0; i < cs.Count; i++) {
        var component = cs[i];
        if (component.TypeId == componentId) {
            // update cache
            idxCache = i;
            return (T)component;
        }
    }
    // not found
    return null;
}

and GetEntityComponents:

public IList<PslComponent> GetEntityComponents(int entityId) {
    return _componentsByEntity[entityId];
}

with _componentsByEntity being a array, GetComponentEntities works similarly backed by regular array too:

public IList<int> GetComponentEntities(int componentId) {
    return _entitiesByComponent[componentId];
}

the abovementioned foreach loop is taking a lot of time. More than rendering.

As you can see, I'm pretty much tried to optimize a lot of things already, removing all Dictonary<>-type lookups, replacing all by arrays and Lists. There is no dynamic allocation in long-run. The only problem, as I see it, is sequental search in entity Component loookup.

Is there any possibility to improve component lookup speed, while remaining true to classic implementation?
Is this major performance penalty is usually assumed then ECS is used? Are ECS "bad" then high performance is required?

sentences:
Triple buffering and jittering John Carmack has a tweet:
"Triple buffering adds latency and jitter; it should be avoided. The Answer is non-isochronous display updates."
Can anyone explain what he meant by adds latency and jitter?

sentences:
Triggers are not detecting colliders from other game objects in Unity version 5.2.2f1? I was working on a basic slots game, and I came across a hiccup with the 2D Physics engine. Currently I'm letting the reels spin for three seconds. Once it has finished spinning, it will go to the reel stop that the RGN picked out. Also, when it has reached the end of the reel I had it so that reel would "wrap around" to the firs reel stop continuing displaying the stops as it before.

I'm using a edge collider as a trigger on each reel (I'll call it a symbol trigger for short). The symbol trigger is a child of the reel but the actual symbols (which are game objects in screen space) are procedural generated and attached to the actual reel. All the symbols have a rigidbody2D and are kinematic. For some reason the triggers do no respond with on enter, on stay, or on exit, and that is with putting debug logs.

Now I have taken the reels and triggers to and out of world space and screen space, switched from rigidbody2D to 3D along with, messed with the sleep options, and switched it from discreet to continuous and still have get no response from the collider. If anyone knows why this is happening, your insight would be highly  appreciated!

Thanks for reading about my issue and have a good day.

sentences:
When I shoot from a gun while walking, the bullet is off the center, but when stand still it's fine. (Video Included) I am making a small project in Unity, and whenever I walk with the gun and shoot at the same time, the bullets seem to curve and shoot off 2-3 CMs from the center. When I stand still this doesn't happen.
This is my main Javascript code:
@script RequireComponent(AudioSource);

var projectile : Rigidbody;
var speed = 500;
var ammo = 30;
var fireRate = 0.1;
private var nextFire = 0.0;

function Update() {
    if(Input.GetButton ("Fire1") && Time.time > nextFire) {
        if(ammo != 0) {
            nextFire = Time.time + fireRate;
            var clone = Instantiate(projectile, transform.position, transform.root.rotation);
            clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));
            ammo = ammo - 1;
            audio.Play();
        } else {

        }
    }
}

I assume that these two lines need to be tweaked:
var clone = Instantiate(projectile, transform.position, transform.root.rotation);
clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));

I just started Unity, and I might have a difficult time understanding some things.
EDIT:
Here is a video - http://www.screenr.com/2pxH
(If there are any more mistakes in my code, feel free to edit it.)

sentences:
Loading texture from constructor doesn't work but does from function call I am trying to load a SDL texture through my class's constructor. All I'm doing is calling a function from the constructor to load the texture. As mentioned in the title, this does not seem to work. However, if I call the function directly then it loads fine and I can see it on the screen. I'm fairly new to C++ so please let me know what I'm doing wrong.

Game.h

#include "Player.h"

class Game {
  private:
   Player player;

  public:
   Game();
   ~Game();

   void update();
   void draw();
}

Game.cpp

#include "Game.h"

Game::Game() {
  this->player = Player("somefile.png", 0, 0, 10, 10);  // Doesn't draw
  this->player.load("somefile.png", 0, 0, 10, 10) // Will draw
}

void Game::update() { /* ... */ }

void Game::draw() { /* ... */ }

Player.h

class Player {
  private:
    SDL_Texture* texture;
    SDL_Rect source, destination;

  public:
    Player();
    Player(const std::string& filepath, const int x, const int y, const int w, const int h);
    ~Player();

    void load(const std::string& filepath, const int x, const int y, const int w, const int h);

    void update();
    void draw();
  }

Player.cpp

#include "Player.h"

Player::Player() {}

Player::Player(const std::string& filepath, const int x, const int y, const int w, const int h) {
  this->load(filepath, x, y, w, h);
}

void Player::load(const std::string& filepath, const int x, const int y, const int w, const int h) {
  this->texture = SDL_CreateTextureFromSurface(renderer, IMG_Load(filepath.c_str());

  if (this->texture != nullptr) {
    this->source = { x, y, w, h};
    this->destination = { 0, 0, w, h};
  }
  else {
    std::cout << "Could not load image." << std::endl;
  }
}

void Player::update() { /* ... */ }

void Player::draw() { /* ... */ }

In Game.cpp, if I use the line with the constructor then nothing draws in the window. If I use the line that has load(), then it works fine. I never get the Could not load image. error in either cases.

sentences:
Vertex normals in the geometry shader using directx I'm in directx 11 with the geometry shader.

Is is possible to calculate vertex normals? Just one like segment per vertex? In the geometry shader?

I did vertex normals per face, this is what I got,

My exercise in the book wants something like

sentences:
Resizing a parallax background (bug) I'm attempting my first 2D vertical scroller and can't seem to get the background size to work. For some reason, it stays small. I think in the beginning of the parallax scrolling class, I was told to initialize variables and I know which ones I have to change.

public Texture2D picture;
public Vector2 position = Vector2.Zero;
public Vector2 offset = Vector2.Zero;
public float depth = 0.0f;
public float moveRate = 0.0f;
public Vector2 pictureSize = Vector2.Zero;
public Color color = Color.White;

I think I must change pictureSize to make it bigger, as the current sizing I get this:

Finally, how can I remove the whitespace from the ship image?

EDIT: Here is the code for the rendering of the actual ship:

public void Render(SpriteBatch batch)
{
    batch.Begin();
    batch.Draw(shipSprite, position, null, Color.White, 0.0f, spriteOrigin, 1.0f,
    SpriteEffects.None, 0.0f);
    batch.End();
}

The whitespace seems to be provided by XNA as I've tried clearing it using Photoshop. Because I can't directly upload to the site, I have put it here

This renders the background:

public void Draw()
{
layerList.Sort(CompareDepth);
batch.Begin();
for (int i = 0; i < layerList.Count; i++)
{
   if (!moveLeftRight)
   {
       if (layerList[i].position.Y < windowSize.Y)
       {
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y), layerList[i].color);
       }
       if (layerList[i].position.Y > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y - layerList[i].pictureSize.Y),
           layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y + layerList[i].pictureSize.Y),
           layerList[i].color);
   }
   else
   {
       if (layerList[i].position.X < windowSize.X)
       {
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X,
           0.0f), layerList[i].color);
       }
       if (layerList[i].position.X > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X -
           layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X +
       layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       }
   }
   batch.End();
}

(It's from a XNA tutorial book I'm reading.)

sentences: Creating an alphabet with numbers in 3d using opengl-es How should I create an alphabet with numbers in 3d in opengl-es? I'm trying to create them with the existing primitives, but it's not looking good. Do we have any alternate way to get these things done? If so, please let me know! Thanks in advance.

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:
How do I consolidate the differences between iOS and Android update loops? I'm currently working on moving some Android-ndk code to the iPhone.

From looking at some samples it seems that the main loop is handled for you and all you've got to do is override the render method on the view to handle the rendering. Then add a selector to handle the update methods. The render method itself looks like it's attached to the windows refresh.

But in android I've got my own game loop that controls the rendering and updates using C++ time.h. Is it possible to implement the same here bypassing Apple's loop? I'd really like the keep the structures of the code similar.

sentences:
Dealing with more complex entities in an ECS architecture Preamble: I'm working on a level editor for my engine, which uses an ECS architecture. I have around a dozen component types so far, mostly dealing with graphics, like lighting components, model, and other mesh related things like skeleton and collider components.

My engine only supports 1 of each component type per entity, and systems can deal with optional components as well.

Today I realized I was uncertain on how I should tie-together the building block components used for basic entities into a more complex one.

For example, let's say I want to make a torch / flaming stick, using the components found in a model entity and a lighting entity.
If the model's origin is in the center of the shaft, then the light and fire would appear at the center of the model.
Further, if I wanted a weird torch with fire on one end of the stick and smoke on the other, they would both need different offsets before rendering.

Do I need to create a system just for torch's, adjusting all the components to fit the model? This doesn't sound like it scales well to different models needing 'decorations'.

Should I instead be creating an attachment component, with its own offset variables? What dictates which components of an entity use the offset? Should I be making attachment types for every component type that could need an offset?
Or rather should most components just have a spatial offset as another parameter the user can control?

Anyone know any commonly used solutions?

sentences:
How can I encourage players to "talk to" to each other in team-based games? With the goal of attracting a certain kind (highly sociable, that is) of players, I have wondered what game mechanics require, or at least encourage, players to verbally (I'm assuming an advanced text chat system, with team and private channels, maybe even chat-bots) communicate with each other, if they want to succeed as a team, or at least get the best possible results, within a game.

I'm interested in anything that requires discussion; before, during or after a "match".

If it matters, it would be (mostly) a team-vs-environment game, but also allow some tasks to be achieved by players alone (team is offline), or the occasional PvP/GvG (I'm bored with the grunts).

Getting team players to talk (rather than argue!) to each other increases their "closeness", and so plays an important role as a long-term "retention mechanism".

sentences:
How can I clear the screen in Xcode? so I am following a tutorial to make a snake game in my Xcode console. But the tutorial i am following is using windows and therefore the "system("clear")" command isn't working with my mac, and all of my research seems to show that there is no way to do that in Xcode

my question is, don't many games need to have their screen cleared constantly?
how would games that are being designed in Xcode clear their screens if there is no easy way to do this?

sentences:
How to limit velocity of object on touchDragged event? I am using the current code to handle the movement of the player ship in my libGDX game:

if (playerShipTouched)
{
  position.x = screenX - touchOffset;

  // limit movement to screen bounds
  if (position.x < 0)
  {
    position.x = 0;
  }
  else if (position.x > (globals.VIRTUAL_WIDTH - playerShipSprite.getWidth()))
  {
    position.x = globals.VIRTUAL_WIDTH - playerShipSprite.getWidth();
  }
}

This gives me 1:1 screen to touch movement of the ship. However, I would prefer to limit the movement velocity so the ship can't just skip to the other end of the screen if the user moves their finger fast enough. I tried something like this:

position.x = position.x + Math.signum(screenX - position.x) * 800 * Gdx.graphics.getDeltaTime();

The movement is correctly restricted, but is jerky. Any ideas?

edit

Additional overridden touch methods:

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button)
{
    touchPos.x = screenX;
    touchPos.y = screenY;
    touchPos.z = 0;

    camera.unproject(touchPos, globals.resizeViewport.x, globals.resizeViewport.y,
            globals.resizeViewport.width, globals.resizeViewport.height);

    // Did the player touch the ship?
    touchRect.x = position.x;
    touchRect.y = position.y;

    if (touchRect.contains(screenX, screenY))
    {
        playerShipTouched = true;
        touchOffset = screenX - position.x;
    }
    return false;
}

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

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:
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:
What is the standard technique for shifting the frames of a sprite according to user input? From my own experience, I developed two techniques for changing the sprites of a character that's reacting to user input -- this in the context of a classic 2D platformer.

The first one is to store all character's pixmaps in a list, putting the index of the currently used pixmap in an ordinary variable. This way, every time the player presses a key -- say the right arrow for moving the character forward -- the graphics engine sees what's the next pixmap to draw, draws it, and increments the index counter. That's a pretty common approach I believe, the problem is that in this case the animation's quality depends not only on the number of sprites available but also on how often your engine listens to user input.

The second technique is to actually play an animation every key press event. For this you can use any sort of animation framework you want. It's only necessary to set the timer, the animation steps and to call the animation's play() method on your key press event handler. The problem with that approach is that is lacks responsiveness, since the character won't react to any input while the current animation is still being played.

What I want to know is whether you are using one of these techniques -- or something similar -- in your games, or whether there's a standard method for animating sprites out there that's widely known by everybody but me.

sentences: How to add scene after build and deployed in Unity? I want to be able to make new levels after build. I could use a map tool and script but I rather just add scene with all the resource packed with it. But what is the best practice forward?

sentences:
Moving a ship forward from rotation I am making a simple space simulator, where the player can control a ship using 2 controls, one for pitch and one for bank. The ship is properly rotated but I cannot figure out how to make the ship move forward based on that angle. Here's what the code looks like right now:

func renderer(renderer: SCNSceneRenderer, updateAtTime time: NSTimeInterval) {

    let t=CGFloat(time - lastTime)

    ship!.transform = CATransform3DRotate(CATransform3DRotate(CATransform3DRotate(ship!.transform, ud*t, -1, 0, 0), 0.00, 0, 1, 0), lr*t, 0, 0, 1);

    ship!.position = ?

}

I tried every combination of vector, euler angles, matrices, quaternions that I could think of/read about with no success. I am probably missing something stupid but cannot find what it is.

The code is in Swift using Scenekit, but language doesn't matter that much to me and I can translate any algorithm. It's also worth noting it does not work like Unity and Quarternions/Vectors don't have properties like .forward() etc.

Thank you for your help!

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:
Can a GameObject be both 2D and 3D? In all Unity games I saw so far, every object is either 2D (with RigidBody2D and Collider2D components), or 3D (with RigidBody and Collider components). This makes sense, but I wonder if there is any use to an object that has both (for example, both RigidBody2D and RigidBody, or both Collider2D and Collider)?

Are the worlds of 2D and 3D completely parallel and unrelated, or can they be connected somehow?

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:
Loop around a 2D Tile Map I have made an algorithm for procedurally generating a 2D tile map in Unity.

The player can use the mouse to pan the view and look at the map.

My intention was that when the player reaches one of the sides of the map, he would simply see the other side as if he was going around the Earth so to speak.

The only way I have achieved this is by simply instantly setting the camera's position to the other side of the map when the player crosses one of the edges. The problem with this is that the player never actually sees the "border" connection continuously and that bothers me since I took the care to generate the map in such a way that connecting the east/west edges makes sense.

How can I achieve the desired effect?

sentences: What are these yellow lines between toggles, and how do I turn them off in Unity? I don't understand what these faint yellow lines are and how to turn them off (see screen shot). I have created toggles from a prefab and to save time have been duplicating them and moving them. Unity chugs everytime I move a group of them, and I imagine it is because it is recalculating how to draw these lines. All of the toggles have lines between them. Send help!

sentences:
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:
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:
Camera stops moving forwards near World-Center So basically this is a problem I've been having since forever. I implemented a Camera System, it works fine but somewhere around the center (0, 0, 0) of the world it doesn't work. Actually it works, but it always moves back at the position I was before. Like, if I'm at (1, 0, 0), walking forward will make me stay at (1, 0, 0), while moving backwards will not. The weird thing is that as said before it only happens there and if I'm moving forwards, backwards, left and right work perfectly!

That's how I do my Walking:

XMVECTOR D = XMVectorReplicate(d);
XMVECTOR L = XMLoadFloat3(&m_LookDirection);
XMVECTOR P = XMLoadFloat3(&m_Pos);
XMStoreFloat3(&m_Pos, XMVectorMultiplyAdd(D, L, P));

My Strafing (Left to Right) is basically the same thing.
I update my ViewMatrix like that:

XMVECTOR R = XMLoadFloat3(&m_Right);
XMVECTOR U = XMLoadFloat3(&m_Up);
XMVECTOR L = XMLoadFloat3(&m_Look);
XMVECTOR P = XMLoadFloat3(&m_Pos);
XMVECTOR WU = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);

//Compute wuv vectors for camera space
XMVECTOR w = XMVector3Normalize(XMVectorSubtract(L, P));
XMVECTOR u = XMVector3Normalize(XMVector3Cross(WU, w));
XMVECTOR v = XMVector3Cross(w, u);

XMStoreFloat3(&m_LookDirection, w);
XMStoreFloat3(&m_Right, u);
XMStoreFloat3(&m_Up, v);

Then I fill in the ViewMatrix but that's unimportant.

Hope someone knows that basic mistake I'm doing!

Thanks

sentences:
Why can't I create an unordered access view of a R32G32B32_UINT buffer? So I'm trying to create an unordered access view for a buffer having with three component elements, but it fails with this warning:

D3D11 ERROR: ID3D11Device::CreateUnorderedAccessView:
The format (0x7, R32G32B32_UINT) cannot be used with a Typed Unordered Access View.
[ STATE_CREATION ERROR #2097343: CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT].

This is my code:

void test(ID3D11Device* dev_ctx) {
  D3D11_BUFFER_DESC buff_desc;
  memset(&buff_desc, 0, sizeof(buff_desc));

  buff_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
  buff_desc.ByteWidth = 1024 * 12;
  buff_desc.CPUAccessFlags = 0;
  buff_desc.MiscFlags = 0;
  buff_desc.StructureByteStride = 12;
  buff_desc.Usage = D3D11_USAGE_DEFAULT;

  ID3D11Buffer* buff_ptr = nullptr;
  dev_ctx->CreateBuffer(&buff_desc, nullptr, &buff_ptr);

  if (!buff_ptr)
    return;

  D3D11_UNORDERED_ACCESS_VIEW_DESC uav_desc;
  uav_desc.Format = DXGI_FORMAT_R32G32B32_UINT;
  uav_desc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
  uav_desc.Buffer.FirstElement = 0;
  uav_desc.Buffer.Flags = 0;
  uav_desc.Buffer.NumElements = 1024;

  ID3D11UnorderedAccessView* uav_ptr = nullptr;
  dev_ctx->CreateUnorderedAccessView(buff_ptr, &uav_desc, &uav_ptr);

  if (!uav_ptr)
    return;
  }

It fails for any resource with three components (R32G32B32_*), but it works
if the resource has 1/2/4 components. So what could be the problem?

sentences: What level editor is Phil Fish using in Indie Game: The Movie? Does anyone know what program Phil Fish is using to edit models of levels? Or is it it something he built himself? I'm new to game development and was looking for something to design levels with besides my notebook.

sentences:
Using OpenGL GLEW within Unity Edit:-

How do I implement GLEW (or OpenGL extension libraries) within Unity?

Original Question:-

I've recently been looking into some really nice features of OpenGL 3.2 that I want to take advantage of in the development of a tech demo. One example being Geometry Shaders and Tessellation: now I know that OSX 10.8 already implements OpenGL 3.2 but not all of the functionality has been exposed, that is where GLEW comes in.

GLEW is a C/C++ extension... I have very limited C/C++ knowledge, would anyone be able to run through (in layman's terms) how to get GLEW working along side my C# Unity project.

sentences:
ScreenSize vs. WorldSize While programming a game with LibGDX, I came across a problem. My OrthographicCamera wasn't centering in the right place. I was trying to center the camera by using the line of code:

gameCam.position.set(gamePort.getScreenWidth() / 2, gamePort.getScreenHeight() / 2, 0);

But that centered the camera at (0, 0) so that you could see all four quadrants of the coordinate table.

Here is the image:

NOTE: I am using a FitViewport that was initialized like gamePort = new FitViewport(MarioBros.V_WIDTH, MarioBros.V_HEIGHT, gameCam);

Also: public static final int V_WIDTH = 400;
    public static final int V_HEIGHT = 208; (in the MarioBros class)

But after some fiddling with the code, I changed the line of code to this:

gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);
I changed it from ScreenSize to WorldSize and got this result:

I'm still unsure of what using WorldSize changed.

What's the difference between the two?. Also, why did one work while the other didn't?

sentences:
Changing player color without multiple player bitmaps Possible Duplicate:
  How to colorize certain parts of a model - like RTS games have those team colors?

Ok, so here is my current situation. I have a player model, fully UV mapped, and textured. At first I made multiple bitmaps for the character representing multiple colors for each team in the game. (red, blue, green, yellow, etc) Well, as my player count build up, space lowers. So I needed to make a new method of keeping the game effecient, clean, and fast. So I thought of the idea of having a color mask (alpha map covering the areas to be colored). I am using OpenGL, and I just have NO idea on where to begin!

So I ask you, are there any libraries? methods? anything that could help me do this?

sentences:
How can I implement dynamic button size? I'm on the process of planing a sort of a 2D/2.5D, pixel-art multilingual game, while I learn about game development. I have a pretty solid background at programming, but when it comes to game design, I don't know too much. My particular question is about how is the proper/better way of creating and implementing a game text button, but I suppose it can be applied to other GUI elements. What I have found so far, while "googleing"/looking for this specific question, is how to deal with engines or frameworks which have their own way of doing it, but I would like to do it by my own. So to make things clearer, let me expose my vision of potential approaches.

Fixed text in a fixed-size texture

This is an easy way of implementing a text button, as all I have to do is loading and positioning a texture. However, it could be painful to change my .psd files all the time, as I'm working with a multilingual game.

Variable text and fixed-size texture

I could use a texture as a button model and overlap it with all kinds of text of different languages, reading the texts from .xml files. The problem is that a word in a language can exceed its equivalent of another language. A workaround for this could be switching between different font sizes, i.e., a text in a language would be smaller or larger than in another, but this would look ugly.

Variable text and splitted texture

This approach would divide a button texture into 3 different parts: left, middle and right. Then, I would read a text from a .xml file, measure its length in pixels and increase ("multiply") the "middle" part of the texture so that the text could fit on it. This looks fine when working with a pixel-art game GUI, but sounds not fine when working with vectorized images.

Dynamically-generated GUI

I could use OpenGL to render rectangles and use them as buttons, but this would produce quite basic shapes. At most, I would have shaded rectangles with a basic border and some text rendered on it; it would look like a HTML/CSS GUI, which is a way far from a game GUI.

These approaches are just my guesses, as I've never worked in the game industry; I assume that someone experienced can correct me if I deduced something wrong. Another thing is that I think these approaches can work diffently depending of the texture type (e.g. pixel-art and vectorized textures), so you'll be welcome for answering why an approach is better for a texture type or another. There's also a possibility of me being a bad thinker and all of this being a "bullshit", and if it is the case, I hope you share your technique with me.

Moreover, as I said before, this question is specific for a text button, but I think with some adjustments it could cover more GUI elements which have related properties (such as window, text input and the like), so if you include it as part of your answer, it'll be helpful.

sentences:
Multiplayer first person camera gone after restart I have a main camera in a multiplayer scene and when a player joins he owns that camera so there is always a single camera.

Now when i click "disconnect" and connect again, there is no camera left in the scene because it gets "destroyed" with the players prefab.

How can i catch the "client disconnect" on client side to clear the cameras parent so that it still remains in the scene?

sentences:
How can I draw a shadow under my character? I created a 2D tile-based jump and run game for Windows Phone and I want to draw a shadow under the character. How can I do that? The shadow must also be drawn on the tiles if the character jumps. The character and the tiles are rectangles.

How can I draw a shadow under my character?

The shadow should look similar to the shadows in this picture:

UPDATE:
I tried to solve the problem like described in Gamefreak0's answer, but it's not working.
I created a ShadowChecker object and I check in a foreach-loop if it collides with a platform. If it collides, the variable ShadowPosition gets changed.
But it's not working correctly. I made a picture, and in this picture you see that the shadow isn't on a platform. Why is the shadow not getting drawn on the pink platform?

The character(black rectangle) is above the pink platform, so the shadow should be on the pink platform.

I update the shadow's position with this code:

 protected override void Update(GameTime gameTime)
    {
        Rectangle CollisionRect = new Rectangle(-1000, -1000, 0, 0);
        ShadowChecker = CharacterRect;

        //FloorRect is the brown rectangle at the bottom. There is no other platform under the FloorRect.
        while ((CollisionRect.Height == 0) && (ShadowChecker.Bottom <= (FloorRect.Y + FloorRect.Height / 2)))
        {
            ShadowChecker.Y += 1;
            foreach (Rectangle r in PlatformRectangles)
            {
                if (ShadowChecker.Intersects(r))
                {
                    CollisionRect = r;
                    break;
                }
            }
        }
        if (CollisionRect.Height != 0)
        {
            // Draw the shadow on this position
            ShadowPosition = new Vector2(CharacterRect.X, CollisionRect.Y - CollisionRect.Height / 2);
        }

        base.Update(gameTime);
    }

sentences:
Concept of "scene" in Godot, misunderstanding Could anyone clarify a beginner's question in Godot?

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

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

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

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:
Point inside a large polygon I am just starting to get into using pyBox2D as I already knew python well and I was wondering if I have 500 points of a large polygon, how would I be able to check if a point lies inside of this polygon. I tried to just make a polygon with 500 vertices but this isn't allowed in pyBox2D as the maximum vertices is 16.

I thought about splitting the polygon into many smaller polygons but I don't full know how to check if the point is inside all of these polygons. Do I need to create a body and add the polygon fixture or can I just use b2PolygonShape and then query the point from the shape?

I have been writing all my code using the github wiki for pyBox2D and they have a section on point querying a shape but I don't know how to implement this in my project.

sentences:
How to enable CrossPlatformInput in Unity? I'm new to Unity but not a complete programming novice.

I'm trying to use the CrossPlatformInput component from the "Car" prefab from Standard Assets.

I can't see it appear and when reading the notes file it says this:

  Importing the CrossPlatformInput package adds a menu item to Unity, "CrossPlatformInput", which allows you to enable or disable the CrossPlatformInput in the editor. You must enable the CrossPlatformInput in order to see the control rigs in the editor, and to start using Unity Remote to control your game.

So,

What is "a menu item" and where do I find it in the Unity UI?
How do I enable CrossPlatformInput? I have dragged the prefab called DualTouchControls into my scene but I can't see anything and I'm not sure how to link it to the actual car object.

sentences:
How to plot hex tiles with different length sides? I'm trying to create a basic grid of hex tiles. I found some code:

s=h/Math.cos(30*Math.PI/180)/2;
tile._x=x*s*1.5;
tile._y=y*h+(x%2)*h/2;

That does just that, but I think it's setup for hexes that have same length sides. However, my hex has different length sides. Its width is 140 and its height is 80. How would I change that code to accomodate this?

sentences: Optimal way to select a random item from a list based on its chance to appear in Unity I am creating a random object spawning script in Unity with c#, and am wondering what the ideal way to do this task would be. So I have a list of 31 objects or so, of my special class type. Each one has an arbitrary number assigned as it's weight. This number is divided by the sum of all their weights and multiplied by 100 to make their percent chance for appearing. It's at this stage where I'm stumped. How should I go about selecting them with a random number between 0 and 100? My first idea was to give each one a range and if the random number falls within it, I select that one, but that method does not sound like it would be the most elegant and would involve like 31 IF statements. What is the standard way to do this sort of random selection?

sentences:
Translating a terrains position using input in Unity 3D C# I am trying to make a terrain in Unity move, but im having trouble. Here's the code i have.

using UnityEngine;
using System.Collections;

public class NewScript : MonoBehaviour {

Camera camera;

Transform Terrain;
// Use this for initialization
void Start () {

}
// Update is called once per frame
void Update () {
    Terrain.Translate(new Vector3(500, 500 ,500));
}
}

now i would suspect that the terrain would just keep translating its position but it doesnt budge. How do i make a terrain move, or if you cant, how can i make the camera move and preferably with input. I am familiar with the XNA framework, is there a way to implement the input from XNA into unity?

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:
Scanline filling of polygons that share edges and vertices In the image below (a perspective projection of an icosahedron),
the scanline (red) intersects that vertex at the top. In an icosahedron each edge belongs to two triangles. From edge a, only one triangle is visible, the other one is in the back. Same for edge d. Also, in order to determine what color the current pixel should be, each polygon has a flag which can either be 'in' or 'out', depending upon where on the scanline we currently are. Flags are flipped according to the intersection of the scanline with the edges.

Now, as we go from a to d (because all edges are intersected with the scanline at that vertex), this happens: the triangle behind triangle 1 and triangle 1 itself are set 'in', then 2 is set in and 1 is 'out', then 3 is set 'in', 2 is 'out' and finally 3 is 'out' and the one behind it is set 'in', which is not the desired behavior because we only need the triangles which are facing us to be set 'in', the rest should be 'out'.

How do process the edges in the Active Edge List (a list of edges that are currently intersected by the scanline) so the right polys are set 'in'?

Also, I should mention that the edges are unique, which means there exists an array of edges in the data structure of the icosahedron which are pointed to by edge pointers in each of the triangles.

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:
Design of a turn-based game where actions have side-effects I am writing a computer version of the game Dominion. It is a turn-based card game where action cards, treasure cards, and victory point cards are accumulated into a player's personal deck. I have the class structure pretty well developed, and I am starting to design the game logic. I'm using python, and I may add a simple GUI with pygame later.

The turn sequence of the players is governed by a very simple state machine. Turns pass clockwise, and a player can't exit the game before it is over. The play of a single turn is also a state machine; in general, players pass through an "action phase", a "buy phase", and a "clean-up phase" (in that order). Based on the answer to the question How to implement turn-based game engine?, the state machine is a standard technique for this situation.

My problem is that during a player's action phase, she can use an action card that has side effects, either on herself, or on one or more of the other players. For example, one action card allows a player to take a second turn immediately following the conclusion of the current turn. Another action card causes all other players to discard two cards from their hands. Yet another action card does nothing for the current turn, but allows a player to draw extra cards on her next turn. To make things even more complicated, there are frequently new expansions to the game that add new cards. It seems to me that hard-coding the results of every action card into the game's state machine would be both ugly and unadaptable. The answer to Turn-based Strategy Loop does not go into a level of detail that addresses designs to solve this problem.

What kind of programming model should I use to encompass the fact that the general pattern for taking turns can be modified by actions that take place within the turn? Should the game object keep track of the effects of every action card? Or, if the cards should implement their own effects (e.g. by implementing an interface), what setup is required to give them enough power? I have thought up a few solutions to this problem, but I am wondering if there is a standard way to solve it. Specifically, I'd like to know what object/class/whatever is responsible for keeping track of the actions that every player must do as a consequence of an action card being played, and also how that relates to temporary changes in the normal sequence of the turn state machine.

sentences:
Procedural terrain - how to blend textures between dynamic meshes I think I should structure this question better.

I'm developing a procedural terrain structured with voxel chunks.

Every chunk:

contains a NxNxN voxel array generated with perlin noise 3d
contains a Mesh derived from the surface points of the voxel array
is rendered with marching cubes algoritm

Every mesh has its own Material

Every Material is made of 3 texture: one main texture and 2 minor textures to be blended with the main one depending on the slope. Every material has its own shader attached.

So I have a terrain made of a certain number of chunks, that are a certain number of meshes generated as the game launches. Inside every chunk blending if okay, since I have the only material for the current mesh I have only to blend its textures depending on heights - and this is done by the shader.

In this attached image

you can see quite clearly what I acheived until now.
As you can see, everything is mostly divided in "squares", which are the meshes. Each square has a texture green or beige (grass or sand).

My concern is that:
When passing from grass to sand there is no blending, i.e. blending between 2 meshes is my real problem, because inside the shader if have the surf function which iterates over all the input vertices. But those vertices are only from one mesh. To blend correctly I would need informations also about the vertices of the mesh nearby.

So the question is:
how can I blend properly materials belonging to different meshes?

sentences:
How to seamlessly texture a cube in OpenGL I have been following this site as an intro to OpenGL.

After going through the model obj loading tutorial, I wanted to create my own .obj (a cube) as well as my own texture. Following this blender tutorial I created and textured the cube, and exported the .obj and .dds which I am loading in the OpenGL tutorial program.

My issue is that in both cases, the original tutorial .obj/.dds and my own custom one created with blender, the texture for each face of the cube has a slight black edge around it.

I can't figure out how to change this, so that I have a "seamless" texture around the cube, with no black or white edges.

I'm not sure if this is something that needs to be adjusted in Blender, or in the c++ application. Any help would be appreciated!

sentences:
HTML5 clicking objects in canvas I have a function in my JS that gets the user's mouse click on the canvas.

Now lets say I have a random shape on my canvas (really its a PNG image which is rectangular) but i don't want to include any alpha space.

My issue lies with lets say i click some where and it involves a pixel of one of the images. The first issue is how do you work out the pixel location is an object on the map (and not the grass tiles behind).

Secondly if i clicked said image, if each image contains its own unique information how do you process the click to load the correct data.

Note I don't use libraries I personally prefer the raw method. Relying on libraries doesn't teach me much I find.

sentences: Implementing top view physics using box2D How can top view physics games be done in box2D? One idea I have is to set the linear velocity of an object manually or to alter the linear and angular damping as my object moves over different surfaces. For example if my object is over a wet surface it'll have less linear damping and if it is over rough surface it'll have more damping. And to see if my object has fallen over an edge I'll try to use an AABB and check if its still inside or manually see if object.x > boundary.x etc. Is there any better way?

sentences:
Draw selected instances of VAO (glDrawArraysInstanced) I'm using glDrawArraysInstanced to draw multiple instances of a tree at different positions to generate a forest.

Is there a way to draw selected instances?
For example:
I got 100 trees with different attributes.
Due to culling I only want to draw instance 3, 65, 89 and 95.

sentences: Tile Maps in Java JFrame Game I am making a 2D Java game with Java's own drawing library. I was wondering how I would make a tile map display on the screen. I would prefer to use a GUI application to make the maps. I'm looking for orthogonal projection: a top down view.

sentences:
Random Disconnects on UNET Using UNET, I can't host a game for more than a few minutes unless both server and client are on the same computer. It appears that I am not alone in this.

Essentially, any latency problems or packet loss triggers an immediate disconnect. Rather than just getting lag, the client gets booted.

Does anyone know how this could be dealt with?

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:
MonoBehavior Script that uses UnityEditor - Best practice for Location? I've created a script which helps me auto-generate a GameObject prefab. It uses some UnityEditor, so it can't be used at runtime (and its not meant to be).

Normally, a script like this I would put in the "Editor" folder.

However, since it needs to be attached to a GameObject as a Component to do its thing, I'm not sure where I should put it. I can't store it in the Editor folder, because Unity yells at me and says I'm not allowed.

Are there any best practices defined for things like this?

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:
Changing the position of a Gravity Controller - Farseer I'm trying to create mini black holes for my XNA game using farseer physics.

Problem is I can not get the gravity source to stick to the Body I've attached it to, as it scrolls across the screen, the gravity source simply stays in the same position. This is the code I've used.

Body blackHoleBody;
blackHoleBody = BodyFactory.CreateBody(world);
CircleShape ballShape =
new CircleShape(ConvertUnits.ToSimUnits(imageItemList[i].texture.Width / 2f), 1f);
Fixture ballFixture = blackHoleBody.CreateFixture(ballShape);

blackHoleBody.BodyType = BodyType.Static;
blackHoleBody.Position = ConvertUnits.ToSimUnits(imageItemList[i].Position);
blackHoleBody.Restitution = 0.0f;

blackHoleBody.CollisionCategories = Category.All;
blackHoleBody.CollidesWith = Category.All;

//Create the gravity controller
GravityController gravity = new GravityController(10f);
gravity.DisabledOnGroup = 3;
gravity.EnabledOnGroup = 2;
gravity.DisabledOnCategories = Category.Cat2;
gravity.EnabledOnCategories = Category.Cat3;
gravity.GravityType = GravityType.Linear;

world.AddController(gravity);

gravity.AddBody(blackHoleBody);

ballBodyList.Add(blackHoleBody);

My guess is that I need to get in the GravityController inside world, and update it's position there, but when I look I can only find the world global gravity.

If anyone could point me in the right direction it would be much appreciated.

sentences:
How can I get the width and height of a picture? I'm trying to make a script on RPG Maker XP that needs the width and height of an image to do some calculations. I tried @picture.bitmap.widthand @picture.bitmap.height but it returned the width and height of the image that is being shown in the screen.

For instance, if the image is 800 pixels height, and the image takes 400 pixels in the screen, @picture.bitmap.height will only return 400.
This is the code I'm using:

@picture = Sprite.new
@picture.bitmap = RPG::Cache.picture("picture")
@pictureWidth = @picture.bitmap.width
@pictureHeight = @picture.bitmap.height

sentences: What is this tracking circle called as? I don't know what the circle in the image below used for changing directions and movements of a character is called. Can anyone provide me anything related to it? I want to include it in my game.

sentences:
what's the best way of panning in a 2D scene Up to know I have used this functions to create a 2D scene (for showing images) and to pan on it ( in fact it's a customization of the class COpenGLControl here in codeguru) :

void COpenGLControl::OnSize(UINT nType, int cx, int cy)
{
wglMakeCurrent(hdc, hrc);
CWnd::OnSize(nType, cx, cy);

if (0 >= cx || 0 >= cy || nType == SIZE_MINIMIZED) return;
oglWindowWidth = cx;
oglWindowHeight = cy;
// Map the OpenGL coordinates.
glViewport(0, 0, oglWindowWidth, oglWindowHeight);

// Projection view
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set our current view perspective
glOrtho(-oglWindowWidth/2, oglWindowWidth/2, oglWindowHeight/2,-oglWindowHeight/2, -1, 1);
// Model view
glMatrixMode(GL_MODELVIEW);
wglMakeCurrent(NULL, NULL);
}

void COpenGLControl::OnDraw(CDC *pDC)
{
wglMakeCurrent(hdc,hrc);
// If the current view is perspective...
glLoadIdentity();
glScalef(m_fZoom,m_fZoom,1.0);
glTranslatef(m_fPosX, m_fPosY, 0.0f);
wglMakeCurrent(NULL, NULL);
}

void COpenGLControl::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
int diffX = (int)(point.x - m_fLastX);
int diffY = (int)(point.y - m_fLastY);
m_fLastX = (float)point.x;
m_fLastY = (float)point.y;
if (nFlags & MK_LBUTTON)
{
    m_fPosX += (float)0.5f * diffX;
    m_fPosY -= (float)0.5f * diffY;
}
OnDraw(NULL);
CWnd::OnMouseMove(nFlags, point);
}

pressing left mouse button and draging on the window, will cause the image to pan
In fact the COpenGLControl class is for 3D scenes and the disadvantage of this way for 2D scenes is that when I zoom in, I feel the speed of pan is more than the time that I zoom out?
I mean zooming in increases the speed of pan while zooming out decreases it.
Do you know of any way better for continuous panning in a 2D OpenGL scene?

sentences: How can you check your users' unlocked achievements (Google Play Game Services)? Is it possible to see how many of your users have unlocked certain achievements on the Google Play Developer console? This information would be very useful. I guess that one could achieve this through integration with Google Analytics but I was wondering if there was a simpler way to get this data.

sentences:
Unity/C# : How to execute a function after another function has finished its execution? I've been trying to build a "event system" for a project that I'm working on . Here is how I'm doing it : I populate a list with reference to a gameObject and the functions that I need to execute from that gameObject . Then , when the "event" is triggered (in this case , when the player steps into a trigger collider) I just loop over the list and Invoke the functions inside it.

The problem with this is that every single function inside the list gets executed at the same time. This works fine in some cases but if I want to create a more cinematic event I need to have the ability to execute a function after the previous one has finished it's execution .Sadly I have no idea how to do that.

I've been reading a lot of the documentation of both Unity and C# about coroutines and delegates but I can't seem to wrap my head around all those things and find a way to do implement them on code .So I need your help with that :How can I achieve this?

TL;Dr version : I need your help in coming up with a way to execute a function after the previous function has ended it's execution .These functions would be stored in an array or list.

Here is the code of the trigger of the event itself

public class ActivateEvent : MonoBehaviour {

private bool activated;
public Signal[] actionList;
[HideInInspector]
public int actionEventAmount;

// Use this for initialization
void Start()
{
    activated = false;

}
void OnTriggerEnter2D(Collider2D other)
{
    if (other.gameObject.tag.Equals("Player") && !activated)
    {
        Activate();
    }
}

public void Activate()
{
    activated = true;
    for(int i=0;i<actionEventAmount;i++)
    {
        actionList[i].Invoke();
    }
}

}

and here is the code for the Signal Class

public class Signal
{
   public GameObject target;
   public string method;
   public string argType;

   public Signal()
   {

   }
   public Signal(System.Type argType)
   {
       this.argType = argType.FullName;
   }

 public void Invoke()
    {
        if (target != null && !string.IsNullOrEmpty(method))
            target.SendMessage(method, SendMessageOptions.RequireReceiver);
    }
    public void Invoke(object value)
    {
        if (argType != null)
        {
            if (target != null && !string.IsNullOrEmpty(method))
            {
                if (argType.Equals(value.GetType().FullName))
                    target.SendMessage(method, value, SendMessageOptions.RequireReceiver);
                else
                    Debug.LogError("Incorrect parameter type, expected [" + argType + "], got [" + value.GetType().FullName + "].");
            }
        }
        else
            Invoke();
    }
}

public class SignalAttribute : System.Attribute
{
    public string name;

    public SignalAttribute()
    {

    }
    public SignalAttribute(string name)
    {
        this.name = name;
    }
}

sentences:
How do I turn a game idea, into a game? I have an idea for a game, and I was wondering, how would I go about grabbing people in the gaming development community to help build this baby that is in my head. I am no coder, but I do understand coding concepts etc.

Are there sites for discussing possible game design ideas, or game concepts? (I'm hoping here is such a site :) )

sentences:
Best data types for DNA, edibles and creatures So I am making a sort of continuous evolutionary system in the Unity3D engine. Currently I have a DNA class that has values that gets applied to a Creature object on initializing e.g.:

public class DNA{
    public float maxSpeed;
    public float foodWeight;

    public DNA(float maxSpeed){
        this.maxSpeed = maxSpeed;
        this.foodWeight = foodWeight;
    }
}

Where every Creature has a public DNA variable that gets set when instantiating a population of Creatures via a GameManager class. In this "ecosystem" I want to have the creatures crave for food and try to avoid the poison.

My question isn't about the reproducing or natural selection part, but more about what the best kind of data type for each object is. Since I want the project to have expandable amount of Creatures, sorts of food etc.
Is the best way to handle all data via one GameManager, or should I seperate it in for example CreatureManager, FoodManager etc.?

Maybe a PopulationManager of some sorts?

Is the current setup for the DNA data optimal?
Also, currently I have food and poison just as two prefabs and detect collision (and add or substract health whether it's food or poison via tag), wouldn't it be smarter to create a struct for food and poison so I can later on expand on this?

Sorry if any of the given information is unclear or a bit vague, please say so if this is the case! I would be glad to clarify and add any needed information.
Thank you for reading through the entirety of my question, thanks for your time! :)

sentences:
Pan camera within bounds of large image I have a camera that I pan around a large image which works fine, however when I reach the end of the image I can keep panning on and on, forver. I have looked everywhere for an answer on how to prevent this but the only one I found did not use panning and I could not get it to work.

My code atm is very simple:

map.setPosition(-map.getWidth()/2, -map.getHeight()/2);

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
        return true;
    }

My Image is very large, 4096x4096, and my camera is 480x800. My problem is I have no idea how to get the distance I have panned, and even if I did I dont know how to stop a pan from moving past a certain point, just setting camera position won't work because then there will be a "bounce" back.

Basically I have a rectangle inside another rectangle, and the inner rectangle should not be allowed to move outside the larger. But as I said I don't really know where to start since I can't get the panning distance.

Ex of something I've tried:

@Override
public boolean touchDown(float x, float y, int pointer, int button) {
    startX = x * PAN_SPEED;
    return false;
}

@Override
public boolean pan(float x, float y, float deltaX, float deltaY) {
    if(-totalX > map.getX() + cam.viewportWidth/2){
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
    }
    return true;
}

@Override
public boolean panStop(float x, float y, int pointer, int button) {
    endX = x* PAN_SPEED;
    totalX += endX - startX;
    System.out.println("pan: " + totalX + ", map: " + map.getX());
    return true;
}

This is just a test, basically I can't move anymore after I hit the left border of the image, but totalX still keeps adding up so this will not work.

EDIT: Got it to work, code below:

@Override

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX, deltaY);
        keepCameraInBounds();
        cam.update();
    return true;
}

private void keepCameraInBounds () {
    OrthographicCamera c = this.cam;
    Vector3 camPos = c.position;
    float HW = c.viewportWidth / 2, HH = c.viewportHeight / 2;
    camPos.x = MathUtils.clamp(camPos.x, map.getWidth()/2 - map.getWidth() + HW, map.getWidth() - map.getWidth()/2 - HW);
    camPos.y = MathUtils.clamp(camPos.y, map.getHeight()/2 - map.getWidth() + HH, map.getHeight() - map.getHeight()/2 - HH);
}

sentences:
Is it legal to develop a game using other games skill names/flavor/mechanic? I am starting to develop a new game and i'm thinking about using some names for some features coming from other games (such as WoW and D&D).
I have already read this Is it legal to develop a game using D&D rules? and i know about Beholders and Mind Flyers (before reading this question) which i'm not going to use anyway in my game (neither specific D&D rules nor those monsters) and i'm not going to use an aready existing game system as i'm developing mine (which will use some classical RPG concepts but will have its unique flavor, at least i hope so...).

What i'm interested in is to know if i can legally use names those games use for skills, statistics, classes, enemies and so on...

I'm not talking about classic names such as Wizard, Mage, Warrior but more specific names you will find almost exclusively in that game (such as Bladesinger, Charisma, Power Attack or Warbringer...which apparently is a metal band and a monster in WoW and nothing else), these features won't be an exact copy of what you can find in other games, but will inherit just the "flavor" (sometimes not even that) of that feature

for example can i make a skill called "Power Attack" which gives you more damage per attack but a lower chance to hit (which is similar to D&D's power attack, though not exactly the same since mine will have a fixed % of damage increase and lowered chance to hit)?
What if this skill gives you more damage when using a weapon two-handed (which is a key feature of D&D's power attack in the 3.5 edition)?

I am aware that those are simple words and they can't be under copyright, what i'm more worried about is the flavor of a skill, statistic and so on and using a mechanic very similar to those found exclusively in other games

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:
Video Ads not showing correctly on iOS I've got an annoying problem considering video ads. I've tried different networks and for all video placements (Rewarded and Interstitial) I've got same problem: the Ad shows 1 frame, then disappears, but the ad sound remains. I think It is needed to enable something in Player settings, but I was not able to find what exactly. Banner ads work fine. Currently I am testing Ad Mob. The reward works fine, but the video ad just not displaying correctly.

The example of the ad show failure: https://youtu.be/ykgI4qGCg0c

My Unity version: 2019.1.9f1 Personal
Platform: iOS
Device: iPad mini 2

 void Start()
  {
 AdMobRewardedAd = RewardBasedVideoAd.Instance;
 // Called when an ad request has successfully loaded.
 AdMobRewardedAd.OnAdLoaded += HandleRewardBasedVideoLoaded;
 // Called when an ad request failed to load.
 AdMobRewardedAd.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
 // Called when an ad is shown.
 AdMobRewardedAd.OnAdOpening += HandleRewardBasedVideoOpened;
 // Called when the ad starts to play.
 AdMobRewardedAd.OnAdStarted += HandleRewardBasedVideoStarted;
 // Called when the user should be rewarded for watching a video.
 AdMobRewardedAd.OnAdRewarded += HandleRewardBasedVideoRewarded;
 // Called when the ad is closed.
 AdMobRewardedAd.OnAdClosed += HandleRewardBasedVideoClosed;
 // Called when the ad click caused the user to leave the application.
 AdMobRewardedAd.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
// Initialize the Google Mobile Ads SDK.
 MobileAds.Initialize(appId);

 this.Load_rewarded_video();
}
//Google ad mob Handlers======================
public void HandleRewardBasedVideoLoaded(object sender, EventArgs   args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoLoaded event received");
}
 public void HandleRewardBasedVideoFailedToLoad(object sender, AdFailedToLoadEventArgs args)
{
 Time.timeScale = 1;
 //MonoBehaviour.print(
 //    "HandleRewardBasedVideoFailedToLoad event received with      message: "
 //                     + args.Message);
 }
public void HandleRewardBasedVideoOpened(object sender, EventArgs args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoOpened event received");
}
public void HandleRewardBasedVideoStarted(object sender, EventArgs args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoStarted event received");
}
public void HandleRewardBasedVideoClosed(object sender, EventArgs args)
{
 //MonoBehaviour.print("HandleRewardBasedVideoClosed event received");
 Time.timeScale = 1;

 this.Load_rewarded_video();

 }
 public void HandleRewardBasedVideoRewarded(object sender, Reward args)
 {
 Time.timeScale = 1;
 ContinueGameCalculations();
 }
 public void HandleRewardBasedVideoLeftApplication(object sender, EventArgs args)
 {
 //MonoBehaviour.print("HandleRewardBasedVideoLeftApplication event received");
  }
  private void Load_rewarded_video()
  {
  #if UNITY_IOS
 string ad_unit = "ca-app-pub-5759662936416666/3614416666";
 #endif
 AdMobRewardedAd.LoadAd(new AdRequest.Builder().Build(), ad_unit);
 }

For some reason the very first test ad from Admob shows the way I described above, but the next ones work fine.

Update: the issue remains for both Rewarded and Interstitial Admob ad placements.

sentences:
How to efficiently organise all object in a large space I've just about started with a project I've had in mind for ages. I don't quite know how to start such big projects (bigger than Pong, anyway), so I thought I would get started by making a basic organization.

Now, in games like Freelancer and X feature large, open spaces. I ma aware that these have to be organised, to ensure collision testing don't happen continuously anywhere but only where the player can see it.

I thought first about a general scene graph, I am familiar with those, but it would just have almost all objects directly in the root node. The next idea was a Quad/Octree, but the objects are not quite static, and I don't know if it would make sense if you have to change the tree's organisation every second frame.

So, how is this done in real games? I'm using C# with XNA, if that matters, and would like to run the game on the XBox as well.

sentences:
What kind of ESRB rating do you get for IMPLIED sex? My game is a story-driven horror game with lots of gore. Obviously, being a horror game places it on the higher end of the age rating already, but because of how backwards the rating system is (female nipples = BAAAAAD!!! Some guy getting his head split in two = eh... who cares) I'm kinda worried that I would get an even higher rating for the sexual themes.

No nudity is ever shown. Some of the characters mostly flirt and say dirty things, not dancing around the f-word (like I just did), and they don't really hold back on the cursing either, but the "worst" you can see is a couple naked in bed after they've done their deed. The actual deed is never shown and you don't see them naked.

Just to be clear, the sexual themes are not the focus of the game, in fact it only happens sparsely. It's mostly about the survival of the main characters.

What kind of rating would my game get?

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:
Why do I have to divide the origin of a quad by 4 instead of 2? I'm currently transitioning from C#/XNA to C#/OpenTK but I'm getting stuck at the basics.

So I have this Sprite-Class:

public static bool EnableDebugDraw = true;
public float X;
public float Y;

public float OriginX = 0;
public float OriginY = 0;

public float Width = 0.1f;
public float Height = 0.1f;

public Color TintColor = Color.Red;
float _layerDepth = 0f;

public void Render()
    {
        Vector2[] corners =
        {
            new Vector2(X-OriginX,Y-OriginY), //top left
            new Vector2(X +Width -OriginX,Y-OriginY),//top right
            new Vector2(X +Width-OriginX,Y+Height-OriginY),//bottom rigth
            new Vector2(X-OriginX,Y+Height-OriginY)//bottom left
        };
        GL.Color3(TintColor);
        GL.Begin(BeginMode.Quads);
        {
            for (int i = 0; i < 4; i++) GL.Vertex3(corners[i].X,corners[i].Y,_layerDepth);
        }
        GL.End();

        if (EnableDebugDraw)
        {
            GL.Color3(Color.Violet);
            GL.PointSize(3);
            GL.Begin(BeginMode.Points);
            {
                for (int i = 0; i < 4; i++) GL.Vertex2(corners[i]);
            }
            GL.End();

            GL.Color3(Color.Green);
            GL.Begin(BeginMode.Points);
            GL.Vertex2(X + OriginX, Y + OriginY);
            GL.End();
        }

With the following setup I try to set the origin of the quad to the middle of the quad.

_sprite.OriginX = _sprite.Width / 2;
_sprite.OriginY = _sprite.Height / 2;

but this sets the origin to the upper right corner of the quad, so i have to

_sprite.OriginX = _sprite.Width / 4;
_sprite.OriginY = _sprite.Height / 4;

However this is not the intended behaviour, could you advise me how I fix this?

sentences:
Torque2D createTileLayer The script reference "manual" is not much of a help. When I look up createTileLayer(tileCountX/tileCountY/tileSizeX/tileSizeY) it doesn't say more than it creates a new TileLayer.

But, in what unit do I specify tileSizeX/Y?
Do I have to clean-up (delete) the created TileLayer when my game exits?

(There was no tag for Torque2D and I'm a little bit short on rep. points to create a new tag)

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:
Handling commands or events that wait for an action to be completed afterwards Say you have two events: Action1 and Action2. When you receive Action1, you want to store some arbitrary data to be used the next time Action2 rolls around. Optimally, Action1 is normally a command however it can also be other events. The idea is still the same.

The current way I am implementing this is by storing state and then simply checking when Action2 is called if that specific state is there. This is obviously a bit messy and leads to a lot of redundant code. Here is an example of how I am doing that, in pseudocode form (and broken down quite a bit, obviously):

void onAction1(event) {
    Player = event.getPlayer()
    Player.addState("my_action_to_do")
}

void onAction2(event) {
    Player = event.getPlayer()

    if not Player.hasState("my_action_to_do") {
        return
    }

    // Do something
}

When doing this for a lot of other actions it gets somewhat ugly and I wanted to know if there is something I can do to improve upon it.

I was thinking of something like this, which wouldn't require passing data around, but is this also not the right direction?

void onAction1(event) {
   Player = event.getPlayer()
   Player.onAction2(new Runnable() {

       public void run() {
           // Do something
       }

   })
}

If one wanted to take it even further, could you not simply do this?

void onPlayerEnter(event) { // When they join the server
    Player = event.getPlayer()
    Player.onAction1(new Runnable() {

       public void run() {

           // Now wait for action 2
           Player.onAction2(new Runnable() {
               // Do something
           })

       }

    }, true) // TRUE would be to repeat the event,
             // not remove it after it is called.
}

Any input would be wonderful.

sentences:
Collider2D and Rigidbody2D, how do they work? I have been learning JavaScript and Unity for a week now. I learned how to make Cube as a Ground and another Cube as a player and I used this code to make the Player Cube move forward and backward and jumping

var walkspeed: float = 5.0;
var jumpheight: float = 250.0;
var grounded = false;

function Update() {

    rigidbody.freezeRotation = true;

    if (Input.GetKey("a"))
       transform.Translate(Vector3(-1, 0, 0) * Time.deltaTime * walkspeed);
    if (Input.GetKey("d"))
       transform.Translate(Vector3(1, 0, 0) * Time.deltaTime * walkspeed);

    if (Input.GetButton("Jump")) {
        Jump();
    }
}

function OnCollisionEnter(hit: Collision) {
    grounded = true;
}

function Jump() {
    if (grounded == true) {
        rigidbody.AddForce(Vector3.up * jumpheight);
        grounded = false;
    }
}

I also learned how to make a character hit box. how to make a sprite and animation. pretty much the basic stuff.

Couple of days ago I created simple ground in Photoshop and a simple character and imported them to Unity3D. Whenever I use my code above the character keeps falling from the scene. Like the character has nothing to stand on. After thinking about it it make sense because I really didn't make anything to make the player character understand that he should stand on something so I started reading about this issue and I realized that there is something called Collider2D and Rigidbody2D.

Now I'm really stuck here I just don't know what to do. I applied the rigibody2d to my character picture and the Collider2D to the ground picture but whenever I play the project the gravity makes my character falls down.

This is my question:

How can I make the rigibody2d object realize that it shouldn't fall if there is a Collider2D object under it? So when I jump it's going to jump and the gravity going to bring it back to the ground.

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:
Is this Possible to force gameobjects (coliders etc) to get stretched based on the aspect ratio of the screen? Well with unity3D, I am in big trouble whenever I use sprites. As for textures I compensate for a evener look by Stretching it (Screen.width & Screen.height- that's fine for low end 2D games). Now If I have an Image and based on content of Image (Let's say I want to add BoxCollider for the walls in image). It works, but for only one aspect ratio. As I am making game for Android. I am having bunch of different resolution & Aspect ratios. Is this possible to stretch my coliders or other game objects so that I can Work easily????
please help me. I am in a rush :(

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: Is it still possible to develop for gamecube? I know the Nintendo gamecube is outdated, but it still one of my favorite systems. Is there any way to still develop games for it? What software would I need? What are the programming languages involved? Thanks guys!

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: How can I include vertex color information in .OBJ files? The .obj files I export are missing data for vertex colors. Is there a way to include color information in the .obj file? If not, what are the alternatives?

sentences:
Flipping the game so that the local player is always on the left side of the screen? I'm making a 1v1 game with each player at one end of the screen. The game is an online client-server game. I would like the local player to be on the left side of their screen and their opponent (the remote player)  on the right side. Similar to Clash Royale where the local player is always on the bottom and their enemy always on top.

What is the easiest way for me to accomplish this?

Some solutions I've thought of so far:

The server checks every time it sends data back to the players that if it's sending the data back to player 2, it flips it before sending it back. I don't particularly like this solution because it will greatly complicate the code, increasing the chances of bugs, and make it less flexible / re-usable in the future.
The client checks if it is player 2 and flips the data it received back from the server if it is. I don't like this solution for the same reasons as above.
Some camera tricks I don't know about.

sentences:
How can I correctly instantiate an octree in UE4? I tried to create a simple Octree like this:
(I looked at the FMeshTriOctree source code since no question in answers.unrealengine.com helped me)

// My FVertex class is slightly more complexe, but let's say it's something like this:
class FVertex : public FVector
{
      int32 ID;
}

struct FVertexOctreeSemantics
{
        enum { MaxElementsPerLeaf = 16 };
        enum { MinInclusiveElementsPerNode = 7 };
        enum { MaxNodeDepth = 12 };

        typedef TInlineAllocator<MaxElementsPerLeaf> ElementAllocator;

        FORCEINLINE static FBoxCenterAndExtent GetBoundingBox(const PBS::FVertex* Vertex)
        {
            return FBoxCenterAndExtent(Vertex->GetBoundingBox());
        }

        FORCEINLINE static bool AreElementsEqual(const PBS::FVertex* A, const PBS::FVertex* B)
        {
            return A==B;
        }

        /** Ignored for this implementation */
        FORCEINLINE static void SetElementId(const PBS::FVertex* Element, FOctreeElementId Id){}
};

typedef TOctree<PBS::FVertex*, FVertexOctreeSemantics> FVOctree;

But when I instanciate my octree it returns:

Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.9\Engine\Source\Runtime\Core\Private\Misc\CoreMisc.cpp] [Line: 975]
The TOctree() constructor is for internal usage only for hot-reload purposes. Please do NOT use it.

What can I do?

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:
Limiting framerate with a fixed timestep UPDATE:

I still need help determining how MAX_UPDATES works.  I want my game to be designed in such a way that if the user can't run the game at full speed, it slows down so that no updates are missed.. can someone help me understand that part of the code?  Also, how can I calculate an accurate realtime fps?

double frametime = 1000000./60, remainingTime = 0;
const unsigned int MAX_UPDATES = 10;

void Game::gameLoop(sf::RenderWindow &window)
{
    remainingTime += clock.restart().asMicroseconds();
    unsigned int updates = 0;
    while (remainingTime >= frametime)
    {
        remainingTime -= frametime;
        if (updates++ < MAX_UPDATES)
        {
            update();
        }
    }
    render(window);
}

Hi I'm learning how to create a 2d platformer in C++ using the SFML2 library.  My current goal is limiting the game's framerate.  SFML2 has a  window.setFramerateLimit(unsigned int limit) function for the window however I have found it to be imprecise due to it using sf::sleep.  Therefore I'm attempting to implement my own solution.  I want my game to used a fixed timestep and be framerate dependent as in the future when I implement attacks I want them to be based on frame data.

Since the game loop wont always execute exactly when a frame is supposed to happen, I create a delta variable that will account for the extra time spent starting the frame to start the next frame earlier by that same amount.

Does this all look right?

double frametime = 1000000./60, delta = 0;
void Game::gameLoop(sf::RenderWindow &window)
{
    t = clock.getElapsedTime().asMicroseconds();
    if (t + delta >= frametime)
    {
        clock.restart();
        delta = t + delta - frametime;
        update();
    }
    render(window);
}

edit: double shouldn't have f suffix doh

sentences: What is the color value of daylight? This is a very short question. I want to implement ambient light in the color of daylight from the sun. What is the color value of sun light?

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:
iPhone 3d Model format: .h file, .obj, or some other? I'm beginning to write an iPhone game using OpenGL-ES and I've come across a problem with deciding what format my 3D models should be in.  I've read (link escapes me at the moment) that some developers prefer the models compiled in Objective-C .h files.  Still, others prefer having .obj as these are more portable (i.e., for deployment on non-iPhone platforms).

Various 3D game engines seem to support many(?) formats, but I'm not going to use any of these engines as I would like to actually learn OpenGL-ES.  Am I putting myself at a disadvantage here by not using a packaged engine?

Thanks!

sentences:
How do I convert a DWG floor plan to 3D for use in Unity or PlayCanvas I wish to take DWG floor plans and make 3D models of them which I can then use in Unity or PlayCanvas.

PlayCanvas accepts FBX 3D models from tools such as Blender, Sketchup, 3DSMax, Maya, etc.

There are a lot of YouTube videos about creating 3D models from DWG in Sketchup but it seems quite manual work. Is there anything better or more automated?

Would it be better to use something like Blender, 3DSMax, Maya to create the 3D model?

How about AutoCAD - would this be better?

Is there are tool that is tailored for designing 3D floor plans that can export a model? I found Autodesk Homestyler which makes it easy to create floor plans, and see them in 3D, but only exports DWG.

The goal is to use these real life floor plans in a game engine because I want to simulate audio sources in the environment.

sentences:
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 can a player exist at a location that is not expressly defined? How do video games like Minecraft know how to place characters on an infinitely complex plane? For example, the game knows the character's place up to 10 or more decimal places and can display them at that location, but it only stores the blocks on the integer values. Here are other ways that I have thought about on how to phrase this question, because I know that I'm not being very clear:

How can a player exist at a non-integer location?
How can a player exist at a location that is not expressly defined?
How do non-existent coordinates contain players, even if they don't exist?
How can a game depict a player on coordinates it has not expressly stored?

I understand that the coordinates can be simply saved as doubles, but in order to store all the coordinates that a player could exist on would create a simply enormous file.

sentences:
How to leave a permanent skidmark on the ground in unity2d I am working on a 2D driving game.I have a sprite of a car.Set the car movement.Now I need to create a skid mark on the ground
 for that I have created a empte game object and added Trial Renderer component and set the skid mark material to it.The problem is that when i start moving the car ,the skid mark follows the car as if that a skid mark is attached to the car.

Is there any simple way to leave a permanent skid mark on the ground in unity2d.
Can anybody please help me

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

this is my width and height

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

and this is how I set my Matrix

glViewport(0, 0, width, height);

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

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

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

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

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

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

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

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

and this is how I setup my texture

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

then after I add some texture this is the result.

This is the actual picture, size 320x568.

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

sentences:
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:
Binding BoundingSpheres to a world matrix in XNA I made a program that loads the locations of items on the scene from a file like this:

using (StreamReader sr = new StreamReader(OpenFileDialog1.FileName))
                    {
                        String line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            red = line.Split(',');
                            model = row[0];
                            x = row[1];
                            y = row[2];
                            z = row[3];
                            elements.Add(Convert.ToInt32(model));
                            data.Add(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)));
                            sfepheres.Add(new BoundingSphere(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)), 1f));
                        }

I also have a list of BoundingSpheres (called spheres) that adds a new bounding sphere for each line from the file.
In this program I have one item (a simple box) that moves (it has its world matrix called matrixBox), and other items are static entire time (there is a world matrix that holds those elements called simply world). The problem i that when I move the box, bounding spheres move with it. So how can I bind all BoundingSpheres (except the one corresponding to the box) to the static world matrix so that they stay in their place when the box moves?

sentences:
How to apply saturn's ring texture in Unreal Engine 4? I'm working on a "solar system" model project. And while trying to apply saturn's ring texture which is this one :

it ended up looking like this:

I'm new to UE4 and this branch in general. So I have no idea how to fix this .
your help would be appreciated

sentences:
How to find a free patch of area in a tiled map? I've been trying to formulate the question and try to find some information on Google, but didn't managed to, so here it is...
We've got a nice tropic-themed game that is about to be released soon, that uses a tile map and an A* pathfinding is utilized and everything works flawlessly.

Until when it comes to the point where I need to somehow find unoccupied patch of area on the map that matches certain criteria, so that I can guide the player to place their just bought map objects on.

The map is 200x200 tiled map and it holds instances of each tile that determine two things - if it is occupied and if it is a water or a ground tile. These are already used for the A* pathfinding algorithm that I've put into the game.

Let's say the player buys a water-placible map object from the store and the map object occupies 5x5 tiles for instance. I need to guide the player to a free patch of water tiles where they can place that map object.

Any guidance and/or reference to such algorithms will be highly appreciated :) Thanks

EDIT: It turns out that I need to find such a patch as close as possible to given point (centre of viewport for instance). This will improve user experience

sentences:
Where should I put my mob rendering code? I'm making a simple LWJGL game. However, I'm a bit confused about rendering. So I have a Mob class and a TriangleMob is a basic enemy.

package daniel.entity.Mob;

public class TriangleMob {
        public void render(){
        }
        public void move(){
        }
}

Now I'm wondering do I put a render method in the TriangleMob or do I put some render method in graphics bit.

I'm really confused as I thought you needed to put all rendering in it's own bit. Then, all game logic like movement in another bit. Essentially, I want to spawn a TriangleMob in the SpawnMob class and then render it. I could put the render method in the TriangleMob class, however I want logic and rendering to be in different parts.

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: For games that time stamp a saved game (think Half-Life), is the entire game state really being saved every time? It seems to me if that were the case that your directory of saved binaries or serialized objects could get massive real quick. Is there some sort of strategy being employed on top of the State pattern that is optimizing each time stamped saved game so that it isn't saving the entire game "context" all the time?

sentences: Are global shader variables slower than texture look ups? I want to send quite a bit of data to the GPU, the data will never change (or will change very rarely) after it has been created.  Is there a performance impact to using global shader variables or should I pack the data into a texture to perform look ups?

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:
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:
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 go about GUI elements? Note: I plan on making my own GUI system. It will be good for learning, lightweight, only have bits I need, ties in with the game, etc.

I was thinking about how to do it. The elements I mean are:

Radio buttons
Enter text here boxes
Buttons
Sliders
Checkboxes

I'm not looking as to how to make them, yet. But more of how they would go.

Idea

I would have each state that needed stuff, so almost all, have a container of Elements. Each Element is-a GUI piece.

These each have position, a graphic, etc.

The bit I get more stuck on is the logic of them.

My idea for that, to allow for modularity and simplicity was to avoid a MainMenuStartButton; a OptionsOneBackButton, etc. and instead be able to do Slider slider1; or Button start;.

Instead, each would have a boost::function to a function in a GUI namespace, such like Gui::StartButtonClick, or GUI::ColourSliderHover.

I was just wondering whether this would be exceptionally slow or not.

And for that matter, is there any easy, simple way of doing GUI for games? No Qt, wxWidgets or anything.

sentences:
Cant import Sun openGL I've been working with JOGL and I've ran into a problem. The problem is when I try to import import com.sun.opengl.*; on Eclipse, Eclipse doesn't recognize it. Does anyone know where this library is? Did I miss a step during installation? I'm working with the latest build.

Here are the included libraries:

gluegen-rt-natives-windows-i586.jar - JOGL/lib
gluegen-rt - JOGL/lib
gluegen.jar - JOGL/lib
jogl-all-natives-windows-i586.jar - JOGL/lib
jogl-all.jar - JOGL/lib

This is within my JOGL project folder:

gluegen-rt.dll

sentences:
Bodies going through the walls of a box I have a game where the user controls a box to collect falling balls. However, very often the balls will just fall through the walls of the box and be flung away. What could be causing the balls to do that?

Here is a video of the issue.

Here's how I'm creating the box and the balls:

//BOX CODE

private Body pbox() {

    pbdef = new BodyDef();
    PolygonShape shape=new PolygonShape();
    pbdef.type=BodyType.StaticBody;
    pbdef.position.set(Gdx.graphics.getWidth()/2,100);
    Body body1=world.createBody(pbdef);
    FixtureDef fdef = new FixtureDef();
    shape.setAsBox(30, 5);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    //
    shape.setAsBox(5, 20,new Vector2(-25,15),0);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    fdef = new FixtureDef();
    //
    shape.setAsBox(5, 20,new Vector2(25,15),0);
    fdef.shape=shape;
    fdef.density=1;
    fdef.friction=0.5f;
    body1.createFixture(fdef);
    body1.setGravityScale(-3);
    body1.setBullet(true);
    return body1;

}
//BALLS CODE

private void spawner() {

    bbdef= new BodyDef();
    FixtureDef fdef = new FixtureDef();
    CircleShape circle = new CircleShape();
    bbdef.type=BodyType.DynamicBody;
    bbdef.position.set(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight());
    bbody = world.createBody(bbdef);
    circle.setRadius(5);
    fdef.shape=circle;
    fdef.density=0;
    fdef.friction=0;
    bbody.createFixture(fdef).setUserData("ball");
    bbody.setBullet(true);

}

sentences: GL_CLAMP_TO_BORDER - OpenGL ES 3 W want to use GL_CLAMP_TO_BORDER in my GL ES 3 app. Based on documentation (https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml), it seems to be supported, however, on iOS this #define is not present. Is it named differently? Maybe some extension?

sentences:
Baking details to a low poly model asset - used on enviroment or “world” geometry? Usually for the game objects a high poly model is prepared, to then transfer the details onto a low poly model, so that it can be rendered in realtime.

Is this workflow always used, with any object?

I imagine this is used for the polygonal models of the characters in general, but what about the rest?

I'm especially interested in the environment, like a snowy mountain for example. I do not think this high-poly to low poly detail baking workflow is appropriate for this case.

sentences:
My "puck" model object falls right through the "table" model in jMonkeyEngine So I am trying to learn jMonkey, I have understood everything so far, and I thought I understood how to make objects solid, so things can't go through each other. When I create my Collision shapes, I turn on the debugger which shows the shapes, and they appear correct. But when I run the code the puck falls right through the table and I have no idea why? I have been trying to learn from http://wiki.jmonkeyengine.org/doku.php/jme3:beginner:hello_collision.

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();

        AppSettings settings = new AppSettings(true);
        settings.setResolution(1024,768);
        settings.setFrameRate(60);
        app.setSettings(settings);

        app.start();
    }

    private BulletAppState bulletAppState;

    private RigidBodyControl    table_phy;
    private RigidBodyControl    puck_phy;

    @Override
    public void simpleInitApp() {

        bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);
        bulletAppState.getPhysicsSpace().enableDebug(assetManager);

        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
        rootNode.addLight(sun);

        cam.setLocation(new Vector3f(0.0f, -2.0f, 7.0f));

        initTable();
        initPuck();
        initPusher1();
        initPusher2();

    }

  //My hockey table
    public void initTable() {
        Spatial table = (Node)assetManager.loadModel("Models/airTable/airTable.j3o");
        table.setLocalTranslation(0.0f, -5.0f, -2.0f);
        CollisionShape tableShape = CollisionShapeFactory.createMeshShape((Node) table);
        table_phy = new RigidBodyControl(tableShape,0.0f);
        table.addControl(table_phy);
        rootNode.attachChild(table);
        bulletAppState.getPhysicsSpace().add(table_phy);
    }

    //My puck
     public void initPuck(){
        Spatial puck = assetManager.loadModel("Models/puck/puck.j3o");
        puck.setLocalTranslation(1.0f, -3.0f, 0.0f);
        CollisionShape puckShape = CollisionShapeFactory.createMeshShape((Node) puck);
        puck_phy = new RigidBodyControl(puckShape, 0.05f);
        puck.addControl(puck_phy);
        rootNode.attachChild(puck);
        bulletAppState.getPhysicsSpace().add(puck_phy);
    }
}

sentences:
libgdx calculate vector to find new points I am working with vector2 in libgdx.
I have (x1,y1) and magnitude 'M' with an angle 'D'.
How could I calculate (x2,y2) using vector2.

Thank You

sentences:
How can I use OpenCL in libGDX? Been looking for a way to implement some OpenCL stuff in my libGDX project. It's possible via LWJGL which libGDX is based on, but it's only for the Desktop environment.

I would like to have it cross platform as libGDX was meant to be used; how can I do that?

sentences:
Implementing a Custom Mouse Cursor in XNA I have tried making a custom mouse cursor, hiding the real mouse, taking the real mouse delta and clamping it to a maximum speed. Here is the problem:

In windowed mode, the "real" mouse cursor moves off the window while the custom mouse cursor (since it's movement is being scaled) is still somewhere inside the game window. This becomes bizarre and is obviously not desired, as clicking at this point means clicking on things outside the game window. Is there any way to accomplish this in windowed mode?
In fullscreen mode, the "real" mouse cursor is bounded to the edges of the screen. So I get to a point where there is no more mouse delta, yet my custom cursor is still somewhere in the middle of the screen and hence can't move further in that direction. If I wanted to clamp it to the edge of the screen when the real cursor is at the edge, then I would get an abrupt jump to the edge of the screen, which isn't desired either

Any help would be appreciated. I'd like to be able to limit the speed of the mouse.

sentences:
Queries regarding Geometry Shaders I am dealing with geometry shaders using GL_ARB_geometry_shader4 extension.

My code goes like :

GLfloat vertices[] =
    {
        0.5,0.25,1.0,
        0.5,0.75,1.0,
        -0.5,0.75,1.0,
        -0.5,0.25,1.0,
        0.6,0.35,1.0,
        0.6,0.85,1.0,
        -0.6,0.85,1.0,
        -0.6,0.35,1.0
    };

glProgramParameteriEXT(psId, GL_GEOMETRY_INPUT_TYPE_EXT, GL_TRIANGLES);

glProgramParameteriEXT(psId, GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_TRIANGLE_STRIP);

glLinkProgram(psId);

glBindAttribLocation(psId,0,"Position");

glEnableVertexAttribArray (0);

glVertexAttribPointer(0, 3, GL_FLOAT, 0, 0, vertices);

glDrawArrays(GL_TRIANGLE_STRIP,0,4);

My vertex shader is :

#version 150

in vec3 Position;

void main()
{
    gl_Position = vec4(Position,1.0);

}

Geometry shader is :

#version 150
#extension GL_EXT_geometry_shader4 : enable

in vec4 pos[3];

void main()
{
   int i;
   vec4 vertex;

    gl_Position = pos[0];
    EmitVertex();

    gl_Position = pos[1];
    EmitVertex();

    gl_Position = pos[2];
    EmitVertex();

    gl_Position = pos[0] + vec4(0.3,0.0,0.0,0.0);
    EmitVertex();

    EndPrimitive();
}

Nothing is rendered with this code. What exactly should be the mode in glDrawArrays() ? How does the GL_GEOMETRY_OUTPUT_TYPE_EXT parameter will affect glDrawArrays() ?

What I expect is 3 vertices will be passed on to Geometry Shader and using those we construct a primitive of size 4 (assuming GL_TRIANGLE_STRIP requires 4 vertices). Can somebody please throw some light on this ?

sentences:
specific function of class Time Is there a function that according to the name of the object, its tag and the time taken since the beginning of the game(for example time+=Time.deltaTime), gives the position of this object?

if yes which one?

thanks

from a rectilinear trajectory unknown to a randomly translated object, I need to press a Q key to know its direction vector. For this, I get the position of the object to the object. Q support and if I get the position of the object in the lapse of time preceding the moment of this support, the difference of these 2 positions gives me the direction sought of the trajectory at this moment.

When I have perfectly resolved this script, I will create another very similar one that will give me the vector direction of the rectilinear trajectory of the object at each collision on another object

Here is my script:

  Blockquote

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class script5 : MonoBehaviour {

//public GameObject sphere;
public static float t;
//public float laps_time;
public static float temps;
//public float difftime;
//float temps_appui;

float x1,y1,j1;
float x2,y2,j2;
float x3,y3,j3;

// Vector3 cat = transform.position;
    struct vecteur {
    public float k1;
    public  float k2;
    public float k3;

};

// Use this for initialization
    void Start ()
    {
        temps+=Time.deltaTime;

}

//fonction retournant la position d'un objet à un instant précis
vecteur function_script6(float t)

{
    vecteur v;
    v.k1 = 0;
    v.k2 = 0;
    v.k3 = 0;

    Vector3 cat = transform.position;

    if (temps == t) {
        v.k1 = cat.x;
        v.k2 = cat.y;
        v.k3 = cat.z;

    }

    return v;
}

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

    float temps_appui;
    public float difftime;
    public float laps_time;
    //t += Time.time;

    //donner les coordonnées de la sphère au temps où la touche Q est appuyée
    if (Input.GetKeyDown (KeyCode.Q)) {

        //donner les coordonnées de la sphère au temps où la touche Q est appuyée
        temps_appui = temps;
        difftime=temps_appui-laps_time;

        function_script6 (temps_appui);

        //donner les coordonnées de la sphère au temps juste avant l'appui de la touche Q
        function_script6 (difftime);

        x1=function_script6(difftime).k1;
        x2=function_script6(difftime).k2;
        x3=function_script6(difftime).k3;

        j1=function_script6 (temps_appui).k1;
        j2=function_script6 (temps_appui).k2;
        j3=function_script6 (temps_appui).k3;

        //donne le vecteur de la trajectoire de la sphère à l'appui de la touche Q
        y1=function_script6 (temps_appui).k1-function_script6 (difftime).k1;
        y2=function_script6 (temps_appui).k2-function_script6 (difftime).k2;
        y3=function_script6 (temps_appui).k3-function_script6 (difftime).k3;

        print ("(position appui:" + j1 + "," +j2 + "," + j3 + ")");
        print ("(position difftime:" + x1 + "," + x2 + "," + x3 + ")");
        print ("(vecteur trajectoire:" + y1 + "," + y2 + "," + y3 + ")");
        print ("-----------------------------");

}

}
}

almost everything is good except for the position of difftime which is always null.
Why?

sentences:
Animation works well on preview but not when hitting play I'm using a simple animation where I want to move an sprite just a little bit bellow its current position, and this works well on preview mode in the Animation tab.
But as soon as I hit play, the value I'm trying to animate is not the same as the one in the keyframe, the value is lesser than the one I setted. I don't know what I'm doing wrong... I'll append a clip showing this problem.
I already tried turning on and off Apply Root Motion and some alike questions, but none of the solution worked for me so far...

sentences:
How do I implement flat shading in GLSL? I'm working with GLSL and trying to implement flat shading on a 3D model (rather than smooth shading). To illustrate what I mean, here are two screenshots of cubes in Blender. Here's one with flat shading.

And here's the same cube with smooth shading.

I understand the theory behind this kind of shading. Each face on the cube (six total) has a normal facing away from the surface. Each vertex (eight total) has a normal computed by summing together face normals, then normalizing to unit length. This results in each vertex normal pointing directly away from the center of the cube.

Smooth shading can be implemented in basically two ways. In the first, color is computed per-vertex (using light direction and normal), then fragment color is interpolated among all vertices. In the second, normals themselves are interpolated, then color is computed per-fragment (using the same lighting calculations).

Here are my current GLSL shaders to implement the first option (there's no specular lighting yet, but it gets the idea across with ambient and diffuse). Vertex shader first.

in vec3 vPosition;
in vec3 vNormal;

out vec4 fColor;

uniform mat4 mvp;
uniform vec3 aColor;
uniform vec3 lDirection;
uniform vec3 lColor;

void main()
{
    gl_Position = mvp * vec4(vPosition, 1);

    vec4 ambient = vec4(aColor, 1);
    vec4 diffuse = vec4(max(dot(lDirection, -vNormal), 0) * lColor, 1);

    fColor = ambient + diffuse;
}

Then fragment.

in vec4 fColor;

void main()
{
    gl_FragColor = fColor;
}

So that works fine for smoothed shading, with fragment values interpolated among vertices. I'll also point out that I'm using buffers and index arrays for rendering.

For flat shading, each fragment on a face should instead use the same normal (such that every pixel on the surface has the same final color after lighting calculations). The problem is that I can't pass data to shaders per-face, but only per-vertex. Given this, I can think of three solutions.

Pass four vertices per face, with each vertex storing the face normal. This would still technically be smooth shading, but done in such a way that every interpolated pixel will use the same color (making if effectively flat). This approach seems wrong because it would basically ruin my vertex buffer, since I'd have to pass 24 vertices (four per face) despite the cube only containing eight unique vertices.
Use GLSL's flat mode (there's a flat keyword in GLSL). Using this approach, each fragment would only pull from a single "provoking vertex" rather than interpolating from all vertices on the face. This feels wrong because that I wouldn't actually be using the correct face normal. I also haven't been able to figure out the proper syntax for this style anyway. For the record, I'm aware of glShadeModel, but it's apparently deprecated.
Average vertex normals per fragment rather than interpolating them. To me, this feels like exactly the correct solution, since every pixel on a face would use the same normal, with that normal computed by summing and normalizing vertex normals (similar to how vertex normals are computed from face normals to begin with).

From those options, #3 clearly feels like the correct solution, but I haven't had any luck in figuring out how. So that's my question.

How can I tell the fragment shader to use a normal averaged among all vertices, rather than interpolated?

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:
Can I use a SkinnedMeshRenderer animation in a Canvas? I just downloaded an asset from the store: https://www.assetstore.unity3d.com/en/#!/content/67122

They're just animated characters. If you drag & drop the prefabs on the scene, it works fine.

The thing is, I work exclusively with Unity's new 2D Canvas/Image/Button/etc. These prefabs instead use a SkinnedMeshRenderer so it's not like you can put them inside your Canvas.

I want to have the prefabs work in my Canvas. For all intents and purposes I want those animations to act like a Image inside the Canvas.

This is what one of those prefabs looks like:

I want to take advantage of the Unity's canvas because it makes a lot of things easier - like scaling for all devices, scroll views, easy masks, etc.

sentences:
Strange problem with rotation missile | unity3d - c# I have a vertical missile with launcher that should find closest target and fire it's rocket to hitting target!

I use complete code of this 12min tutorial for launching my rocket, and the different between mine and its about the direction of rocket, mine is vertical and its horizontal!

homingMissile.velocity = transform.forward * missileVelocity;
Quaternion targetRotation = Quaternion.LookRotation(target.position - transform.position);
homingMissile.MoveRotation(Quaternion.RotateTowards(transform.rotation, targetRotation, turn));

After running the code, the rotation of my rocket change from (0,0,0) to (-8
.3,-4.7,0)!!!! and just change a little while hit target and explosion do.

In fact my rocket move to target in right path, but in wrong rotation!, in STRANGE!

Standby Rocket

Moving to Target

Anyone can help me for this problem?

sentences:
Why is my character jumping at different heights randomly? I have a character controller on my character's gameobject and I'm trying to make the character jump. This is working but sometimes he jumps way higher than other times. Does anyone know why this is happening? Here's the code:

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

public class Movement : MonoBehaviour
{
CharacterController cc;
public float Speed;
float Forward;
float Sideways;
float vertical;
public float gravity;
public float Jump;

// Start is called before the first frame update
void Start()
{
    cc = GetComponent<CharacterController>();
}

// Update is called once per frame
void Update()
{
    Forward = Input.GetAxis("Vertical") * Speed;
    Sideways = Input.GetAxis("Horizontal") * Speed;

    if (!cc.isGrounded)
    {
        vertical -= gravity * Time.deltaTime;
    }
    else
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            vertical = Jump * Time.deltaTime;
        }

        vertical = -8 * Time.deltaTime;
    }

   Vector3 Delta = transform.TransformDirection(Sideways, vertical, Forward);

    cc.Move(Delta * Time.deltaTime);
}
}

sentences:
Returning a List of coords for a sphere in order of inside to outside I'm looking for any algorithm that can return a list of Vector3 coordinates that form a sphere. If you read the list from the beginning it would appear the sphere was expanding.

The only algorithms I've found are for circles, the algorithm doesn't have to make a sphere of a particular radius, just a number of coordinates would be fine.

If anyone could point me in the right direction for such an algorithm that would be great. Any language or even just sudo code for a basic algorithm would be appreciated.

sentences:
Code reading difficulties with raycasting engine I'm trying to teach myself to program some basic engines.  I've been following this tutorial: http://www.playfuljs.com/a-first-person-engine-in-265-lines/ to get a decent idea of a basic way to render objects.

I'm confused, though, about certain items.  I remember that in JavaScript, one must declare and define variables and objects, to me it doesn't seem like this programmer defines objects and methods like "column" and "step".  For example, when he tries to find a ray's angle, he has these three lines of code:

var x = column / this.resolution - 0.5;
var angle = Math.atan2(x, this.focalLength);
var ray = map.cast(player, player.direction + angle, this.range);

The problem is, I'm trying to connect the dots and see how he defines "column", "angle", and "ray" and how they fit into the code at large, but in his tutorial I don't see those definitions everywhere!  So I have no idea how this code seems to fit together.  Is there something I'm missing?  Some library or built-in stuff with Javascript?

sentences:
Creating a content pipeline for a Unity I have a game with lots of assets, such as data files, images, etc. My understanding is that Unity is optimized to know about all resources at build time. i.e. binding those assets to Scene GameObjects or prefabs. And for performance reasons, dynamically loading files from the /Resources folder is discouraged.

My question is how can I set up a "content pipeline" for converting my asset files stored outside of Unity into a format that Unity expects.

With the XNA toolset you can create a separate project and "build" the content into a bundle. Is there way to achieve similar results in Unity? Or is the best I can do creating an external tool, and simply copying files into my Unity/Textures or Unity/DataFiles folder and generate the Unity metadata files myself?

If there isn't an off-the-shelf solution, do you have any experiences or recommendations with solving this problem?

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: Equivalent to Draw() method in Unity project? I have been using xna/monogame before this. So I read tutorials about unity, made some classes, loaded some sprites, everything "seems" to be going good, but I can't figure out how to add things into the environment, could anyone tell me or guide me to what's the equivalent of Monogame's Draw() method in Unity? Thank you.

sentences: How can I set up a loading screen in Panda3D? How would I go about using Double Buffering (to create a loading screen) in Panda3D using C++? I've searched Google and found some forums that talk about the concept of swapping buffers, but I haven't seen any that show any type of source code (specifically Panda3D/C++). I'd like to try and stay away from using pure OpenGL code and work it through Panda3D, but if I have no other choice, then I'll have to go with OpenGL coding.

sentences:
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: How can I go about testing games on a console I was wondering how I could play a game I've made on a console (PS3). I don't want to sell it or anything I just want to test it for now, also do I still have to do that whole registration thing to do this? Oh, I'm also using Unreal Engine 4 for this.

sentences:
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:
Difference between putting shaders in "Always Included Shaders" vs "Preloaded Assets" I am developing an mobile AR application with Unity AR Foundation. After a successful android build, I was told one of the shaders was not found.

ShaderNotFoundException: GLTF/PbrMetallicRoughness not found. Did you forget to add it to the build?

I realized I forgot to include one of the shaders that is only loaded at runtime.
I searched the internet and was taught to include the shader under Project Settings -> Graphics -> Always Included Shaders. That totally made sense but I was faced with the same problem everybody faced, the building takes ages as it compiles all my shader variants.
I stopped the build and opted for a method that was not mentioned by the internet, I went to Project Settings -> Player -> Optimization and included the shader under Preloaded Assets. The build was much faster and the shader was loaded correctly in my application.
At this point, my build error is solved but I can't help wondering if it is correct to do so. I am not seeing anyone mentioning about this method and there is not official documentation recommending including shaders under Preloaded Assets.
Could anybody help me out by explaining (hopefully) what these 2 methods actually do to my build, and what is considered the best practice to include the shaders?
I am using Unity 2020.3

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:
The SFML equivalent of polling to see if a key has been released? I'm testing out SFML by trying to make a square move with lerp velocity. The desired result was that when, let's say, D was pushed, the square would accelerate smoothly from velocity.x = 0 to velocity.x = maxVel (20). When
the D key is let go, it decelerates back to 0. The problem is, I can't get it to decelerate! When I let go of D, it keeps on going!

Player.cpp (only relevant code shown):

#include "Player.h"

void Player::input() {
    using Key = sf::Keyboard::Key;
    auto keyDown = [](sf::Keyboard::Key k) {
        return sf::Keyboard::isKeyPressed(k);
        };

    if (keyDown(Key::A)) {

        velocityGoal.x -= 3;
    }
    else if (keyDown(Key::D)) {
        velocityGoal.x += 3;
    }
    if(keyDown(Key::A) != true){
        velocity.x = 0;
    }
    else if (keyDown(Key::D) != true) {
        velocity.x = 0;
    }
    if (keyDown(Key::F)) {
        velocity = velocity; //just a breakpoint cue. Move along.
    }
}
void Player::update(float dt) {

    //interpolating velocity
    velocity.x = Math::interpolate(velocityGoal.x, velocity.x, dt);
    velocity.y = Math::interpolate(velocityGoal.y, velocity.y, dt);

        //capping out speeeeed
    if (velocityGoal.x > maxVel) {
        velocityGoal.x = maxVel;
    }
    if (velocityGoal.x < -maxVel) {
        velocityGoal.x = -maxVel;
    }

    //adding velocity to the player's position
    newPos += velocity;
    rect.setPosition(newPos);
}

void Player::draw(sf::RenderTarget& target) {
    target.draw(rect);
}

My interpolation function:

float Math::interpolate(float goal, float current, float deltaTime){
float diff = goal - current;
if (diff > deltaTime) {
    return current + deltaTime;
}
else if (diff < -deltaTime) {
    return current - deltaTime;
}

return goal;
}

It appears to be a problem with the if statements that set velocity.x to 0. SFML doesn't have anything like keyJustPressed or keyUp, so I just polled to see if keyDown(D) was not true. This evidently is not the right thing to do in this situation.

Does anyone know the right way to do this, or if there is some way I can track a key being released?

sentences:
Bullet Physic: Transform body after adding I would like to transform a rigidbody after adding it to the btDiscreteDynamicsWorld.
When I use the CF_KINEMATIC_OBJECT flag I am able to transform it but it's static (no collision response/gravity). When I don't use the CF_KINEMATIC_OBJECT flag the transform doesn't gets applied. So how to I transform non-static objects in bullet?

DemoCode:

btBoxShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));

/// Create Dynamic Objects
btTransform startTransform;
startTransform.setIdentity();

btScalar mass(1.f);

//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);

btVector3 localInertia(0,0,0);
if (isDynamic)
    colShape->calculateLocalInertia(mass,localInertia);

btDefaultMotionState* myMotionState = new btDefaultMotionState();
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colShape,localInertia);

btRigidBody* body = new btRigidBody(rbInfo);
body->setCollisionFlags(body->getCollisionFlags()|btCollisionObject::CF_KINEMATIC_OBJECT);
body->setActivationState(DISABLE_DEACTIVATION);

m_dynamicsWorld->addRigidBody(body);

startTransform.setOrigin(SCALING*btVector3( btScalar(0), btScalar(20), btScalar(0) ));

body->getMotionState()->setWorldTransform(startTransform);

sentences:
Matrix transformations vs manipulating vertex data directly I was wondering whats more efficient to do if you want to transform a mesh. 1) Transforming a matrix and pass that to a shader or
2) Manipulate the meshs vertex data directly

I was wondering because LibGDX is using the second option to transform sprites. And calculating the translation, rotation and scaling for every mesh every frame seems a bit too much, since you have to change the vertex data every frame too.

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:
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:
How to properly activate trigger objects? I have made a flying cat that follows the player, but I want the cat to be a separate object. Cat is following the player and as soon as it sees a collectible it grabs it for the player and then returns following our player. I have it working, but I need the cat to be a different object, it only triggers properly when it's a child of the player object. I have made two scripts for the cat, one for detection, following, flying and the other for destruction of collectibles.

AI script

void OnTriggerStay2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        //Destroy(col.gameObject, 1F);
        if(positionList.Count <= 0){
        positionList.Add(col.transform.position);
        timerDelay = 1F;
        mustReturn = false;
        }
    }
}

void OnTriggerEnter2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        positionList.Add(col.transform.position);
        timerDelay = 1F;
        mustReturn = false;
    }

}
void Update () {

    if (mustReturn) {
    //  positionList.RemoveAt(0);
        transform.position = Vector3.MoveTowards (
            transform.position, player.transform.position, Time.deltaTime * speed);

    }

    if (timerDelay > 0) {
        timerDelay-= Time.deltaTime;
        idleDelay = 0;

        if(positionList.Count > 0) {
        foreach (Vector3 nextPos in positionList)
        {
            transform.position = Vector3.MoveTowards (
            transform.position, nextPos, Time.deltaTime * speed);

        }
    }

}

    if (timerDelay <= 0) {

        if(positionList.Count > 0) {
            positionList.Clear();
            timerDelay = 1F;
        }

        if(positionList.Count <= 0)
        mustReturn = true;
    }

    if (idleDelay >= 3F) {
        idleAnimation();
    }

    /*Debug.Log ("pos count is " + positionList.Count);

    if(timerDelay > 0)
        Debug.Log ("delay is " + timerDelay);*/

    idleDelay += Time.deltaTime;

}

void idleAnimation(){

}

void OnTriggerExit2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        mustReturn = true;
    }
}

Destruction class

void OnTriggerStay2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {
        Destroy (col.gameObject, 0.5F);
    }
}

void OnTriggerEnter2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {

    }

}
void OnTriggerExit2D(Collider2D col){
    if (col.CompareTag ("Collectable")) {

    }
}

Question: Why won't the cat function on it's own???

Collectibles DO have that tag, and they DO have a Box Collider 2D along with a 'Trigger: true'

Cat:

sentences:
UV Tiling & Offset input values from World Position - incorrect behavior? I'm using ShaderGraph in 2020.1.0f1. I have some shader experience, but it's all been handwriting shaders. I have experience with node-based things of this nature by way of Substance Designer. I'm working on a shader that should allow for seamless visibility between quads by changing the UV offset of a noise pattern based on the world position of the quad.
That said, I'm running into two things. This short (0:05) video shows how I'm expecting this to work - as the X/Y values of the UV Offset are changed, the continuous flow of the noise is smooth.
https://youtu.be/YAd9BtAWVRM
So, I add a position node and a split node, feed the world position into the split, and feed R/G from the split to X/Y of the Vector2 node. That does two things: it makes the preview boxes 3D (becomes a sphere instead of a quad), and "expands" the apparent tiling:

I'm guessing this is because the value from the split is a Vector1 rather than a float, though it seems odd that there's no implicit conversion, or that Vector1 values applied to UV Offset would change the actual appearance.
So, is this due to it being a Vector1 rather than a float? If so, is there a node that can convert from Vector1 to float? Am I going about this the wrong way entirely?

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:
How can I use a data grid to make an isometric turn based game in GameMaker? I am making a Hero Quest clone. It is a turn based adventure game with an isometric view point. So far I have been able to turn a 2D map into an isometric view but I believe I need to use a data grid to achieve turn based movement, combat etc.

There are plenty of tutorials on data grids but none that I can find on how to translate a 2D grid to a psedo-3D isometric game.

How could I do it?

sentences:
Representing feelings such as temperature, pain, smell, taste, hunger, and thirst immersively In a totally immersive, simulation-type role-playing game, the player should not look at bars or numbers to keep track of his or her stats, so another method of showing these stats is needed.  For example, the player needs to know when to eat, because games (currently) cannot incite a real feeling of hunger.  The player also needs to know if they are hurt, so they can take appropriate measures.

Somehow, these feelings must be represented visually or audibly.  I'm not a fan of coloring and blurring the screen to show feelings like how most first-person shooters show that you have been shot.  What are some ways to represent these feelings immersively?

sentences:
What is more performance friendly? I'm wondering what is more performance friendly:

1) Rendering a texture (in a seperate RenderTarget2D) and reuse it. (That will use multiple spriteBatch.End() / spriteBatch.End() calls, every drawing cycle)

2) Rerendering the texture multiple times (directly on the default rendertarget), but using only a single spriteBtach Begin/End call.

I think it is pending on how many times I'm going to redraw that texture, but calling spriteBatch.End() / spriteBatch.End() is taking really much performance...

So what should I use, when the redrawing count is pending on the user?

sentences:
How can I protect beta test versions of my game from piracy? I want to open my game for public feedback and testing quite early as such certain features like steams coming soon might not be available.

How could I protect my game against being pirated around from testing?

Even if we dis-regard piracy I'd not want the testers running random copies of the game whenever etc.

sentences:
How to check/read multiple elements of the same arrayList at the same time in Java? Im making an rpg game and right now I'm working on crafting. I've made a crafting slot class, and an arrayList of that class. I've got 10 of those slots in total, 9 placed in a 3x3 'order' and 1 below (like the minecraft inventory). I want to check if the 9 slots contain some items in a particular way, and if they do to put a item in the 10th slot. I can figure out how to craft stuff, but I don't know how to read all those 9 slots at the same time (btw Im using an enhanced for loop to update and render all of 'em). I figured I would check if the slots contain items in this order

4 4 4
0 3 0
0 3 0

(4 being stone and 3 being the stick item)
Each slot has its own item variable. So how can I access all of them at the same time? Or even if there is a simpler way to do this.
Thank you

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:
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:
Why do I get this error when setting up Android support for Game Maker? Game Maker asks me to install the Android SDK API 13 for it to work. I opened the SDK Manager and clicked at API 13 but I wasn't able to click the "install packages" button.

I clicked at the obsolete and then I was able to install. But when I pressed "Accept Licence" I wasn't able to click install as an error came out:

Package Google Tv Addon, Android API 13, revision 1 (Obsolete) depends on Missing SDK Platform Android, API 13".

Any help would be much appreciated.

sentences:
ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND I've stared at this for at least half an hour now and I cannot figure out what directx is complaining about.  I know this error normally means you put float3 instead of a float4 or something like that, but I've checked over and over and as far as I can tell, everything matches.

This is the full error message:

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

This is the vertex shader's input signature as seen in PIX:

// Input signature:
//
// Name                 Index   Mask Register SysValue Format   Used
// -------------------- ----- ------ -------- -------- ------ ------
// POSITION                 0   xyz         0     NONE  float   xyz
// NORMAL                   0   xyz         1     NONE  float
// COLOR                    0   xyzw        2     NONE  float

The HLSL structure looks like this:

struct VertexShaderInput
{
    float3 Position : POSITION0;
    float3 Normal : NORMAL0;
    float4 Color: COLOR0;
};

The input layout, from PIX, is:

The C# structure holding the data looks like this:

[StructLayout(LayoutKind.Sequential)]
public struct PositionColored
{
    public static int SizeInBytes = Marshal.SizeOf(typeof(PositionColored));

    public static InputElement[] InputElements = new[]
    {
        new InputElement("POSITION", 0, Format.R32G32B32_Float, 0),
        new InputElement("NORMAL", 0, Format.R32G32B32_Float, 0),
        new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 0)
    };

    Vector3 position;
    Vector3 normal;
    Vector4 color;

    #region Properties
    ...
    #endregion

    public PositionColored(Vector3 position, Vector3 normal, Vector4 color)
    {
        this.position = position;
        this.normal = normal;
        this.color = color;
    }
    public override string ToString()
    {
        StringBuilder sb = new StringBuilder(base.ToString());
        sb.Append(" Position=");
        sb.Append(position);
        sb.Append(" Color=");
        sb.Append(Color);
        return sb.ToString();
    }
}

SizeInBytes comes out to 40, which is correct (4*3 + 4*3 + 4*4 = 40).  Can anyone find where the mistake is?

sentences:
Issues to display a texture loaded with libPNG with opengles 3.0 I'm trying to load a texture loaded with libPNG on a XY coordinates. I know the width and the height of the texture (32x32).

The texture is already loaded successfully and I have his Id.

Here is my function to print any (32x32) texture on a XY position :

void printTexture(GLuint idTexture, GLfloat x, GLfloat y) {
    glActiveTexture(GL_TEXTURE0);
    glBindVertexArray(this->VAO[0]);
    glUniform1i(this->mTagShaderHandle, 0); //to execute a particular code on the Pixel Shader
    glUniform1i(this->mTextShaderHandle, 0); //the uniform Sampler2D from my Fragment Shader bound to 0.

    GLfloat xpos = x;
    GLfloat ypos = y;

    GLfloat w = 32;
    GLfloat h = 32;

    GLfloat vertices[6][4] = {
            { xpos,     ypos + h,       0.0, 0.0 },
            { xpos,     ypos,           0.0, 1.0 },
            { xpos + w, ypos,           1.0, 1.0 },

            { xpos,     ypos + h,       0.0, 0.0 },
            { xpos + w, ypos,           1.0, 1.0 },
            { xpos + w, ypos + h,       1.0, 0.0 }
    };

    glBindTexture(GL_TEXTURE_2D, idTexture);
    checkGlError("glBindBuffer");

    glBufferSubData(GL_ARRAY_BUFFER, GL_ZERO, sizeof(vertices), vertices);
    glDrawArrays(GL_TRIANGLE_STRIP, GL_ZERO, 6);
    glBindVertexArray(GL_ZERO);
    glBindTexture(GL_TEXTURE_2D, GL_ZERO);
}

Here is how I initialize my VAO and VBO :

glBindVertexArray(this->VAO[0]);
glBindBuffer(GL_ARRAY_BUFFER, this->VBO[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 6 * 4, GL_ZERO, GL_DYNAMIC_DRAW);
glEnableVertexAttribArray(GL_ZERO);
glVertexAttribPointer(GL_ZERO, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), GL_ZERO);
glBindVertexArray(GL_ZERO);

Here is how I set up my texture:

glTexImage2D(GL_TEXTURE_2D, GL_ZERO, GL_RGB, temp_width, temp_height, GL_ZERO, GL_RGB, GL_UNSIGNED_BYTE, image_data);
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);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

And my Vertex Shader :

const char           gVertexShader[] =
        "#version 320 es\n"
        "layout (location = 0) in vec4 vertex;\n"
        "out vec2 TexCoords;\n"
        "uniform mat4 projection;\n"
        "uniform int tag;"
        "void main() {\n"
                "  gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n"
        "  if (tag > 0) {\n"
        "      TexCoords = vertex.zw;\n"
        "  } else {\n"
        "      TexCoords = vertex.xy;\n" //here is the code that should be executed by the pixel shader program because Tag = 0.
        "  }\n"
        "}\n";

The texture is not displaying at all. I tried a lot of things but nothing change. I should keep this pixel shader because I have some functions to print texts so that's why I have the if/else statement on my Pixel Shader code.

What's wrong with my code ?

Thanks a lot for help.

sentences:
Unity Player Movement Script nullifies gravity i want my Player to be affected by gravity, while being able to be moved in horizontal direction(the Player jumps up and down), but my script:

Vector3 move = new Vector3(Input.GetAxis("Horizontal"), (Input.GetAxis("Vertical")), 0);

transform.position += move * speed * Time.deltaTime;

...seems to nullifiy gravity. Can someone tell me how to fix that?

sentences:
why doesn't work this example I am new to game development.

I was trying to use this http://blog.gemserk.com/2012/07/03/drawing-a-projectile-trajectory-like-angry-birds-using-libgdx/  projectile example in eclipse android using java language

What mistake did I make? How to do.

Here my code:

import android.content.Context;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.graphics.Canvas;

import android.util.Log;

import android.view.MotionEvent;

import android.view.SurfaceView;

import android.view.View;

import com.badlogic.gdx.math.Vector2;

public class Example extends SurfaceView {

public float x;
public float y;

public static class ProjectileEquation {

    public float gravity = -10;
    public Vector2 startVelocity = new Vector2();

    public Vector2 startPoint = new Vector2();

    public float getX(float t) {
        return startVelocity.x * t + startPoint.x;

    }

    public float getY(float t) {
        return 0.5f * gravity * t * t + startVelocity.y * t + startPoint.y;
    }
    {
        Log.i("ProjectileEquation", "Create!");
    }

}

public static class Controller {

    public float power = 50f;
    public float angle = 0f;

}

public Example(Context context) {
    super(context);
    Log.i("Example constructor ", "Create!");
    Example.projectile yyy = new Example.projectile(context);
    Log.i("run", "Create!");
    this.x = yyy.x;
    this.y = yyy.y;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    super.onTouchEvent(event);

{
        Log.i("OnTouch", "Create!");
    }

    x = event.getX();
    y = event.getY();

    return true;

}

public static class projectile extends View {
    public float x;
    public float y;
    private Controller controller;
    private ProjectileEquation projectileEquation;

    public int trajectoryPointCount = 30;
    public float timeSeparation = 1f;

    private Bitmap bmp;

    public projectile(Context context) {
        super(context);
        Log.i("Projectile constructor ", "Create!");
        this.controller = new Controller();
        this.projectileEquation = new ProjectileEquation();
        this.projectileEquation.gravity = -10;
        bmp = BitmapFactory.decodeResource(getResources(),
                R.drawable.ic_launcher);

           {
            projectileEquation.startVelocity.set(controller.power, 0f);
            projectileEquation.startVelocity.rotate(controller.angle);

        }
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        float t = 0f;

        float width = this.getWidth();
        float height = this.getHeight();

        float timeSeparation = this.timeSeparation;

        for (int i = 0; i < trajectoryPointCount; i++) {
            float x = this.x + projectileEquation.getX(t);
            float y = this.y + projectileEquation.getY(t);

            canvas.drawBitmap(bmp, x, y, null);
            canvas.drawBitmap(bmp, width, height, null);
            t += timeSeparation;

        }
    }

}
}

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:
Workflow to animate character rig with an already animated model How should I go about animating character rigs (walking, running, ducking, ...) with already animated assets? Do I load the animated asset into the project file of my character rig or do I attach the animated asset to the rig in the engine?

I am using Blender for the models and Unity3D as the engine.

sentences:
What benefits does a game design degree have for a hobby game programmer? I am interested in studying game design, not because I want a job in the games industry, but because I am interested in the subject itself. I read the following questions, but they mostly deal with the effects on your career in game industry.

Should I consider a graduate degree in game development?
Game Development Degree vs Computer Science Degree

First I thought a game development degree could be beneficial. But from the websites of colleges that offer such degrees, I feel like its more about basic programming with examples from games.

This college offers game design degrees, for example.

My question is, can I benefit from such a degree when I already have a degree in Computer Science, I already know programming, I'm already developing a game and finally, I have this site to help me when I get stuck?

sentences:
How to balance experience gain with player collaboration? I'm developing an online game with friends, and we're currently blocked by a overall game design issue: how do you reward players with experience points and loot/gold yet still encourage them to play together, especially with players who are not necessarily in their skill range?

Technical details of our game:

Grid-based, top-down overworld map layout (think Legend of Zelda)
Randomly generated, turn-based dungeons (think Pokemon Mystery Dungeon)
Experience curves, non-combat skills, trading, social interaction (think Runescape)

The plan is for players to socialize, do parts of quests, and skill in the overworld, then enter dungeons with groups of ~4 friends into order to skill combat and get loot. Ideally, more skilled players can enter harder dungeons and do harder tasks, yet still be able to join newer players in easier dungeons without it being mundane and without forcing one player to take up most of the combat.

Possible fixes:

Remove all sorts of experience curves and rewards, and have everything be balanced (downside: no reason to grind)
Restrict "leveling" to gaining more money and better weapons (downside: having more loot virtually becomes being a higher level)
Raise low-leveled players to the level of the highest-leveled team member when in dungeons (downside: may be a loophole to allow players to skill quickly)
Add an extra component of the game that requires user skill, so players won't rely solely on levels to be good at the game (e.g. quick time events) (downside: hard to implement in a turn-based game, ambiguous)

These are just some ideas, and I have been pondering this issue for a little while now. What are some thoughts on this issue and what mechanic may be introduced to reconcile this?

sentences:
How to keep track of previous scenes and return to them in libgdx I have three scenes: SceneTitle, SceneMenu, SceneLoad.

(The difference between the title scene and the menu scene is that the title scene is what you see when you first turn on the game, and the menu scene is what you can access during the game. During the game, meaning, after you've hit "play!" in the title scene.)

I provide the ability to save progress and consequently load a particular game. An issue that I've run into is being able to easily keep track of the previous scene. For example, if you enter the load scene and then decide to change your mind, the game needs to go back to where you were before; this isn't something that can be hardcoded.

Now, an easy solution off the top of my head is to simply maintain a scene stack, which basically keeps track of history for me. A simple transaction would be as follows

I'm currently in the menu scene, so the top of the stack is SceneMenu
I go to the load scene, so the game pushes SceneLoad onto the stack.
When I return from the load scene, the game pops SceneLoad off the stack and initializes the scene that's currently at the top, which is SceneMenu

I'm coding in Java, so I can't simply pass around Classes as if they were objects, so I've decided implemented as enum for eac scene and put that on the stack and then have my scene managing class go through a list of if conditions to return the appropriate instance of the class.

How can I implement my scene stack without having to do too much work maintaining it?

sentences:
Splitting a texture atlas into seperate images Possible Duplicate:
  How to decompose sprite sheet

I'm doing a port of an existing game and the designer no longer has all of the original art; he only has the resulting texture atlases he used when developing for iPad.  The tool I'm using won't support these files so I need to break them back out into separate PNG files.

I'm hoping someone knows of a software tool that does this.  PC software would be preferred in this case, but Mac would suffice.

Edit

To add some clarification; these texture atlases are in a simple gridded layout with even distribution and not packed.  No need to tie back to descriptor files; I just need a simple animation splitter type of tool where I can tell it the size of a frame, point it to the image and from that get a set of separate images.

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:
Android: Asynctask causes ANR (very) intermittently I'm doing some work on an AsyncTask (creating game objects, loading resources etc) while displaying a static splashscreen.

The problem is that every now and then, the AsyncTask doesn't run and the app becomes unresponsive.

I must point out that this is extremely difficult to reproduce.  So far today, I've un-installed my app and re-launched it 73 times so far (no joke) and it's behaved perfectly.  However, yesterday (again, after un-installing and installing many many times), I saw the issue about 4 times.  It's very random.

What I'm asking is, if there is anything that I am doing obviously wrong here (or not doing, that I should be)?.

I am:

Targeting Gingerbread, although so far, have only seen this issue on a tablet running Lollipop 5.0.1 (But this may simply be because this is my main test device)
Not sure if I should be doing any 'clean up' in onDestroy?
Am using only 1 AsyncTask - in most of the similar questions that I have read, it seems people are using more than one AsyncTask??
Am starting it from the UI Thread

Also this problem only seems to happen when installing / running from Eclipse. (ie, hitting the run button).  Once it becomes unresponsive, I can close the app and relaunch it straight from the device and it always works OK.

I have checked in onDestory and can confirm the AsyncTask's status is 'finisihed' (obviously only when the app launches OK, not when it crashes) although I'm not performing any specific clean-up work.

Any ideas?

Some Code:

In my onCreate method:

@Override
protected void onCreate(Bundle savedInstanceState) {

    //Only showing code here pertienent to the question (AsyncTask Stuff)
    myAsync= new LoadResources(newBundle);
    myAsync.execute();

}

protected Void doInBackground(Void... params) {

    //It appears that, when the app becomes unresponsive, this my not be reached
    Log.v("tag","DoInBackground");

    //Here I am just creatin game objects, loading sounds and putting some values into sharedPreferences

    return null;
}

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:
Top down four directional movement snap to tiles, not feel like crap I want to make a topdown rpg movement, I need to update these parameters based on user input:
User input four directions: ⬆⬇⬅➡ .
Update parameters

Position: x, y,
Flip sprite: flipx, flipy,
Sprite number: s, eg: 1 for horizontal sprite, 17 for vertical sprite
Sprite Animation: si, eg: 1 to 4 for walking animation

This is my crappy implementation:
function _init()

p = {
   t=0,
   x=0,
   y=0,
   dx=0,
   dy=0,
   mtimer=0,
   s=1,
   si=0,
   flipx=false,
   flipy=false
}
end

function _update()

   local input_x = 0
   local input_y = 0

   if btnp(⬆) then
      input_y = -1
   elseif btnp(⬇) then
      input_y = 1
   end

   if btnp(⬅) then
      input_x = -1
   elseif btnp(➡) then
      input_x = 1
   end

   if p.dx == 0 and p.dy == 0 then
      if input_x != 0 then
         p.dx = input_x
         p.mtimer=4
      elseif input_y != 0 then
         p.dy = input_y
         p.mtimer=4
      end
   end

   if p.mtimer > 0 then
      p.mtimer -= 1
      p.t += 2
      p.x += p.dx * 2
      p.y += p.dy * 2
      if p.mtimer == 0 then
         p.dx = 0
         p.dy = 0
      end
   end
 p.t += 0.5

   if p.dx != 0 then
      p.s = 1
   elseif p.dy != 0 then
      p.s = 17
   end

   p.flipx = p.dx == 0 and p.flipx or p.dx < 0
   p.flipy = p.dy == 0 and p.flipy or p.dy < 0

   p.si = flr(p.t % 30 / 30 * 4)

end

function _draw()
   spr(p.s + p.si, p.x, p.y, 1,1, p.flipx, p.flipy)
end

This is the end result:

As you can see it's so bad looking, I want you to implement this movement so it's fun and juicy. Or what can I do to improve the looks and feel of this.

sentences:
Pathfinding with Less Desirable Squares that are still passable I have been looking at different path-finding algorithms for my game. I have almost settled upon D* Lite, but have a question. (perhaps I missed it in the documentation) -
Are there any algorithms, D* included, that allow for squares that are less desirable to pass over, but still possible, should there be no other way? I believe that I saw this in A* but I believe that I need it dynamic, as I will be having objects placed and removed from the map.

UPDATE: Is it possible to have levels of undesirable squares? Eg. Some still arent desirable, but are better than really undesirable ones

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:
How do I use more than 32 textures in my game? I'm building a game in OpenGL, relying on shaders as much as possible because python. However, I think I've been working under a misunderstanding of OpenGL since I started.

I've abstracted stuff into a homemade shader class/object that takes vertices and images, and turns them into VBOs and textures, and a draw() function. Not realizing there was a small limit on the GL_TEXTURE_* stuff, I was giving each one its own texture slot (as I'm thinking of them). I also hadn't yet bothered making sure the same models were using the same shader. You can see how I was running into problems.

So, just how do you deal with using more than 16/32/GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS textures in a frame? If I have floor, a player, three NPCs, four types of tree and a house, (each with unique textures) how am I going to add a fridge?

sentences:
How to do one-way collision? I would like to know how can I do one way collision. It's the collision common in mario's games and many platforms. I try to do an code but I cannot post because it's part of a paid game.
Basically I have two rectangles like this:

struct Rect {
  int x, y; // positions in the world
  int w, h; // width and height
};

The rect A moves and the rect B is fixed with the world.
Someone has a idea of how to do this?

sentences:
Assigning relative force to a projectile fired while orbiting a sphere Projectile Not Correctly Inheriting Parent Velocity (Unity3D)

So I am trying to incorporate the above person's changes into a script I am making although

I'm no great coder and
I'm not even sure their solution works best for what I am doing.

Essentially what I have right now is a high speed shooter where the player is being pushed around as a physics object on a sphere world rather than using translate for movement. I keep finding solutions that would work really well if I was just translating through xyz space. Using a physics object for my projectile has been working well (I can shoot in one direction and have the projectile hit my in the back after circling around) but once I get up to speed I'm in trouble.

I think I've successfully incorporated the projectile portion into my script but currently it keeps shooting on the positive z axis.

On top of that, I'm not even sure where to start incorporating the second half.

Emitter Script

using UnityEngine;
using System.Collections;

public class SpaceShoot : MonoBehaviour
{
public GameObject Bullet_Emitter;
public GameObject Bullet;
public GameObject target; // Player

public float Bullet_Forward_Force = 100;
public float Bullet_Life = 60;
public float fireInterval = 0.05f;

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        InvokeRepeating("Fire", float.Epsilon, fireInterval);
    if (Input.GetKeyUp(KeyCode.Space))
        CancelInvoke("Fire");
}

void Fire()
{
    GameObject Temporary_Bullet_Handler;
    Temporary_Bullet_Handler = Instantiate(Bullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;

    Rigidbody Temporary_RigidBody;
    Temporary_RigidBody = Temporary_Bullet_Handler.GetComponent<Rigidbody>();

    Temporary_Bullet_Handler.transform.Rotate(Vector3.left * 90);

    Rigidbody target_rigidbody;
    target_rigidbody = target.GetComponent<Rigidbody>();

    Temporary_RigidBody.velocity = target_rigidbody.velocity;

    Temporary_RigidBody.AddForce(transform.forward * Bullet_Forward_Force);

    Destroy(Temporary_Bullet_Handler, Bullet_Life);
}
}

Edited script as it currently stands. It mostly does what I need although I'm trying to figure out a way to clamp the distance to the origin.

sentences: Free physics library? What are some good recommendations?  I have a vertex buffer and indices and I want to be able to detect collision between it and a bounding box or another object.

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:
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:
Can I sell games made with LibGdx on Steam my question is pretty self-explanatory, there is any technical or legal issue in selling libgdx games on steam?

EDIT

It is possible to show some kind of evidence, maybe a exemple of a game that is made with libgdx and already is on steam?

sentences:
I have 240 prefabs to scatter, what is the best way to achieve this? I'm creating a huge city for which I've made 240 different building prefabs. Now I need to scatter those prefabs randomly with a height, width and depth and rotation randomness variation.
I thought the prefab scatter tool provided by the polybrush package was perfect for the job, but as soon as I added more than 50 prefabs to the prefab palette, it started to glitch and act weird. The variation settings also seem to be uniquely saved  for each prefab, but I'd like to have 1 set of settings for all prefabs.
These points make me believe polybrush wan't made for scattering  a large amount of prefabs (unless I'm missing something?)
Are there any other tools that can assist me with this?
Thanks in advance.

sentences:
OnMouseClick not detected I created "main script" and in Start() created simple cube:

GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.localScale = new Vector3 (1,2,1);
cube.GetComponent<Renderer>().material.color = new Color(0,0,255);
cube.AddComponent<CubeScript>();

and then in CubeScript I have empty Start() and Update() but in onMouseDown() just Debug.Log("click detected");

and I can never see log despite clicking on cube.. Any advice? did I missed something?

sentences:
How to avoid using static variables When developing with libGDX, you can often read, that your should not use static variables if you plan to eventually release your game on android later.

But while trying to follow that rule, I often ran into problems where I need to use an object only once and keep it accessible from everywhere at the same time.

For example, Im developing on a game which uses an ECS-Approach where different Systems need to use the EventManager-Object to communicate with each other. By default, I would make EventManager static so I can call it from multiple Systems like that EventManager.register(EventType.TYPE_01, this) and EventManager.callEvent(EventType).

How can I avoid using static variables? Is there a best practice design pattern for something like that?

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:
AS3 random events using a timer I'm making a game for an assignment at university.
The game I am making requires random household appliances around a house to "turn on" at random times.
The player must run around the house turning this off.

I am confident with the rest of the code for the game, but the random turning on is what I'm not sure on.

I am thinking the solution would be to use an array with all my appliances pushed into into, then create a timer event.
From this a random time would be picked from the timer, and then a random appliance would be picked from the array. The appliance on animation would then be displayed until the player clicked on it to turn it off.

Only problem is i'm not sure how to start this.

Also worth mentioning, I am only able to use flashdevelop and AS3 for this project, so no Adobe Flash.

Thanks in advance,

Job4aCowboy

sentences:
Top down 2D game: hole tiles I'm making a top down 2D game in Unity, here's my doubt: how can I add "hole" tiles to it, so the player could fall (something like Zelda: Link to the past, or the water tiles in Enter The Gungeon)?

The solution I thought is to put tags on each tile (ground, hole, trap, etc), put the player on Z = -5 and use the 3D Physics.Raycast to check in which tile the player is. But that doesn't seem optimized, I would need to spam colliders in every tile and use the Raycast at each frame. Can you guys give me better alternatives?

Thanks a lot! :)

sentences:
Raycasting from 3D object to UI canvas! I have a world space canvas in front of the player and I want to shoot a ray towards an enemy (in the direction of the enemy) and create and object where Raycast hits the UI canvas.
I know that the physics engine doesn't interact with UI elements and event system is not the answer for me since it depends on pointer events and their position.
So how can I do this?
If possible, I would like to draw the ray or the line as gizmo to see if it's working.
My Current Code is this:

void OnDrawGizmos()
{
    foreach (AeroplaneAiControl item in GameObject.FindObjectsOfType<AeroplaneAiControl>())
    {
        Gizmos.color = Color.magenta;
        Gizmos.DrawLine(transform.position, item.transform.position);
        Vector3 Direction = transform.position - item.transform.position;
        RaycastHit rch;
        Ray r = new Ray(transform.position, Direction);
        Physics.Raycast(r, out rch);
        if (rch.collider != null)
        {
            Gizmos.color = Color.cyan;
            Gizmos.DrawLine(transform.position, rch.point);
            Gizmos.DrawSphere(rch.point, 0.1f);
        }
    }
}

it draws the magenta line but not the cyan line and no spheres.

sentences: Analyzing movement data for a checkerboard For a psychology experiment - subject has to learn that the 2D grid is a checkerboard, and collect all the 1s (rewards). How do I test if subjects are actually doing it in the most optimal way -- making least effort for moving from one square to the next by taking smaller steps (or selecting closest reward neighbour). My guess is that if I could simulate a learning algorithm and approximate how long it takes to learn the reward distribution, and then explore it optimally (optimality is defined as a unit of time and exploring closest squares first), I could compare the behaviour.

sentences:
Can't parent the standard FPSController during gameplay I'm parenting the standard assets FPS controller during play with a simple script. The controller get's parented but also instantly inherits the rotation of the parent. This doesn't happen in Editor mode. This incorrect behavior happens regardless if I move the player with a script or by parenting him with my mouse cursor.

I suspect the error comes from the way the character controller script is set up.

In the FPS controller script the player rotates via mouse movement in the Update function in the following way:

private void Update()
{
    RotateView();
}

private void RotateView()
{
    m_MouseLook.LookRotation (transform, m_Camera.transform);
}

m_MouseLook get's its rotation from m_Camera.transform. It in turn uses transform.localPosition.

I think it's the use of localposition that causes the strange behavior.

How do I fix it?

I added the script that I used to re-parent the fps controller below:

    public Transform ParentTarget;
    public GameObject player;

     void OnTriggerEnter(Collider other)
    {
        player.transform.SetParent(ParentTarget, true);
    }

     void OnTriggerExit(Collider other)
    {
        player.transform.parent = null;
    }

As I said the script is fairly simple and the same error happens when I re-parent the controller by dragging it with my mouse during play.

If I set worldPositionStays to false then the player is offset and doesn't inherit the parent rotations at all. This isn't what I want.

Here is my scene before the player steps unto the trigger. The red box is the trigger. The blue box is the new parent (the parent is rotated 45 degrees)

Here is the original incorrect behavior. The player is instantly rotated 45 degrees as he steps unto the trigger. This is wrong

Here is the behavior when worldPositionStays is set to false. Rotating the parent has no effect. This is wrong.

The desired behavior is to keep the player rotation, and then change it as the parent is rotating after the re-parenting event. This is what would happen if I re-parented any ordinary GameObject.

It is the character controller mouse look part that is most likely causing all the trouble.

I suspect I have to abandon the re-parenting solution and simply add the transforms to the camera mouse look part of the character controller script.

I would be very grateful is someone more knowledgeable would help me out with achieving this. Hopefully by getting re-parenting to work, since it is simpler, and simplicity is always king. I would settle for help with writing a script to add rotations and positions correctly to the controller.

sentences:
Using dom elements for game interaction - slow performance I have a need for my html5 game (using melonjs) to allow users to click tile areas on the map. The idea is it will show a css styled hover area. The browser tested is chrome.

I could do this natively in the game engine but the styling options available for canvas entities is limited. So I went with creating a dom element for each item in the canvas map. As the player moves, I update only the positions of the dom elements which are on the viewport.

Probably 70 total elements are created and only 2-3 are on the screen updating at any given time.

I'm pretty surprised how slow it's making my browser.

So my questions are:

why would updating 2-3 elements as the player moves be so slow?
is it better to remove elements when offscreen then readd when they are back on, even though they arent updating as they move off screen?
should I just scrap the dom solution altogether and rely on the api the canvas and game engines provide for styling

sentences:
How to get the position in an actor inside a table with LIBGDX? Well the title says it all, I want to get the position of an actor inside a table

Button button = new Button(bs);
table.add(button).width(50).height(50);
table.top().center();

By using

button.localToStageCoordinates(new Vector2(button.getX(), button.getY()));

I get a near position but not exact, here is an screenshot, red squares are the positions I'm getting, while the transparent squares are the buttons.

sentences: Move object forward according to rotation How do I make an object (like a bullet) go forward according to its rotation in vanilla nodejs (my game server language)?  For example, if an object's rotation is 0 degrees, then it goes straight up.

sentences:
HTML canvas, Node WebSocket and multiplayer game like slither.io. How to send visual data over websockets? Where to start creating a multiplayer game like slither.io, agar.io, etc.

I need only learn how to draw live positions and other data of all players into one fullscreen HTML5 canvas with update frequency +/-100ms.

I already have websocket server but that is only chat. I dont know sending images of players and positions. My first idea is sending every 100ms array of all players positions, current position on the map and all other data of players.

var worldSize = [10000,10000]; //width and height in px
var currentPosition = [5000,5000]; //center on the map
var players = new Array();
//on player join
players.push({
    id: 1,
    name: "test",
    position: [1234,850], //random position on the map
    points: 100 //example points
});

//on player eat point find that player, update players[index].points+1 etc.

This is only my (bad) idea and I not tested it because I dont know how start, how to send visual game data via websockets. How?

Update

I checked slither.io game WebSocket console and all frames is Binary Frame (Opcode 2) and Binary Frame (Opcode 2, mask). This is short version of array of all players and their positions and all other data? Or?

For example if game play 1000 peoples, that array will be too long. This will lag browser?

sentences:
Setting sound panning I'm trying to set sound panning in my game depending on camera position, rotation and audio source position.

I was able to set sound panning depending on camera position (listener), and audio source like this:

Vector3 toSourceVector = Vector3::subtract(sourceTransform->position, listenerTransform->position);
float value = MathUtil::clamp(toSourceVector.x, -1.5f, 1.5f);
value = value + 1.5f;
float perc = (value / 3.0f) * 254.0f;
AudioManager::setPanning(254.0f - perc, perc);

Max panning value on the right/left speaker is 254.
When I'm standing on the front of the audio source (without rotating my camera), panning values are: 127 and 127, for example, when the audio source
is on my right side, panning values are 0 and 254.

Obviously, if I rotate my camera, sound panning is same.

I've got Vector3 with camera (listener) rotation values (x, y, z).

My question is: how to calculate panning values depending on camera rotation too?

sentences:
Making a game as a tutorial? I am in charge of a game development club at my school and I'd like to work on a project this summer that I could use as a tutorial next semester. I have never done anything quite like this so I was wondering if anyone had any guide lines or ideas.

What I want to do basically is make a very simple game. Something like a top-down shooter where enemies come rush in for you to kill them and pick up some loot. However, I want everything to be very easily modified. The people in the club have little game development experience, so if I could set up my game in such a way that people could modify and add functionality with ease, it would be great for them.

Stuff like having an enemy class where the behavior is easy to play with, or making guns shoot differently/adding new guns, and new loot. Even adding new elements to the game. What would be the best way to build the game to allow this kind of malleability?

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:
Midpoint displacement generating unsatisfactory terrain Following this lesson for implementing mid-point displacement algorithm for terrain generation. I aim at generating a wavefront(obj) file of the terrain

I have an array of dimension (2^n + 1) x (2^n + 1).
The corners of the 2d array is initialized with random numbers.

n = plug_in_n
arr = Array.new(2**n + 1) { Array.new(2**n +1) { 0 } }
n_augmented = 2**n

arr[0][0] = rand(10 + 1)
arr[0][n_augmented] = rand(10 + 1)
arr[n_augmented][0] = rand(10 + 1)
arr[n_augmented][n_augmented] = rand(10 + 1)

This is the script I have written for generating a terrain.

a = arr
n_augmented_copy = n_augmented
while n_augmented > 1

puts "n_augmented = " + n_augmented.to_s
i = 0
while(i < n_augmented_copy)
    j = 0
    while(j < n_augmented_copy)
        a[i][j+(n_augmented)/2] = (a[i][j] + a[i][j+n_augmented]) / 2.0  + (rand 0.0..1.0)
        a[i + (n_augmented) / 2][j + n_augmented] = (a[i][j + n_augmented] + a[i + n_augmented][j + n_augmented]) / 2.0 + (rand 0.0..1.0)
        a[i + n_augmented][j +( n_augmented) / 2] = (a[i + n_augmented][j] + a[i + n_augmented][j + n_augmented] )/ 2.0 + (rand 0.0..1.0)
        a[i + (n_augmented) / 2][j]  = (a[i + n_augmented][j] + a[i][j] )/ 2.0 + (rand 0.0..1.0)
        a[i + (n_augmented) / 2][j +( n_augmented) / 2] = ((a[i][j+(n_augmented)/2] + a[i + (n_augmented) / 2][j + n_augmented] + a[i + n_augmented][j +( n_augmented) / 2]  + a[i + (n_augmented) / 2][j]))/ 4.0  + (rand 0.0..1.0)
        j = j + n_augmented
    end
    i = i + n_augmented
end
# binding.pry
# p_arr(a)
n_augmented = n_augmented / 2

end

Demonstrating a case for n = 2: I have omitted the random-displacement rand 0.0..1.0to check if the heightmap chucks are getting calculated fine.

Here is how the iterations look like

n_augmented = 4
    9     0   5.5     0     2
    0     0     0     0     0
  6.5     0   5.5     0   4.5
    0     0     0     0     0
    4     0   5.5     0     7
n_augmented = 2
    9  7.25   5.5  3.75     2
 7.75 6.625   5.5 4.375  3.25
  6.5   6.0   5.5   5.0   4.5
 5.25 5.375   5.5 5.625  5.75
    4  4.75   5.5  6.25     7

If I form a mesh using this alone, it results in a plane like:

Considering the random displacement for this case, it results in :

For n = 5, It looks like :

This is not desirable since I cannot see any peaks and slopes.

Here is the ruby script  : CODE

sentences:
Basic tutorial/introduction for 3d matrices, idealy in c++, without openGl or directX I am wondering if there is a simple tutorial that covers the basics of how to initialize rotation, translation and projection matrices, and how to multiply them, and how to get the screen coordinates afterwards for a 3d point.

Idealy, the tutorial comes with compilable code and is not dependent on any 3rd party library.

Searching the internet, I found lots of tutorials, so this is not the problem. Yet, it seemed all of these either covered openGl or directX, or they were theoretical in nature.

sentences:
How to create a 2D fog shader? I am trying to write a fragment shader in GLSL for a fog effect in a 2D game.

Here are some links showing what I'm after.

Here the fog is in the foreground and near the ground:

https://twitter.com/i/status/992811158318075904

Here the fog is on a background layer and fills the screen:

https://twitter.com/i/status/963889084337983488

Here the fog is more subtle and denser near the ground:

https://twitter.com/i/status/1001926421856563205

I am interested in learning how to create these effects. Unfortunately, I am pretty new to shaders and only know how to do elementary stuff like color swaps, outlines, and simple vignettes. It doesn't help that it's hard to find resources on shaders with a bent toward 2D.

In the environment in which I'm working, I can attach a shader script to any of my sprites, parallax background layers, etc.

Does anyone have advice on creating these kinds of effects?

sentences:
Importing Mobile Ads Unity plugin results in standard input InvalidOperationException When I import Mobile Ads Unity plugin this error shows up. How can I fix it, and why am I getting this error?

While the “Resolving Android Dependencies” dialog and loading bar is open,  the following appears in the console:

InvalidOperationException: Standard input has not been redirected.
System.Diagnostics.Process.get_StandardInput ()
(wrapper remoting-invoke-with-check) System.Diagnostics.Process:get_StandardInput ()
GooglePlayServices.CommandLine.RunViaShell (System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2 envVars, GooglePlayServices.IOHandler ioHandler, Boolean useShellExecution, Boolean stdoutRedirectionInShellMode)
GooglePlayServices.CommandLine.Run(System.String toolPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.Dictionary`2 envVars, GooglePlayServices.IOHandler ioHandler)
GooglePlayServices.CommandLine+<RunAsync>c__AnonStorey1.<>m__0 ()
UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)

sentences:
Managing shared dll correctly in Unity I'm developing a dll that is to be used in two Unity projects.

I've read that the way to reference a dll is to drag it into a 'plugins' folder so that it is added to the Unity project's dependencies, as their is no "add reference" available for this project in Visual Studio.

But doing that the Unity project does not take into account that the dll evolves (as it is still in development).

What I'd like (if possible) is to set up an automatic way so that the Unity projects update their dependencies when the shared dll is updated.

I've try the reimport option (right click on the dll in Unity) but it seems that it is not working.

What is the best way to manage this situation?

sentences:
Scale screen space quads (used in font rendering) I have quads positioned in <0, 1> x <0, 1> coordinates. I use this system for font rendering.

In vertex shader I have:

gl_Position.xy = 2.0 * POSITION.xy - 1.0;

that brings the position to the screen space <-1, 1> x <-1, 1>.

My quads are created from two triangles ABD, BCD

D-C
|\|
A-B

Now, I want to scale the quad by a scale factor. Can I achieve this with this data?

I have tried to change geometry and store quad center and half-sizes, then calculate the final position as

gl_Position.xy = 2.0 * (CENTER_POSITION.xy + HALF_SIZE.xy) - 1.0;

This way, I can translate points to origin, scale them and translate them back. However, this scale single quad correctly, but the two closely neigboring quads are no longer closely neigboring, since the space between them is constant.

So the final question. How can I scale quads used for font rendering, so that the text is still readable without large gaps between glyphs?

sentences:
How to get into game development? I really want to get into game development and one day be able to make simple games that are enjoyable to play. I have very little experience in coding/designing. I would appretiate any help :)
Thanks!

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:
How to draw lines with fountain pen effect in Unity? I'm working on drawing lines in Unity, I've already implemented smooth line drawing with LineRenderer. But I need lines have effect of fountain pen or gel ink pen, just as the picture showed below, I have no idea about this,  may shaders  make the effect ?can anyone help?

Now I can draw common lines with Unity:

Effect needed:

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:
Why not use vectors to represent orientation? From what I've read, people mostly use either quaternions or 3x3 matrices to represent 3D orientations, while plain vectors are used for angular velocity/momentum.
Since we can use vectors to represent angular velocities, why can't we also use vectors to represent orientations? Are there any specific reasons or is it simply less convenient?

EDIT: Just to clarify, I mean using a 3D vector to represent a rotation around an arbitrary axis, with the magnitude being the rotation.

sentences:
How can I draw a circle around a specific object, not necessarily the object the script is attached to? I have this script that draws a circle around the object the script is attached to.
I would like also to use the centerObject variable as an option to draw another circle around the centerObject, or just only around the centerObject and not the transform the script is attached to. I'm not sure how to do it.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[ExecuteAlways]
[RequireComponent(typeof(UnityEngine.LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    public GameObject centerObject;
    [Range(1, 50)] public int segments = 50;
    [Range(1, 500)] public float xRadius = 5;
    [Range(1, 500)] public float yRadius = 5;
    [Range(0.1f, 5)] public float width = 0.1f;
    [Range(0, 100)] public float height = 0;
    public bool controlBothXradiusYradius = false;
    public bool draw = true;

    [SerializeField] private LayerMask targetLayers;
    [SerializeField] private LineRenderer line;

    private void Start()
    {
        if (!line) line = GetComponent<LineRenderer>();

        if (draw)
            CreatePoints();
    }

    private void Update()
    {
        if (Physics.CheckSphere(transform.position, xRadius, targetLayers))
        {
            Debug.Log("player detected");
        }
        else
        {
            Debug.Log("player NOT detected");
        }
    }

    public void CreatePoints()
    {
        line.enabled = true;
        line.widthMultiplier = width;
        line.useWorldSpace = false;
        line.widthMultiplier = width;
        line.positionCount = segments + 1;

        float x;
        float y;

        var angle = 20f;
        var points = new Vector3[segments + 1];
        for (int i = 0; i < segments + 1; i++)
        {
            x = Mathf.Sin(Mathf.Deg2Rad * angle) * xRadius;
            y = Mathf.Cos(Mathf.Deg2Rad * angle) * yRadius;

            points[i] = new Vector3(x, height, y);

            angle += (380f / segments);
        }

        // it's way more efficient to do this in one go!
        line.SetPositions(points);
    }

#if UNITY_EDITOR
    private float prevXRadius, prevYRadius;
    private int prevSegments;
    private float prevWidth;
    private float prevHeight;

    private void OnValidate()
    {
        // Can't set up our line if the user hasn't connected it yet.
        if (!line) line = GetComponent<LineRenderer>();
        if (!line) return;

        if (!draw)
        {
            // instead simply disable the component
            line.enabled = false;
        }
        else
        {
            // Otherwise re-enable the component
            // This will simply re-use the previously created points
            line.enabled = true;

            if (xRadius != prevXRadius || yRadius != prevYRadius || segments != prevSegments || width != prevWidth || height != prevHeight)
            {
                CreatePoints();

                // Cache our most recently used values.
                prevXRadius = xRadius;
                prevYRadius = yRadius;
                prevSegments = segments;
                prevWidth = width;
                prevHeight = height;
            }

            if (controlBothXradiusYradius)
            {
                yRadius = xRadius;
            }
        }
    }
#endif
}

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 start building the racing levels in unity? I had an idea of making more fun less redundantly designed level for a racing game, i have core mechanics and ui of the game sorted out but i m confused where to begin with the levels and how do i structure them. link of any sites that focusses on this would be greatly helpful.

sentences:
Unity unable to change android icon Hi I've have spent the past few days googling how to do this and I'm making no progress. I have created a png image for each of the sized icon 36x36, 48x48, 72x72,96x96, 144x144 & 192x192. But when I load my app on any device the default icon apps. This is preventing me from uploading my game to the store as I don't want users to have a game with no icon.

Can anyone help get these icons to actually appear. I have tried different devices, uninstalling the app and reinstalling but still no luck. Do the images have to be a certain format, or any setting need selecting with in unity to make them compatible?

sentences:
How to make TEXT RENDER stand facing the camera of my character and also for the camera of simulation? I have an actor (Minion) with a Text Render just above it mesh:

As you have seen, I defined your rotation as absolute, so the text does not rotate along with the actor.

In the game the rotation setting is good and acceptable at various times:

At other times it is very bad:

An example of what I want is something like the life of the champions in the League of Legends:

I would also like to know how to do this when I am simulating:

I've made some attempts at the camera of my main character. And I got some of what I tried.

Character Blueprint:

I know I could put on the Event Begin Play because the camera does not rotate.

Minion Blueprint:

I did (partially):

Ignoring the fact that the text is inverted. I tried Split Struct and added 180 to each of the 3 axes (ROLL, PITCH, YAW) and I could not solve it anyway.

Simulating nothing works:

EDIT 1 (Attempt made based on a_rrat's answer)

Blueprint:

I think I tried all the combinations and none worked the way I would. The combination defined in the image made the Text Render spin.

EDIT 2 (Correction of the attempt I made wrongly)

Correction that I did:

With the answer I was given I noticed a marked improvement.

Result 1:

Besides the value is no longer inverted.

Result 2:

But I still have not got what I like.

Result I am looking for:

I wish life would be displayed the same way anywhere on the map the character is on.

EDIT 3 (Removing roll)

Blueprint:

In game there was no difference.

EDIT 4 (Trying to explain what I want to happen)

I think that because I can not speak English and have to use programs to translate things for myself, I do not know the best way to explain my doubts, the best words, among other things.

I think the best way then to try to explain what I want is with images.

I want regardless of the location or angle life is seen in the same way.

Image:

Image:

Image:

In the LEAGUE OF LEGENDS anywhere on the screen that the champion is, the life bar appears the same way. I would like to achieve this result.

sentences:
Do unused vertices in a 3D object affect performance? For my game I need to generate a mesh dynamically. Now I'm wondering does it have a noticeable affect in FPS if I allocate more vertices than what I'm actually using or not? and does it matter if I'm using DirectX or OpenGL?

Edit

Final output will be a w*h cell grid, but for technical issues it's much easier for me to allocate (w+1)*(h+1) vertices. Sure I'll only use w*h vertices in indexing, and I know there is some memory wasting there, but I want to know if it also affect FPS or not? (Note that mesh is only generated once in each time you play the game)

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:
How to switch career to game engine/graphics programming My whole background is related to enterprise applications but I've been thinking of switching my career path from enterprise/business to something that I feel is more challenging and interesting. One of the main fields I've checked is game programming and more specifically engine or graphics programming. One of the requirements I've set is that the new domain requires at least some math/computer science knowledge and have interesting problems to research and solve (hopefully even read some white papers). Graphics programming especially seems to have lot's of that in addition to being interesting in general. I've already started studying the related mathematical background via this book and I believe my general experience in developing and releasing quality software (5+ years) will quickly translate, with the right mentorship, putting me at a level of usefulness of a mid-level game programmer at least.
How should I go about proving this to potential employers? I don't feel like creating small sample games really amounts to anything. Familiarizing myself with an engine like Unity or Unreal seems like a good approach but I'm not sure how to go about it in an engine focused way. I'd potentially like to avoid Gameplay development which is why creating games seems redundant.
I don't want to enter subfields such as server programming or any field that is web-appy but under the umbrella of a game company. I'm also looking to transition relatively quickly which is why I don't want to invest in a game company as a web app developer only to hope to be put into game domain later.
TL;DR: I'm looking for ways to enter the "sciency" side of game programming (graphics/engine programming) with a background in enterprise web apps.

sentences: Is it necessary to call SDL_Quit() at the end of the game? Is it necessary to call SDL_Quit() at the end of the game? Doesn't C/C++ handle all the variables destruction and memory freeing at the end of a program?

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: What does changing GL_TEXTURE_WRAP)_(S/T) do? I am working through some beginner OpenGL tutorials, and the current one teaches how to apply a texture to a simple rectangle. The tutorial states tells me to set the texture parameters GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T to GL_CLAMP_TO_EDGE, however I am uncertain as to what this actually does. I am aware it is something to do with how textures larger/smaller than the space they are being mapped onto are handled, but I'm not sure what behavior this actually causes. What does GL_CLAMP_TO_EDGE do, and how is this different from GL_CLAMP, GL_CLAMP_TO_BORDER, GL_REPEAT? Thanks very much in advance, and bonus helpfulness if you can provide images for an idiot like me.

sentences:
Creating Platform game with Inclined Levels Till now I have developed platform games in which a player can only move and detect tiles linearly. I wonder on how to implement games
in which a player can move on an inclined or irregular surface.

I use libgdx to develop games and Tiled Map Editor to create level maps.

On research, I found RUBE is something I need for what I want to do.

Is this true? I will have to use Box 2D if I want to make such games.

Can't we do it using Tiled? If so... how to detect collision in that case?

If there is some other way through which I can do so? Thanks in advance for any suggestion.

sentences:
How to compute tangent and bitangent vectors I have a texture loaded in three.js, then passed to the shaders. In the vertex shader I compute the normal, and I save into a variable the uv vector.

<script id="vertexShader" type="x-shader/x-vertex">

                varying vec3 N,P;
                varying vec2 UV;

                void main() {
                    gl_Position= projectionMatrix * modelViewMatrix * vec4(position,1.0);
                    P= position;
                    N= normalMatrix * vec3(normal);
                    UV= uv;
                }
            </script>
            <script id="fragmentShader" type="x-shader/x-fragment">

                varying vec3 N,P;
                varying vec2 UV;
                uniform sampler2D texture;

                void main() {
                    gl_FragColor= texture2D(texture,UV);
                }

            </script>

How do I compute the T and B vectors?

sentences:
How to make an additional in-game content download (patching) for first time launching the Mobile Store Game? this is a pretty common but I googled everywhere and nothing.
When there is a game with very big download size, more than 500MB for example,
I often saw that the additional game content is being downloaded during first time launched.
Pretty common, most of the mobile game did this.
But I am wondering how can I did these in Unity? that split the game content out from the deployed game package? or is this method offered in Unity Plus/Pro? not Personal?

sentences:
What do the components of gl_TexCoord[0] mean? What are the differences between gl_TexCoord[0].s, gl_TexCoord[0].t gl_TexCoord[0].p and gl_TexCoord[0].x, gl_TexCoord[0].y gl_TexCoord[0].z ?

I understand that gl_TexCoord[0].x, gl_TexCoord[0].y gl_TexCoord[0].z are pixel coordinates?

But what do gl_TexCoord[0].s, gl_TexCoord[0].t gl_TexCoord[0].p mean and where must I use them?

sentences: Match-3 game level generator I made match-3 game and now i trying to add level generator. Now I generate level by filling random cells with random blocks, but I want to create generator which for given number of moves and number of block kinds generate level. What algorithms I can use if they exists?

sentences:
What is original Pong ball behaviour? I am building a Pong clone to learn interactive programming and I've stumbled in getting the ball movement and bouncing on the paddles right.

If I play the original game I can't really understand how the "spin" and the paddle bounce works.

I've been searching a bit on the internet and all I got was just more confusion.

Can anybody explain me how the bounce is handled?
If the paddle stands perfectly still and the ball, just moving on x, hits the paddle at the center I simply get -x, that is clear.

What happens if you hit the paddle on the sides?
What changes if when the ball hits the paddle the paddle is also moving?

I did an Arkanoid-like implementation but it is far from the real Pong feeling.

sentences: What is the unit of speed in unity3d? I have cars in my unity scene, I am not sure in what units speed is specified in unity.

sentences:
libGdx Window .pack() not working I'm trying to make a window, then use the pack method to get the right size, but the window maximizes instead. Here's my code:

private Table buildOptionsWindowLayer() {
    winOptions = new Window("Options", skinLibgdx);
    // (...) building some widgets

    Gdx.app.log(TAG, "pref width is " + winOptions.getPrefWidth());
    // displays: "pref width is 247.0"

    winOptions.pack();

    // move the window
    winOptions.setPosition(Constants.VIEWPORT_GUI_HEIGHT - winOptions.getWidth() - 50, 50);
    return winOptions;
}

The window ends up with a width of 800.0f. Why?

What it is supposed to render:

What it does render:

sentences:
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:
What libgdx project files can I ignore from version control? In an automatically created libgdx project, what files can I safely tell Git (or other revision control systems) to ignore?

I'm considering these:

*-android/.settings/
*-android/bin/
*-desktop/.settings/
*-desktop/bin/
*-html/.settings/
*-html/gwt-unitCache/
*-html/war/WEB-INF/classes/
*-html/war/WEB-INF/deploy/
*-html/war/assets/
*-html/war/
*/.settings/
*/bin/

Am I missing some? Is there a complete list somewhere?

sentences:
How to use C++11 chrono header for a clock In first, sorry for my bad english. :)
I'm making a game using SFML and C++11 new features, but I've got a problem with my custom Clock class (made to replace the SFML one).
When I get the elapsed time since the clock instanciation, it returns it in microseconds. But I'd want it to return nanoseconds, I don't understand what happens.
My question is, why do I get microseconds instead of nanoseconds ?
Here is my main :

#include "clock.h"
#include <SFML/Window.hpp>
#include <iostream>

int main() {
    sf::Window window(sf::VideoMode(800,600), "title");
    sf::Event event;
    window.setFramerateLimit(60);
    Clock<std::chrono::nanoseconds> clock;

    while(window.isOpen()) {
        while(window.pollEvent(event)) {
            if(event.type == sf::Event::Closed) window.close();
        }

        std::cout << clock.Restart().count() << std::endl;
        /* I would like it to print about 16666666 (ns), but it prints about 16666 (μs) */

        window.display();
    }

    return 0;
}

And there is my Clock.h file :

#ifndef CLOCK_H
#define CLOCK_H

#include <chrono>

template < typename Period >
class Clock {
public:
                                                                    Clock();
    Period                                                          GetElapsedTime() const;
    Period                                                          Restart();

private:
    std::chrono::time_point< std::chrono::high_resolution_clock >   mTimePoint;
};

template < typename Period >
Clock< Period >::Clock()
    : mTimePoint( std::chrono::high_resolution_clock::now() ) {
}

template < typename Period >
Period Clock< Period >::GetElapsedTime() const {
    const Period elapsedTime( std::chrono::high_resolution_clock::now() - mTimePoint );
    // Here, elapsedTime.count() equals ~16666 too, but I want nanoseconds, so why ?!
    return elapsedTime;
}

template < typename Period >
Period Clock< Period >::Restart() {
    const Period period( GetElapsedTime() );
    mTimePoint = std::chrono::high_resolution_clock::now();
    return period;
}

#endif // CLOCK_H

sentences:
Is it possible to billboard a sprite using a transformation matrix? None of the current topics on billboarding seemed to answer this question.

But, given

a sprite (or quad) that has it's own 4x4 transformation matrix
a camera with a view matrix (a standard 4x4 transformation matrix)

is it possible to compute a 4x4 transformation matrix such that when the quad's matrix is multiplied with this matrix it has an orientation of looking at the camera?

sentences:
changing coordinate system I'm currently trying to transform a system by scaling it on x and y axis and have some uncertainty. I have the general concept that scaling works as such:

My original box has corners at (0, 0) and (3, 2) and I'm asked to scale the x axis by 3 and the y axis by -2.

Is this what the correct solution would look like (with corners at (0,2) and (6,-2))?

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:
What is a good starting platform for a teenage game programmer? My son (15) has decided that he wants to pursue a career as a games programmer. I've said that he should get started now with a simple game. He has no programming experience yet, but I am a programmer (business apps, not games) so I can teach him programming, but what would be a good platform for him to start on? Initially I'm looking for something that can provide quick results, to keep his enthusiasm up.

What would you suggest?

sentences:
How can I reduce the sharpness of my generated terrain? I am trying to generate a random low poly terrain for a 3D demo. I am using Perlin noise to generate the heights and then generate the 3D mesh, but the terrain generated is too sharp and unrealistic. It ends up looking like this:

But I'd like it to look more like this:

How can I smooth out my terrain so it looks more like the second image?

sentences: No idea of how to simulate car crashes I have a simple car game with all the basic collision detection and movement in Unity with C#. But when I was building the "engine" for the game I didn't include a detail I later decided to include. I want the possibility so that cars can get damaged and so that the model can change. For example the car looked like it was new and after a crash it looks like a wreck. Please help me by pointing to some resources or by telling me approximate ways of implementing this new feature. Thanks!

sentences:
Using a sphere collider in combination with FoV I have a character and some npc's in my game. I want the npc's to look out for my character using a sphere collider. Well it kind of works but of course not as i want. When the npc is looking at me and a colission occurs it should trigger some chasing behaviour, but if the npc look in another direction, it should not trigger that behaviour.

So i need something like a field of view inside the collider. I watched some tutorials like https://www.youtube.com/watch?v=rQG9aUWarwE and  https://www.youtube.com/watch?v=mBGUY7EUxXQ but it should be 3 dimensional so not only on the ground like in the tutorial. I added a picture to visualize it

How can i accomplish this?

sentences:
How to render IDirect3DSurface9 in my window? I have some code that captures the screen and save data into a surface.

g_pDirect3D_Device->GetFrontBufferData(0, pSurface);

All is ok, now I want to display pSurface in my window. I want to have the image in my whole window.

Is it possible, or should I use a texture?

sentences:
Combining varying vertex variable and vertex variable in OpenGL. How to? Let's say I have 2 triangles sharing an edge defined by 4 vertices. Though the normals for these 2 triangles are unique for each triangle and are defined per vertex. So say I have 4 vertices, 6 normals (as shown in the figure below).

I would like to know how this can be dealt with in OpenGL? I have been using glDrawElement so far, but I understand that this would only work if I had 4 normals (1 normal per vertex) and this it wouldn't allow me to define 3 normals per triangle.

What's the best/common/most efficient of dealing with this case? Do I need to also duplicate the vertices (3 unique vertices per triangle or is there a more clever solution to this?) so that I have as many vertices than I have normals?

sentences:
Xna, writing XML  end element got another question here. Its not about actually writing/reading files in XML, i already know how to-do this. But rather something that has bugged me for awhile.
Ok, so when i write out my files, they look like this:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
 <Asset Type="ProjectWitch.Animation">
      <Filename>C:\Users\Daniel Randell\Desktop\Project Witch\Project Witch (MAIN)\Project_Witch (MAIN)\Project_Witch (MAIN)Content\player.png</Filename>
      <CurrentFrame>0</CurrentFrame>
      <Number_Of_Frames>1</Number_Of_Frames>
      <Max_Time_Per_Frame>0</Max_Time_Per_Frame>
      <Animate_Once>0</Animate_Once>
      <Using_Image>1</Using_Image>
      <Rect>
        0    166  64   58
      </Rect>
      <Vector2>
        12   12
      </Vector2>
      <Rect>
        81   71   51   59   False
        80   71   13   43   True
        121  71   12   22   True
        130  82   7    41   True
        89   63   11   23   True
      </Rect>
 </Asset Type="ProjectWitch.Animation">

As you can see the problem, it should write out at the end:

      </Asset>
 </XnaContent>

But it's always writes out the:

 </Asset Type="ProjectWitch.Animation">

Its a bit annoying to keep having to look into the XML files and deleting this, so i'm wondering what i'm doing wrong?

Saving Code:
http://pastebin.com/yyC3q3aS

Thanks for any help :).

sentences:
libGDX using Stage and Actor produces different camera angles on desktop and Android Phone libGDX using Stage and Actor produces different camera angles on desktop and Android Phone.

Here are pictures demonstrating the problem: http://brandonyuh.minus.com/mFpdTSgN17VUq

On the desktop version, the image takes up most all the screen. On the Android phone it only takes up a bit of the screen.

Here's the code (not my actual project but I isolated the problem):

package com.me.mygdxgame2;
import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.scenes.scene2d.*;
public class MyGdxGame2 implements ApplicationListener {
    private Stage stage;
    public void create() {
        stage = new Stage();
        stage.addActor(new ActorHi());
    }
    public void render() {
        Gdx.gl.glClearColor(0, 1, 0, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        stage.draw();
    }
    public void dispose() {}
    public void resize(int width, int height) {}
    public void pause() {}
    public void resume() {}
    public class ActorHi extends Actor {
        private Sprite sprite;
        public ActorHi() {
            Texture texture = new Texture(Gdx.files.internal("data/hi.png"));
            texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
            sprite = new Sprite(new TextureRegion(texture, 0, 0, 128, 128));
            sprite.setBounds(0, 0, 300.0f, 300.0f);
        }
        public void draw(SpriteBatch batch, float parentAlpha) {
            sprite.draw(batch);
        }
    }
}

Why does this happen?

sentences:
Architecture of an action multiplayer game from scratch Not sure whether it's a good place to ask (do point me to a better one if it's not), but since what we're developing is a game - here it goes.

So this is a "real-time" action multiplayer game. I have familiarized myself with concepts like lag compensation, view interpolation, input prediction and pretty much everything that I need for this. I have also prepared a set of prototypes to confirm that I understood everything correctly.

My question is about the situation when game engine must be rewind to the past to find out whether there was a "hit" (sometimes it may involve the whole 'recomputation' of the world from that moment in the past up to the present moment. I already have a piece of code that does it, but it's not as neat as I need it to be. The domain logic of the app (the physics of the game) must be separated from the presentation (render) and infrastructure tools (e.g. the remote server interaction specifics).

How do I organize all this? :) Is there any worthy implementation with open sources I can take a look at?

What I'm thinking is something like this:

-> Render / User Input
    -> Game Engine (this is the so called service layer)
        -> Processing User Commands & Remote Server
        -> Domain (Physics)

How would you add into this scheme the concept of "ticks" or "interactions" with the possibility to rewind and recalculate "the game"? Remember, I cannot change the Domain/Physics but only the Game Engine. Should I store an array of "World's States"? Should they be just some representations of the world, optimized for this purpose somehow  (how?) or should they be actual instances of the world (i.e. including behavior and all that).

Has anybody had similar experience?

(never worked on a game before if that matters)

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:
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 the screen scroll only when the character is close to the edge? On the internet, I saw videos and tutorials about screen scrolling. But those only show how to keep the player always in the center of the camera.

I want my camera to scroll over the level, following the character, only when the character is within the 20% border of the screen.

So, when the player is not close to the edge of the window then the camera stays in place and not follow the player and when the player crosses this "scrolling line" the camera should smoothly follow hit. Let's say that my game window is 1000px wide and 500px high, but the game map is 3000px wide and 3000px high.

sentences:
Renderable object abstraction In my engine I have 2 types of 2D renderables: sprites and groups (and maybe primitives later). Sprites are just textured quads and groups are multiple renderables grouped in a single object. I have this drawcall system now:

struct Renderable
{
    virtual void Render(Renderer& renderer) = 0;
};

struct Sprite : public Renderable
{
    Texture& texture;
    // other sprite specific stuff
    void Render(Renderer& renderer) override { renderer.RenderSprite(...); }
};

struct Group : public Renderable
{
    vector<Renderable*> elements;
    // Other group related stuff like a transformation matrix
    void Render(Renderer& renderer) override
    {
        for (Renderable* r : elements)
            r->Render(renderer);
    }
};

Instead of sendig them straight to the renderer, I need an indirection. This makes rendering many (like 20K) sprites super slow. Is there a better design to avoid indirection (or even abstraction)?

sentences:
Why is RK4 better than Euler integration? At the end of these great slides, the author compares all the different integrators presented. One way or another, they all fall short except for Improved Euler Integration and Runge Kutta 4 Integration, which both pass all tests.

I suppose I should mention that I am working on a 2D game that isn't very physics intensive. I'm just curious as to where Improved Euler Integration would fall short and RK4 would have to be used instead.

My game consists mostly of simple gravity (jumping and falling), movement along the X and Y axes, and bounding box collision. Is it worthwhile to implement RK4 or would Improved Euler be sufficient? I see many discussions where Euler Integration's users are chastised, but from what I can see, Improved Euler is quivalent in simple 2D matters. I imagine it'd also be faster.

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 OrthographicCamera culling problem with zooming When I set zoom on an orthographic camera to anything above 1 I get a strange black border on the bottom of the screen.

I suspect that this might be some sort of culling problem. I use a viewport to control the game resolution, and no matter the size the borders are there.

The camera is set on a direction (-1,-1,-1) basicaly isometric. Also it is positioned well above to origin at (1113,1113,-1113). Far plane at 7777 near at 0.00001f. The ground plane is at 0,0,0 laying in the xz axis, with an other plane on top of it sligtly off to the left and with a 45 degrees on its axis to face the camera.

Here is an image of the problem:

Posting code wont really help here since I only use defaults almost everywhere, but if you need it just tell.

sentences:
Changing properties for multiple objects in unity 3d free? So my team and I need to assign values to specific values in the inspector to large numbers of objects.

For example, we have a script that's assigned to all the walls, and all the floors.

We want to select all the walls in the Scene view and assign the value "1" to a variable in the inspector and then go and select all the floors and assign the value "2" to the same variable, for those objects.

Right now, when we select multiple objects and assign a value to the variable in the inspector, it just changes it for the last selected object.

We've got (potentially) hundreds of object that we need to do this to and it would suck to have to go in and change the values one at a time.

The equivalent I'm thinking of is the Attribute Spreadsheet in Maya, where you can see a list of objects, and assign the same value to a bunch of their attributes.

Hope somebody out there has an answer for this! Haven't been able to find one yet!

sentences: Is there a site where people discuss game concepts and questions in general? I like making game concepts for fun, as a hobby. I don't think that all my game concepts are amazingly awesome and have to be created and would revolutionize the industry. I just want some people to talk to that have the same hobbies as I do. To be able to discuss ideas and point out the pros and cons.

sentences:
Unity: How to Retrieve Port Number Used for Test Build SUMMARY
I am looking for a straightforward way to get the port number that the Unity editor is using to serve WebGL test builds after the build's browser window has been closed.
I'm supporting Unity students who are not computer savvy. I'd like to know if there's an easy way to get this information from the editor itself, short of rebuilding the project.
DETAILS
To test my Unity WebGL project from the Unity Editor, I select the menu "File > Build and Run."

Once the project is built, a Chrome window opens with a location of the form "http://localhost:53587/", where 53587 is a random port number.

WHAT I HAVE TRIED
Google searches haven't given me an easy way to discover this port.
Using Window's Resource Monitor, I can find all the ports unity test servers are listening on, but this method requires many steps and external tools. I'd like know if there is a way within Unity to discover this information.
Complicated Method

Press Ctrl+R to open the Run window.
Type resmon.exe and press ENTER
Select the Network tab
Select the Listening Ports bar
Sort on image by clicking on the image column header
Search for image mono.exe
Get port number(s) from Port column.

This is relatively complicated, Windows-specific method and it's inexact; it can return multiple instances of test builds being served.  I'd like an easy way of discovering the port being served for the project currently being edited.

sentences:
Array Out Of Range Exception I have been working on my this aspect of my project since last night and have finally got this code to work exactly as I want it to.

However if the first target is removed before the second one, I get an out of range exception. I would like to know if there is a better way to fix my problem.

void LateUpdate()
{
    if (targets.Count == 0)
        return;
    Move();
    Zoom();
}

void Move()
{
    GetBoundsData();
    Vector3 newPosition = new Vector3(centerPoint.x + offset.x, transform.position.y, centerPoint.z + offset.z);
    transform.position = Vector3.SmoothDamp(transform.position, newPosition, ref velocity, smoothTime);
}

[SerializeField] Bounds bounds;
[SerializeField] Vector3 centerPoint;
public Vector3 maxBoundsPoints;

void GetBoundsData()
{
    if (targets[0] == null)
    {
        targets.RemoveAt(0);
    }
    if (targets.Count == 1)
        centerPoint = targets[0].position;
    SetUpBounds();
    centerPoint = bounds.center;
    maxBoundsPoints = bounds.max;

}

void SetUpBounds()
{
    bounds = new Bounds(targets[0].position, Vector3.zero);
    for (int i = 0; i < targets.Count; i++)
    {
        if (targets[i] == null)
        {
            targets.RemoveAt(i);
        }
        bounds.Encapsulate(targets[i].position);
    }
}

sentences:
How do I check on non-transparent pixels in a bitmapdata? I'm still working on my window cleaning game from one of my previous questions

I marked a contribution as my answer, but after all this time I can't get it to work and I have to many questions about this so I decided to ask some more about it. As a sequel on my mentioned previous question, my question to you is:

How can I check whether or not a bitmapData contains non transparent pixels?
Subquestion: Is this possible when the masked image is a movieclip? Shouldn't I use graphics instead?

Information
I have: A dirtywindow movieclip on the bottom layer and a clean window movieclip on layer 2(mc1) on the layer above.

To hide the top layer(the dirty window) I assign a mask to it.

Code

// this creates a mask that hides the movieclip on top
var mask_mc:MovieClip = new MovieClip();
addChild(mask_mc)

//assign the mask to the movieclip it should 'cover'
mc1.mask = mask_mc;

With a brush(cursor) the player wipes of the dirt ( actualy setting the fill from the mask to transparent so the clean window appears)

//add event listeners for the 'brush'
brush_mc.addEventListener(MouseEvent.MOUSE_DOWN,brushDown);
brush_mc.addEventListener(MouseEvent.MOUSE_UP,brushUp);

//function to drag the brush over the mask
function brushDown(dragging:MouseEvent):void{
    dragging.currentTarget.startDrag();
    MovieClip(dragging.currentTarget).addEventListener(Event.ENTER_FRAME,erase) ;
    mask_mc.graphics.moveTo(brush_mc.x,brush_mc.y);
}

//function to stop dragging the brush over the mask
function brushUp(dragging:MouseEvent):void{
    dragging.currentTarget.stopDrag();
    MovieClip(dragging.currentTarget).removeEventListener(Event.ENTER_FRAME,erase);
}

//fill the mask with transparant pixels so the movieclip turns visible
function erase(e:Event):void{
    with(mask_mc.graphics){
        beginFill(0x000000);
        drawRect(brush_mc.x,brush_mc.y,brush_mc.width,brush_mc.height);
        endFill();
    }

}

sentences:
Extract eye/camera position from a view Matrix I'm trying to improve my Camera. This camera owns a target (vec3 _at), a position (vec3 _eye) and a view mat4. When I move the mouse, I perform a rotation to the view matrix, according to 2 angles (_angleY, _angleZ), so that it gives the feeling the world is turning and not the cam.

Here is what I have, which works :

// Called each frame
void Camera::look(bool rotation)
{
    // Computes view Matrix
    _view.lookAt(_eye.X,_eye.Y,_eye.Z,
                 _at.X, _at.Y, _at.Z,
                 0, 0, 1);

    // Apply rotation to the matrix, according to angles
    if(rotation) {
        _view.rotate(_angleY, 0, 1, 0, _at);
        _view.rotate(_angleZ, 0, 0, 1, _at);
    }
}

This perfectly works. I'm able to make my world rotating around a selected target (vec3). My problem is that my eye position is not updated each frame since I update my angles which apply a new rotation. Then my eye position is wrong and I need it to be updated each frame for another calculation.

Then, I'm trying to extract the eye position after the rotation, update it, and set angles to 0 (hoping it's the best solution...)

Therefore, I need to extract the eye position of my camera, from my modelview matrix. Here is what I'm trying to do, according to what I read here , in the last comment :

void Camera::look(bool rotation)
{
    // Computes view Matrix
    _view.lookAt(_eye.X,_eye.Y,_eye.Z,
                 _at.X, _at.Y, _at.Z,
                 0, 0, 1);
    if(_angleY != 0 || _angleZ !=0)
    {
        if(rotation) {
            _view.rotate(_angleY, 0, 1, 0, _at);
            _view.rotate(_angleZ, 0, 0, 1, _at);
        }

        Vector3D d;
        d.X = _view[3];
        d.Y = _view[7];
        d.Z = _view[11];
        // This creates a vector by multiplying -d by the mat3 part of the view matrix.
        Vector3D retVec = _view.mul3(-d);
        _eye = retVec;
    }
}

few things which might be need :

void Matrix4::lookAt(float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX, float upY, float upZ)
{
    Vector3D axe (upX, upY, upZ);
    Vector3D forward(targetX - eyeX, targetY - eyeY, targetZ - eyeZ);
    Vector3D normal = Vector3D::crossProduct(forward, axe);   // normal = regard x Axe
    Vector3D newAxe = Vector3D::crossProduct(normal, forward); // newAxe = normal x regard

    // Normalize new vectors
    forward.normalize();
    normal.normalize();
    newAxe.normalize();

    // lookAt matrix
    Matrix4 Matrix4;
    Matrix4.values_[0] = (float)normal[0];
    Matrix4.values_[1] = (float)normal[1];
    Matrix4.values_[2] = (float)normal[2];
    Matrix4.values_[4] = (float)newAxe[0];
    Matrix4.values_[5] = (float)newAxe[1];
    Matrix4.values_[6] = (float)newAxe[2];
    Matrix4.values_[8] = (float)-forward[0];
    Matrix4.values_[9] = (float)-forward[1];
    Matrix4.values_[10] = (float)-forward[2];
    Matrix4.values_[15] = 1.0f;

    *this *= Matrix4;

    // translation is part of the lookAt function
    translate(-eyeX, -eyeY, -eyeZ);
}

If someone understands what I'm doing wrong, it might help a lot, I spent a while with this problem...
Thanks,

sentences:
Monogame problem with flat shading low poly terrain I have been dabbling in 3d rendering recently and I am having a problem with the shading on the mesh I am using.

The code I am using to calculate the normals for all the triangles is as follows.

for (int i = 0; i < Indices.Length; i += 3)
{
    Vector3 p1 = Vertices[Indices[i]].Position;
    Vector3 p2 = Vertices[Indices[i + 1]].Position;
    Vector3 p3 = Vertices[Indices[i + 2]].Position;

    Vector3 v1 = p2 - p1;
    Vector3 v2 = p3 - p1;
    Vector3 normal = Vector3.Cross(v1, v2);

    normal.Normalize();

    Vertices[Indices[i]].Normal = normal;
    Vertices[Indices[i + 1]].Normal = normal;
    Vertices[Indices[i + 2]].Normal = normal;
}

None of the triangles in the mesh share vertices so that I can achieve a low polygon look. When it render's half the faces are dark and the other half look like they are correctly shaded. Does anyone have any idea what is going on here and what I may be doing incorrectly?

sentences: Implementing audio for a game made using JMonkey? Is it possible to implement music/SFX in game made using JMonkey?  If yes, how did you do it?  What did you use?

sentences:
AStar for isometric game with overlapping walkable areas We're developing an isometric game that so far has had a single ground level (y = 0) for the avatar to walk on. Pathfinding for this can be solved with a relatively simple 2D AStar tile map.

We're now looking to add objects in the world that can elevate the avatar. There will be overlapping walkable areas, thus creating a problem of pathfinding in 3D space. These objects are distributed sparsely in the room, so I want to avoid keeping an entire 3D map of the room for a 3D AStar implementation. I've attached screenshots to illustrate.

What is the best way to accomplish this?

sentences:
Translating an object along its heading Solved! I was not applying the transformations in the proper order.

I am working on a simulation that requires me to have several objects moving around in 3D space (text output of their current position on the grid and heading is fine, I do not need graphics), and I am having some trouble getting objects to move along their relative headings.

I have a basic understanding of vectors and matrices. I am using a vector to represent their position, and I am also using Euler Angles. I can translate one of my entities with a matrix along whatever axis, and I can alter their heading.

For example, if I have an entity at  (order is XYZ) 1, 1, 1, with a heading of 0, I can apply a translation matrix to get them to talk to 1, 1, 2 fine. However, if I change their heading to 270, they still walk to 1, 1, 3, instead of 2, 1, 2 as I desire.

I have a feeling that my problem lies in not translating my matrix from world space to object space, but I am not sure how to go about that. How can I do this?

Addition:
I am using 3D vectors to represent their current position and their heading (using the three euler angles).

For now, all I want to do is have an entity walk in a square, reporting their current position at each step. So, assuming it starts at 10, 10, 10 I want it to walk as follows:

10,10,10 -> 10, 10, 15
10, 10, 15 -> 5, 10, 15
5, 10, 15 -> 5, 10, 10
5, 10, 10 -> 10, 10, 10

My 1 Z unit translation matrix is as follows:

[1 0 0 0]
[0 1 0 0]
[0 0 1 1]
[0 0 0 1]

My rotation matrix is as follows:

[0 0 1 0]
[0 1 0 0]
[-1 0 0 0]
[0 0 0 1]

sentences:
OnRoomConnected always fail (Google play service unity3d) OnRoomConnected always return false, Im stuck...(Authenticate is success).
Thank you for attention.

private List<Participant> participants;

public void Authenticate()
{
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
        .Build();

    PlayGamesPlatform.InitializeInstance(config);
    // recommended for debugging:
    // PlayGamesPlatform.DebugLogEnabled = true;
    // Activate the Google Play Games platform
    PlayGamesPlatform.Activate();

    Social.localUser.Authenticate((bool success) =>
    {
        if (success)
        {
            Debug.Log("Authentication succeeded");
            //CreateQuickGame();
        }
        else
        {
            Debug.Log("Authentication failed");
        }
    });
}

public void CreateQuickGame()
{
    const int MinOpponents = 2, MaxOpponents = 2;
    const int GameVariant = 0;
    PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(MinOpponents, MaxOpponents, GameVariant, this);
}

#region RealTimeMultiplayerListener implementation

public void OnLeftRoom()
{
    SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
}

public void OnParticipantLeft(Participant participant)
{
    SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
}

public void OnPeersConnected(string[] participantIds)
{
    Debug.Log("OnPeersConnected");
    byte[] message = Encoding.ASCII.GetBytes("Test"); // build your message
    bool reliable = true;
    PlayGamesPlatform.Instance.RealTime.SendMessageToAll(reliable, message);
}

public void OnPeersDisconnected(string[] participantIds)
{
    //SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
}

public void OnRealTimeMessageReceived(bool isReliable, string senderId, byte[] data)
{
}

public void OnRoomConnected(bool success)
{
    if (success)
    {
        Debug.Log("Room Connected success");

        MainScene ms = new MainScene();
        ms.Waithing_sprite.SetActive(true);
        // Successfully connected to room!
        // ...start playing game...
        //PlayersNames[0] = participants[0].DisplayName;
        //PlayersNames[1] = participants[1].DisplayName;
        //PlayersNames[2] = participants[2].DisplayName;
        //GenerateBoard();
        //bool reliability = true;
        //string data = "Instantiate:0:1:2";
        //byte[] bytedata = System.Text.ASCIIEncoding.Default.GetBytes(data);
        //PlayGamesPlatform.Instance.RealTime.SendMessageToAll(reliability, bytedata);
    }
    else
    {
        Debug.Log("Room Connected FAIL");
        PlayGamesPlatform.Instance.RealTime.LeaveRoom();
        //Loading.text = "Error!";
        //Back.SetActive(true);
        // Error!
        // ...show error message to user...
    }
}

public void OnInvitation(Invitation invitation, bool shouldAutoAccept)
{
    // handle the invitation
    if (shouldAutoAccept)
    {
        PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, this);
    }
    else
    {
        // do some other stuff.
    }
}

public void OnRoomSetupProgress(float progress)
{
    Debug.Log("Room Progress Waithing players");
    List<Participant> participants = PlayGamesPlatform.Instance.RealTime.GetConnectedParticipants();
    // show the default waiting room.
    if (participants.Count != 3)
    {
        PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI();
        Debug.Log("Room Progress Waithing players");
    }
    else
    {
        Debug.Log("Room Progress 100");

        MainScene ms = new MainScene();
        ms.MoveToGame();
        PlayersNames[0] = participants[0].DisplayName;
        PlayersNames[1] = participants[1].DisplayName;
        PlayersNames[2] = participants[2].DisplayName;
    }
}

sentences:
How to read rendered textures back without killing performance I have an application where I need to render some OpenGL based dlls, read the rendered textures back, and send them to another directx based application that will render them in directx.

Right now, I am rendering them using FBOs, reading them back, and then sending the data across the network.  However, the "reading them back" step is killing the performance.

My basic loop is as follows:

while(true)
   ... render 5 to 10 textures ...
   foreach( texture in renderedTextures )
      bind texture
      glGetTexImage( data )
      push data onto a queue to send asyncronously

Commenting out the glGetTextImage call causes performance to improve drastically.  What techniques can I use to read the data back faster?

sentences:
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:
Camera scrolling hiccups I'm working on a 2D side-scroller, and I've got the technical aspects working. OpenGL renderer, camera movement using acceleration.

However, while scrolling I'm constantly seeing tiny random hiccups. Split-second pauses, just enough to cause the perception of smooth scrolling to feel choppy instead. Turning on VSync actually accentuates the hiccups. But when I display frame render times, it's always constant (well, constantly flipping between 0.016 and 0.017 second). So far it's just a render loop, no processing going on in the background.

When I look at other 2D side-scrolling games, I never see this stutter, so I don't know if there's something I'm missing that other games know to do...

I recorded a video of it from my phone, on a repeating row of tiles, to show what I mean. It's poor quality, but recorded at slow-motion to emphasize the hiccups. Any tips on how to get rid of this would be great.

sentences:
How to calculate height of a thought line over a known spot in 3rd person view? Assuming a player object with third-person-view is in a 3d room and the center of the screen has a dot - let's call it "cursorTarget".

All I have is the position of the player, the position 5 meters in front of it - let's call it "spot" - and (if necessary) the position where the cursorTarget touches the ground if it's below the horizon.

With that given data, is it possible to calculate the height of the (thought) line between player and cursorTarget right above the spot?

I firstly thought of the intercept theorem, but I lack of knowledge of the camera height in that third-person-view.

Kind regards,
Stacky

sentences:
Backing up non-text based assets I'm using a Source Control Management tool (git) for backing up configurations, code etc. But how do I manage art assets and other game assets that are in binary formats, and tend to be big (animators, audio sources etc)?

The working theory is to backup all assets using cloud storage services like Google Drive or similar. But how do you effectively manage your projects? That would work for me being solo, but if I added another team member, how would I effectively manage projects while multiple developers/artists are contributing?

I'm working with Unity, if it's relevant.

sentences:
"Game Property Values" for online game on Database or somewhere else? I'm working on a online game but,
what would be the best way to store values like damage,movespeed,turnrate, and so on.. ?

My answer would be, to store them in a Database, so they can easily be changed by any developer and  are "unreachable" for the useres, or are there better ways to do that?

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:
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:
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:
How to bend a 2D rectangle in an animation? It is something done often in 3D but I've never heard of it in 2D. I want to bend a 2D rectangle looking a bit like that:

I've seen people adding lots of vertex around knees and elbows of 3D models for that purpose. Should I make my 2D rectangle be lots of smaller triangles in order to bend it, just like in 3D? I feel like it's overkill just to bend a rectangle. Is there a better way to do this? I'm using LibGDX. I would like the rectangle to stay proportioned. Is there common algorithms to do that?

sentences:
Interact with texture / flat surface (Unity) I don't know exactly how to put this into words, so googling did nothing really for me.

Imagine a bowling game. On the oldern bowling lanes there was only a scheme of the pins above the lane, lighting up all the pins that are still standing, while the ones that already fell, were not lit anymore.

How can I achieve this in Unity? Is there any way to do this, without having to make something stupid like creating hundreds of textures, with all the possible combinations and swap them out?

I'm still very new to Unity, so I'd love to know the best approach to something like this.

Thank you very much in advance

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:
Add UVs back into a model I built a 3D model in Autodesk 123d design, then exported it as an stl. When I convert it into an obj, however, there were no UVs in it.

Is there a way I can add the UVs back into the model using a program like blender?

Cheers!

sentences:
Best way to manage weapons as GameObject on a script in Unity with C# I have a player game-object with a script Player. In the Player script I have a public properties weapons.

I want to have to just drag in this properties a script/prefabs. And the Player script must can get the properties of the weapons selected.

For example: imagine, we have two weapons, one is a pistol with 5 attack power, the other is a knife with 7 attack power.

Now I want to set pistol in the Player script.

What should I drag here ? A game-object with a weapon script ? Or a weapons script who instantiate a weapon ? Or maybe an another solution ...

The idea is to be able to create easily some weapons without scripting more. Just place a sprite, and modify some properties.

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:
What is best for 2D movement: velocity or AddForce? So I have tried both Velocity and addForce but I'm not getting the result I was expecting which makes me wonder if I fully understand what they do.

Move script (test script 1)

void Update () {

    if(Input.GetKeyDown(KeyCode.Space)){
        rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
    }

    if(Input.GetKeyDown(KeyCode.A)){
        rb.velocity = new Vector2(-moveSpeed, rb.velocity.y);
    }

    if (Input.GetKeyDown(KeyCode.D)){
        rb.velocity = new Vector2(moveSpeed, rb.velocity.y);
    }
}

Move2 script (test script 2)

void FixedUpdate() {
       float x = Input.GetAxis("Horizontal");
       float y = Input.GetAxis("Vertical");

       rbody.velocity = new Vector2(x*speed, y*speed);
  }

Both scripts are used independently.

Velocity when I press the key down (D or A) it stops after short time but addForce seems to do the same while that is set in FixedUpdate() or Update(), which is confusing as I thought it would keep it moving till the key was released? I have also found that if I press D it moves then stops but if I release D and press again and repeat the player does not move until I press a different move direction. Any ideas?

sentences: Dump texture from memory to the original format? How can you dump GPU memory (images and such that are loaded on it) to the standard format ?

sentences:
DirectX9 Drawing Sprites out of place due to offset This is my very first time into DirectX. Im trying to make a simple 2D game, just for learning the basics. And i've achieved that. The next step is to draw an animation using sprites.

For that, i downloaded SpriteBuddy, a very simple and user friendly software that helps you creating the metadata for your spritesheet.

Ok, now, the problem im having is that, the metadata that i get from spritebuddy (and i know is not the spritebuddy data that is wrong because i downloaded a few more software and the result was the same) come with a offset for every sprite.

Now, when im drawing, i said, lets add the offset to the position of the sprite, that should do it. Annnnnd it didnt, so i started to manualy change the metadata to see how bad was it. The result was that on the y axis, if you doubled the ammount in the metadata, the drawing was a lot less messy.

Is there something im doing wrong?

SpriteData* metadata = this->m_pXMLTraductor->getSpriteDimension(numFrame);//the number of the frame we want the dimensions
RECT temp = metadata->position;
D3DXVECTOR3 vCenter(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 vPosition(this->vPosition.x + this->metadata->offset.x, this->vPosition.y + (metadata->offset.y*2) , 0.0f);

this->m_pSprite->Begin(D3DXSPRITE_ALPHABLEND);
this->m_pSprite->Draw(
    this->m_pTexture->GetTexture(),
    &temp,
    &vCenter,
    &vPosition,
    D3DCOLOR_COLORVALUE(1.0f, 1.0f, 1.0f, 1.0f));
this->m_pSprite->End();
long long cont = 0;
this->numFrame++;
if (this->numFrame > this->m_pXMLTraductor->spriteCounter()){
    this->numFrame = 0;
}

This is how i render the model.

Is there any other way to do this? Srry about my english. Im working on it too ^^

sentences: How can I make a trail renderer flat with the normal of the nearest face? I'm making a basic skid system for a car model using a trail renderer. I have everything setup and working properly except that the trail renderer always faces the camera. I want the trails to be perfectly flat with the ground. So I thought if unity can make the faces all rotate towards the camera, then would it be able to rotate towards the normals of the nearest faces?

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

TypeError: this.scale.setScreenSize is not a function

any Idea how to solve this ?

sentences:
Blender move single UV point Texturing in Blender and when I am moving UVs around in the UV/Image Editor I'm finding that I can't move a single UV point without moving all other UVs that are connected to the vertex.

This seems odd to me as the UV unwrap should be completely distinct from the mesh. Is there some odd setting that I don't realise I have turned on?

sentences:
Farseer DebugViewXNA: scaling problem I'm trying to get into Farseer and XNA.
Before I do any real graphics, I want to use the Farseer debug view only.
The problem ist, that I don't really know which matrix to use and the other thing is that my objects look "squeezed". But in detail:

this.oGraphicsMgr.SupportedOrientations = DisplayOrientation.Portrait;
this.oGraphicsMgr.IsFullScreen = false;
this.oGraphicsMgr.PreferredBackBufferWidth = 640;
this.oGraphicsMgr.PreferredBackBufferHeight = 960;
this.oGraphicsMgr.ApplyChanges();

this.oWorld = new World( Vector2.Zero );

My gaming field is 640x960 screen units (pixels).

The setup of the debug view:

this.oDebugView = new DebugViewXNA( this.oWorld )
{
    DefaultShapeColor = Color.Red,
    SleepingShapeColor = Color.Pink,
    StaticShapeColor = Color.Yellow,
};
this.oDebugView.LoadContent( this.GraphicsDevice, this.Content );
this.oDebugView.AppendFlags( DebugViewFlags.Shape );
this.oDebugView.AppendFlags( DebugViewFlags.DebugPanel );
this.oDebugView.AppendFlags( DebugViewFlags.PolygonPoints );
this.oDebugView.AppendFlags( DebugViewFlags.CenterOfMass );
this.oDebugView.AppendFlags( DebugViewFlags.Controllers );

I create a circular body and place it in the middle of the screen. "Puck" inherits from Body.

public Puck(World oWorld) : base( oWorld )
{
    FixtureFactory.AttachCircle( 0.1, 1f, this );
    this.Restitution = RESTITUTION;
    this.BodyType = FarseerPhysics.Dynamics.BodyType.Dynamic;
}

My game's draw method:

protected override void Draw( GameTime oGameTime )
{
    GraphicsDevice.Clear( Color.CornflowerBlue );
    Matrix oProj = Matrix.Identity;
    this.oDebugView.RenderDebugData( ref oProj );
base.Draw( oGameTime );
}

The output is a window that is 640x960 pixels. In the middle I can see what is supposingly a circle but it is drawn elliptical: twice as high as it is wide.

It will only be shown as a circle if my game field's width and height are equal. As soon as they differ, the debug view draws all objects stretched using the ratio of width to height. Why? How to avoid?
I'm not using a camera. After long trying I figured out that Matrix.Identity is the only projection matrix that will actually make the debug view draw everything in the correct size. But to my understanding it should instead be a scaled matrix, transforming my physic units into screen units.
I want my gaming field to be 3x2 meters and the puck 0.2m diameter. Therefore I will have to define a scale factor from sim units to screen units. But nowhere can I see that the debug view would require this. How can it possibly know how big a shape has to be drawn?

sentences:
Guitar hero clone and music I am an indie game developer and I am doing a game similar to guitar hero. I am using tracks composed by musicians and I contacted them to sing a licensing contract. As is my first indie project I have no idea on how I should deal with the royalties aspect of this because each track as an ISRC code and each time a track is played in public there is a fee to pay to the "local" registration authority.

An iPhone game it is downloaded and not played on air (or physically distributed), and hence I think there is a specific legislation for this that specifies how much one should pay. I own some of the tracks composed and for this I think I won't have to pay a royalty (even if the track has an ISRC code) but for other tracks I just have a license "to use".

I wonder how a game like Guitar hero can sell on iPhone for as little as 0,99$ and then have "in app purchases" for packs of 3 songs (for about 2 dollars) and make a profit (I imagine they will have to pay a ISRC royalty).

Does anyone of you have any idea of this can work or if there is a section in this forum where I can ask this question? I understand is not about coding but I think is about development of a game in the broader sense.

sentences:
Spriting engine on mobile platforms, OpenGLES I'm writing a basic spriting engine for a blackberry app, and I want to know the best way to draw tons of sprites using the glDrawArrays() command.

We have several sprites that move around the screen, and a bunch of sprites for background tiles.  Zelda-1 like tiling.

My first idea was to create a quad at the origin for every sprite that exists and glTranslatef it to wherever it needs to be.  But several hundred sprites to draw per frame, you only get to call this once for every call to glDrawArrays() so its not a good idea to call glTranslatef() on each sprite as you draw it.  That's the reason glVertex3f() was left out..

So I'm left with the option of maintaining a master vertex array and every time a sprite moves in the game, pushing the update to move the 4 vertices that represent its quad in the MASTERVERTEXARRAY.  I don't like this but it seems my only option.

What I'd really like is to be able to somehow create an array of "translation values" to use for every quad that gets drawn..

glTranslateArray( ... ) ;

But alas, no such thing exists.

sentences:
Dynamic chunk loading with high FPS. But still chops I am creating a voxel world, (like any other person), but I currently have a small performance hit when loading/unloading chunks.

Right now I can load and unload chunks dynamically with "infinite" type world. I am using VBO's to store chunk data with float buffers. Also, (my big point), I am using Greedy meshing to only render the edges I need. My only thought of why it's not loading well is that I am using SSAO shading, which should have a hit on my FPS, but my FPS stays in the high 200's. Also, I am using frustum culling and normal culling. What I want is the player to have a really large render distance without actually rendering the chunks until the player is close. Almost like fog but instead of covering up unloading, it's actually reducing the detail as you move away.

Also, when a player creates a voxel or destroys a voxel (basically any change in the chunk) it saves the chunk to a file in the corresponding world folder.

Any ideas?

Here is a video of the game in its' current stage.

Here's a screenshot with a far render distance. Anything with a render distance that is far, hits the performance BAD

sentences:
Vertex Buffer Sharing between DirectX11 and Directx9 In my d3d9 engine i want to take benifit of compute shader of d3d11. So firstly I created a   vertex buffer in d3d11 with D3D11_BIND_UNORDERED_ACCESS and then tried to create the d3d9 vertex buffer with the Handle.
like

D3D11_BUFFER_DESC bd;
ZeroMemory(&bd, sizeof(bd));
bd.ByteWidth = sizeof(stVertex) * 100;
bd.BindFlags =   D3D11_BIND_UNORDERED_ACCESS  | D3D11_BIND_VERTEX_BUFFER   ;
bd.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS | D3D11_RESOURCE_MISC_SHARED;
hr = dev->CreateBuffer(&bd, NULL, &pVBuffer);       // create the buffer
hr = CreateBufferUAV( dev, pVBuffer, &m_pBufOutUAV );

....
HANDLE sharedHandle = NULL;
IDXGIResource* pDXGIResource = NULL;
pVBuffer->QueryInterface(__uuidof(IDXGIResource), (LPVOID*) &pDXGIResource);
pDXGIResource->GetSharedHandle(&sharedHandle);

hr = g_pd3dDevice9->CreateVertexBuffer( 100*sizeof(stVertex), NULL ,
                                  VERTEX::FVF_Flags, D3DPOOL_DEFAULT,
                                  &g_pVertexBuffer9, &sharedHandle ); //ERROR :

which gives error :

  Direct3D9: (ERROR) :Opened and created resources don't match, unable
  to open the shared resource. Direct3D9: (ERROR) :Cannot create Vidmem
  or Driver managed vertex buffer. Will NOT failover to Sysmem.
  Direct3D9: (ERROR) :Failure trying to create Vertex Buffer

After that i tried to create vertex buffer in directx9 first and tries to share that in direct11 but still it gave error.

HANDLE sharedHandle9 = NULL;
    hr = g_pd3dDevice9->CreateVertexBuffer( 100*sizeof(VERTEX), NULL ,
                                      VERTEX::FVF_Flags, D3DPOOL_DEFAULT,
                                      &g_pVertexBuffer9, &sharedHandle9 );
ID3D11Resource*  pTempResource11 = NULL;
    hr = dev->OpenSharedResource( sharedHandle9 , __uuidof(ID3D11Buffer) ,(LPVOID*) &pTempResource11 ); //Error

  D3D11: ERROR: ID3D11Device::OpenSharedResource: Returning
  E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION
  ERROR #381: DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN ]

I am able to share textures but not buffers.please help me here.
thanks.

sentences:
Calculate shadow map to overlay hidden line-of-sight things in 2d? Given a 2D sideview with even-sized grid squares and our hero in a known center-ish position like this

... and imagining this hero's line of sight like this...

how could one get the point values needed for the black overlay polygons as shown here? Thanks!

sentences:
How to find connected groups in a 2D grid of tiles Firstly, my English is very bad, sorry for this. That's why I showed my problem with a picture.

Block[,] sameTiles = new Block[
  WorldController.Instance.World.Width,
  WorldController.Instance.World.Height];

sameTiles keeps the same side-by-side green blocks. My problem is, I need to detect and separate the shapes made of connected blocks so I can access each shape separately. For example, putting each group on a layer of a 3D array:

Block[,,] differentTiles = new Block[
  100,
  WorldController.Instance.World.Width,
  WorldController.Instance.World.Height];

(100 connected shapes are supported at max)

Block[
  ShapeNumber,
  X Coord,
  Y Cood].

Here is my picture, I need to search this array and detect the four shapes of connected green blocks, storing them separately. Picture:

sentences:
What does glMultiDraw* do? I'm having trouble understanding exactly what glMultiDraw* does, and when it should be used.

Is it to be used if I have one VBO with multiple objects in it or do I use it with many VBO's?

It would be great if someone could give a real example of how to use this is a VAO/VBO as all the stuff I've found on google just explain what the function does rather that how to use it practically.

sentences:
Where to implement textures for tiles? So I just learned the basics of Java and was ready to try to create a protoype game in the style of Civ. So a tile&turn based game.

I created an enum for the different tiles:

public enum TerrainTile{

 WATER(1), GRASSLAND(1), HILL(2), FORREST(2), BLANK(99);

private final int id;
private final int moveCost;
private boolean hidden = true;

private TerrainTile(int moveCost) {
    this.id = this.ordinal();
    this.moveCost = moveCost;
}

I made a JFrame:

public class MainFrame extends JFrame {

private MapPanel pnlMap;

public MainFrame(Terrain map) {

    setTitle("MyGame");
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    getContentPane().setPreferredSize(new Dimension(500, 500));

    pnlMap = new MapPanel(map);
    pnlMap.setPreferredSize(new Dimension(500, 500));
    add(pnlMap);

    pack();
    setLocationRelativeTo(null);

}

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {

            BufferedImage mapImg = null;
            try {
                mapImg = ImageIO.read(MainFrame.class.getClassLoader().getResourceAsStream("frames/resources/map2.png"));
            } catch (IOException e) {
                e.printStackTrace();
            }

            Terrain map = new Terrain(mapImg);
            System.out.println("Terrain created:");
            map.printTerrain();

            JFrame frame = new MainFrame(map);
            frame.setVisible(true);

        }

And a JPanel for the map:

public class MapPanel extends JPanel {

private final Terrain map;

public MapPanel(Terrain map) {
    this.map = map;
}

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);

}

when I wasn't sure where to save the textures for the tiles.
Should I just read out the array of the map and do a switch statement to define inside the MapPanel class which texture to draw or should the textures better be implemented inside the enum?

sentences:
Behavior after collision using masks overlap I'm using masks to make collision detection in a game using pygame. The detection works well, but I have had problems with the behaviour after collision.

In most games, the obstacles are vertical or horizontal, making easy manipulate the velocity of objects moving. So, if the object collide, there is just two options: cancel x component or cancel y component. In this way, the object stop the move only in the normal direction.

But, my obstacles have any shape (not any, just rectangles and triangles) and direction, making things hard.

Basically, I want to cancel the velocity component in the normal direction to obstacle in the collision point.

Some help?

Thanks

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:
Change the color of GL.wireframe in Unity Need to render something with GL.wireframe, this is what I have at the moment.

void OnPreRender() {
    GL.wireframe = true;
}
void OnPostRender() {
    GL.wireframe = false;
}

However the wireframe rendered is black and this will not work for my game. I've tried adding the following to OnPreRender()

GL.Color (Color.red);

Unfortunately the wireframe remains black. Does anyone know the proper way of changing this color?

sentences:
Unity - Quaternion - Rotate / Unrotate Error I'm trying to un-rotate a quaternion, aligning it with the axis, and then rotate it back to where it was originally.
But with every iteration it seems to lose precision and just after 20 iterations the rotation disappears.
Here is an example, which is a simplification of my code:

Quaternion rotation = Quaternion.Euler (0f, 90f, 0f);
Debug.Log ("Before: " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

int iterations = 1;
for (int i = 0; i < iterations; i++) {
    var currentRotation = rotation;
    rotation = Quaternion.Inverse (currentRotation) * rotation;
    rotation = currentRotation * rotation;
}

Debug.Log ("After:  " + rotation.ToString ("F7") + " / Euler: " +
  rotation.eulerAngles.ToString());

With 1 iteration the output is:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071067, 0.0000000, 0.7071067) / Euler: (0.0, 90.0, 0.0)

With 5 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7071019, 0.0000000, 0.7071019) / Euler: (0.0, 90.0, 0.0)

With 10 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.7059279, 0.0000000, 0.7059279) / Euler: (0.0, 90.0, 0.0)

With 15 iterations:

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.4714038, 0.0000000, 0.4714038) / Euler: (0.0, 90.0, 0.0)

And finally with 19 iterations

Before: (0.0000000, 0.7071068, 0.0000000, 0.7071068) / Euler: (0.0, 90.0, 0.0)
After:  (0.0000000, 0.0000000, 0.0000000, 0.0000000) / Euler: (0.0, 0.0, 0.0)

At the 19th iteration the euler angles becomes zero, and at previous iterations altough the euler angles are still correct, if I rotate a vector with the quaternion its magnitude is changed.

I hope you can help me and sorry for my bad english!

sentences:
Calling glGetError() in release builds? Currently, I'm calling glGetError() after each OpenGL function call in order to be able to detect and report bugs.

I've been reading that glGetError() calls should be reduced to once per frame in release builds. But if I do this and something does not work properly I won't be able to report where the code is failing, I would get an exception report saying that something related to OpenGL is not working properly but I wouldn't be able to detect where the code is failing.

What are the most common aproaches to report errors related to OpenGL? Should I keep all the glGetError() calls or should I call glGetError() just once per frame?

sentences: Game Structure in depth I've been curious about game structure for some time now. Does everyone who is a game programmer come up with there own approach to structure there game, or is there like some sort of defined layout. to put this in prospective. Lets say a game programmer wanted to create a tiled map. Is there a specific way to do this, or does the every programmer do it there way.

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:
Weird rendering of bounding box I'm trying to make a bounding rect for my bullet which is in space invader game.
I'm using marmalade, and the bounding rect seems translated and doesn't bound the bullet at all, however the math is correct.
Here is a video of the behavior and a snippet of code
http://youtu.be/SbjMPKQ7ilE

void Bullet::Render()
{
    if (ShipBullet == nullptr)
        return;

    if (Visible)
    {
        Transform.SetIdentity();

        // Build transform
        Transform.SetRot(Angle);
        Transform.ScaleRot(Scale);
        Transform.SetTrans(Position);
        Iw2DSetTransformMatrix(Transform);
        Iw2DSetColour(Colour);

        CIwFVec2 pos = Transform.t;
        BoundingRect.x = pos.x;
        BoundingRect.y = pos.y;
        BoundingRect.w = (float)ShipBullet->GetWidth();
        BoundingRect.h = (float)ShipBullet->GetHeight();

        // Render image
        if (ShipBullet != 0)
        {
            int x = -(ShipBullet->GetWidth() / 2);
            int y = -(ShipBullet->GetHeight() / 2);
            Iw2DDrawImage(ShipBullet, CIwFVec2(x, y), CIwFVec2(ShipBullet->GetWidth(), ShipBullet->GetHeight()));
        }

// render bounding rect
#if 1
        Iw2DSetColour(0xff0000ff); // Set red
        Iw2DDrawRect(CIwFVec2(BoundingRect.x, BoundingRect.y),
            CIwFVec2(ShipBullet->GetWidth(),ShipBullet->GetHeight()));
#endif

    }
}

sentences:
How can i prevent objects faces clipping over other objects faces? I have a naked body, I have a bra over that body, I have a suit over that bra.

Since the objects arent accurate enough, i get ugly "clipping".
Is there a way or method I can prevent this? (except messing with the Scale)

Like a shader which gives out a Render-Queue to faces near other faces... and does always render first ... if the rendered item is near enough.

sentences:
How do I convert distance covered from meters to kilometers, in Unity? I am developing a game in Unity where I have to find a distance in kilometers, to find a passenger's fare based on  the covered distance.

This is what I have tried:

private Vector3 previousPosition;
public float cumulatedDistance;

void Awake()
{
    // initialize to the current position
    previousPosition = transform.position;
}

// Update is called once per frame
void Update () {
    cumulatedDistance += (transform.position - previousPosition).magnitude;
    previousPosition = transform.position;
}

How can I determine the distance covered, and convert it to kilometers?

sentences:
Missing texture after add new actors I want to add two types of characters multiple times but when I add a new actor to stage texture in "old" actors stops render.

I can add multiple KnightActor (without RatActor) or multiple RatActor (without KnightActor). When I try to add multiple KnightActor and RatActor on one stage only textures from newest actors are rendered (one RatActor and one KnightActor)

GameScreen.kt

override fun render(delta: Float) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)

    actorManager.addNewActors(stage)

    viewPort.camera.update()

    stage.act(delta)
    stage.draw()

    world.step(delta, 8, 3)
    debugger.render(world, viewPort.camera.combined)
}

ActorManager.kt

fun markToAdd(actor: BaseActor<*>) {
    toAdd.add(actor)
}

fun addNewActors(stage: Stage) {
    toAdd.forEach { actor: BaseActor<*> ->
        stage.addActor(actor)
        actor.addToWorld(worldService.getWorld())
        Gdx.app.log("afterAdd", (++charactersOnStage).toString())
    }
    toAdd.clear()
}

KnightActor.kt

override fun draw(batch: Batch, parentAlpha: Float) {
    super.draw(batch, parentAlpha)

    if (isMoving) {
        frameStateTime += Gdx.graphics.deltaTime
    }

    // DRAW TEXTURE
    val frame = animationManager.getFrameAndChangeSpeed(AnimationType.KNIGHT_WALK_RIGHT, frameStateTime, getSpeed())
    val frameX: Float = position.x - (size.width / 2)
    val frameY: Float = position.y - (size.height / 2)

    batch.draw(frame, frameX, frameY, size.width, size.height)

    // END DRAW
}

RatActor.kt

override fun draw(batch: Batch, parentAlpha: Float) {
    super.draw(batch, parentAlpha)

    if (isMoving) {
        frameStateTime += Gdx.graphics.deltaTime
    }

    // DRAW TEXTURE
    val frame = animationManager.getFrameAndChangeSpeed(AnimationType.RAT_WALK_LEFT, frameStateTime, getSpeed())
    val frameX: Float = position.x - (size.width / 2)
    val frameY: Float = position.y - (size.height / 2)

    batch.draw(frame, frameX, frameY, size.width, size.height)

    // END DRAW
}

AnimationManager.kt

fun getAnimation(animationType: AnimationType): Animation<TextureRegion> {
    return AssetsManager.loadSprite(animationType.spriteFile, animationType.alias).getAnimationForSprite(animationType.alias, animationType.width, animationType.height)
}
fun getFrameAndChangeSpeed(animationType: AnimationType, stateTime: Float, speed: Float, looping: Boolean = true): TextureRegion {
    val animation = getAnimation(animationType)
    animation.frameDuration = 1 / speed
    return animation.getKeyFrame(stateTime, looping)
}

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:
Collision/Intersection of (2D) Ray to Line Segment Given a ray (r0, r1) and a line segment (a, b), I need to calculate the normal of the line segment based on the direction of the ray. For example, in the following picture:

The correct normal given the ray (from picture) and segment should be normal n1. Here is the algorithm I am using to calculate the point of intersection:

public static Vector2? lineSegmentIntersection(Vector2 r0, Vector2 r1, Vector2 a, Vector2 b)
{
    Vector2 s1, s2;
    s1 = r1 - r0;
    s2 = b - a;

    float s, t;
    s = (-s1.Y * (r0.X - a.X) + s1.X * (r0.Y - a.Y)) / (-s2.X * s1.Y + s1.X * s2.Y);
    t = (s2.X * (r0.Y - a.Y) - s2.Y * (r0.X - a.X)) / (-s2.X * s1.Y + s1.X * s2.Y);

    if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
    {
        // Collision detected
        // Return the point of intersection
        return new Vector2(r0.X + (t * s1.X), r0.Y + (t * s1.Y));
    }

    return null; // No collision
}

Ideally, I would like to modify this algorithm to calculate the proper normal. Further, I know how to calculate the normals n0 and n1:

norm0 = new Vector2((b.Y - a.Y), -(b.X - a.X));
norm1 = new Vector2(-(b.Y - a.Y), (b.X - a.X));

What do I do next to determine which of those two normals to choose? I get the feeling this is fairly simple and I've been looking at it for too long...

sentences:
Help developing a scoring system for a tech tree based game I'm working on a tech tree based project in which the player would select "advancements" to effect several measurement stats, or "basic stats".  I have a working excel model that will calculate the "scores" for these basic stats based on advancements selected, but I'd eventually like to use these measurement stats that I have to calculate higher level measurements like population or total production power.

For example in the case of calculating "Population", I'd like to take the (current pop + (current pop. * fertility rate)) - death rate.  Fertility rate would be calculated based on the "basic stats" of "health" and "food supply", and death rate on metrics like "health" and "squalor".

I'm not really sure how to use these measurements though...  If health and food supply both start at 0 and increased by 5 over the course of a few turns, how should I use these scores in a meaningful way to do what I'm trying to do in the case of fertility rate?  Fertility rate should be expressed as a certain percentage of total pop. but I'm not sure how to get there from two scores of 5.  I don't think this will be a simple process, but I feel like I'm missing some basic concepts to put this into place.  Is there a name for this kind of scoring system?

Any ideas would be appreciated!  Thanks.

sentences:
Alpha Blending performance on IOS I've got few questions without responses about my game development, can you help me? Here is the questions:

In my game when a large object appear on the screen, the GPU go to his limits, my framerate become very slow. How can I handle that? (I'm working on mobile). (
Currently, I'm sorting object from back to front)
I've read some stuff about batching (How to draw efficiently large number of objects with alpha blending?), how can I handle batching when my game need to draw my scene from back to front with alpha blending?
What is faster: Add a condition to test pixel transparency in fragment shader or enable Alpha blending? (I've got colors around my sprites without alpha blending or condition)

Thanks!

sentences:
BSPs, Octrees and modern graphics hardware I have read a lot of literature on BSPs, Octrees and like. Problem is that it is all old literature from software rendering time. Nobody describes how it is implemented today. So here is my idea how to do it and my question.

Let's say that I use some partitioning algorithm, it does not matter which one. I subdivide my level mesh into multiple partitions and store it in RAM. Should I simply create vertex buffers for each node so I can render my scene faster or what?

How do you do it, is there any better way today?

Thank you

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

sentences:
How can I provide attribute extensibility in a component-based entity system? This question and its answers move against utilizing an entity component system where the component itself is just a generic class with an dynamic container for the attributes/properties  of the component.

Some definitions for this thread:

Entity = ID + collection of components
Component = Container (std::map<attribute_name, attribute_value>) of attributes/properties, such as health, age, name, gender, etc.

I understand and am aware of the drawbacks (no compile-time type safety, added overhead of looking up values from the container). Nonetheless, I currently am working on/with such a system, with the following argument, which I would now like to put to the test: data-driven design.

If all the attributes of the component are in a dynamic container, it is very easy (in fact possible at all) to add new ones later on, outside of the source code. So you can easily script new attributes later on. And dumping/saving the state of the component is a piece of cake.

Compared to the proposal in the above mentioned thread, I also have an own class for each component, to implement some basic behavior and helper methods directly in them (but those also need to look up their values from the container).

Example:

My component base class has a map for all the attributes/property:

typedef std::map<std::string, PropertyBase*> PropertyMap;

So an actual component looks something like the following. In the constructor I populate the attributes I want the component to have, by adding them to the map. Later I can read and update them if needed, but always with a performance penalty, since I first have to find them in the std::map.

class Person : public ClonableComponent<Person>
{
public:
    Person(ComponentFactory* const pFactory, ComponentType type, ComponentID id, GameEntity* const pEntity)
    : ClonableComponent(pFactory, type, id, pEntity)
{
    // General
    addProperty(new Property<int>("age", PROP_INT, 0));
    addProperty(new Property<String>("gender", PROP_STRING, "unknown"));
    addProperty(new Property<String>("currentLocation", PROP_STRING, "unknown"));

    // Feelings
    addProperty(new Property<bool>("isTired", PROP_BOOL, false));
    addProperty(new Property<bool>("isHungry", PROP_BOOL, false));
    addProperty(new Property<bool>("isThursty", PROP_BOOL, false));
}

void enterLocation(GameEntity* pLocGE)
{
    if(pLocGE->hasComponent(COMP_TYPE_LOCATION))
    {
        updateProperty("currentLocation", pLocGE->getName());
        updateProperty("casinoEnteredDateTime", (int)std::time(0));
    }
}

void leaveLocation()
{
    updateProperty("currentLocation", std::string("unknown"));
}
};

However, that thread made me think, and I am now doubtful that my approach will work well in the long run (maintenance, scaling and performance wise) and I am therefore considering moving to an directly typed approach with no look-up overhead. At the same time I don't want to loose that data-driven extendability.

I thought of a hybrid approach: Keep all known variables as actual language variables but also add a container (std::map) for scripted/data-driven variables. Therefore I'd know that my internal access is very fast and only the later added scripted extension would have the slow look-up and the other mentioned penalties.

Question:
What do you use / would propose as an approach for a data-driven ECS in terms of attribute storage/handling? How do you keep it extendable? Would you recommend such a hybrid approach (real variables internally, container for new, external definitions)?

sentences:
UDK ParticleSystem Problem I use below code to create my particles ( in fact, I don't know any other way.)

spawnedParticleComponents = WorldInfo.MyEmitterPool.SpawnEmitter(ParticleSystem'ParticleName', Location, Rotator );
spawnedParticleComponents.setTranslation(newLocation);
...

And unfortunately, I spawn many particles in game.

When I play my game, after some time, I see Exceeded max active pooled emitters! Warning in console .

To solve the problem, first, I tried spawnedParticleComponents.DeactivateSystem();, But it doesn't help.
Then I try WorldInfo.MyEmitterPool.ClearPoolComponents(false);, But it doesn't either .
:(

How can I destroy many spawned particles and avoid this warning ?

sentences:
How to implement drawing only to the specific area of the window? I'm trying to implement "canvas" where I will display loaded texture and select specific parts of it so I can put them on tilemap, I'm also trying to add zooming and panning only in "canvas" part of the window. I've tried using view and viewport but setting viewport size is what I'm struggling with the most. What I've tried:
First I set the view to be size of the window and its center is offset by (-250, -20) - this the point where properties window ends (x = 250) along with main menu bar (y = 20):
m_view.reset(sf::FloatRect(-250.0f, -20.0f, get_window().getSize().x, get_window().getSize().y));

Then if window has been resized I process the Resized event:
if (event.type == sf::Event::Resized)
{
    m_view.reset(sf::FloatRect(-250.0f, -20.0f, event.size.width, event.size.height));
    get_window().setView(m_view);
}

But if I want to implement panning (moving the view) and zooming I need to set viewport so it will only render in "canvas" area. I can try to set viewport's FloatRect manually but what if window will get resized? How do I deal with this problem?

Godot TileSet/TileMap Editor as reference

sentences:
UE4 Code Project is not showing sub folders created within C++ Classes Folder even though they exist These were my steps.
Created an empty code project in UDK4.
The editor starts up.
On the left bottom you have:

If you try to right click on C++ Classes,
Or select [Add New] while having C++ Classes highlighted
The option to add a new folder is greyed out.

This seems odd, since you can add a new C++ Class and set your sub folder in there. When the class gets created and our IDE in my case (Visual Studios) opens up the folder gets created in there no problem. I also tried setting the public or private option when making a new c++ class that just added a sub folder of /private /public where my new class gets nested in code but still not seeing the folder format display on the Unreal Editor.

So what's going on with UDK4? It seems highly unlikely that the issue is actually a bug.
Is it something I'm doing wrong? Or some second step I need to do?

Different Attempts:
1) Tried making the sub folder in the class create pop up, that created the folder in Visual Studios but still did not show up in the Unreal Editor
2) Restarted Unreal Editor to see if it would refresh the folder hierarchy, no luck.
3) Shutdown both UDK4 and VS and restarted UDK4 then VS also tried VS then UDK4 just in case as a second test.
4) Attempted to drag and drop a folder into the hierarchy from Visual Studios you just get a red O with a slash next to the mouse icon stating it wont allow it.

sentences: Mobile game textures sizes I am developing a Windows Phone 7 game using XNA 4.0 which I plan to later port to iOS and android using Monotouch and Monodroid. My question is how to determine what texture size should I include? This is because the in-game objects that utilize the textures dont care about the actual texture size and just re-size them. Windows phone by its own exists in multiple resolution variants. Should I pick the highest resolution emulator and then measure the sizes of my in-game objects, and then re-size their respective textures to be the same?

sentences:
Keycodes map to wrong keys I'm working on an Android app/semi-game (API 19-23, Java) and I used this website to help me handle controller input. Overall it looks pretty similar to what the website says for "Process Gamepad Button Presses":

public boolean processKeyEvent(int keyCode, String name) {
    boolean handled = false;
    switch (keyCode) {
        case KeyEvent.KEYCODE_BUTTON_L1:
            ...
        case KeyEvent.KEYCODE_BUTTON_R1:
            ...
        case KeyEvent.KEYCODE_BUTTON_A:
            ...
        case KeyEvent.KEYCODE_BUTTON_B:
            ...
        case KeyEvent.KEYCODE_BUTTON_X:
            ...
        case KeyEvent.KEYCODE_BUTTON_Y:
            ...
        case KeyEvent.KEYCODE_BUTTON_START:
            ...
        case KeyEvent.KEYCODE_BACK:
            ...
    }
    if(handled) {
        return true;
    }
    return false;
}

and:

public boolean dispatchKeyEvent(android.view.KeyEvent event) {
    if(event.getAction() == KeyEvent.ACTION_DOWN) {
        handled = script.processKeyEvent(event.getKeyCode(), event.getDevice().getName());
    }

    if (handled) {
        return true;
    } else {
        return super.dispatchKeyEvent(event);
    }
}

It does return the right keycodes (according to this list), so:

L1: 102
R1: 103
A: 96
B: 97
X: 99
Y: 100
Start: 108
Back: 4

The problem is that half of the buttons not only activate through their right case but also other ones, which then has side effects of course:

B activates: X, Y, Start
X: Y, Start
Y: Start
R1: A
L1: R1, A

At first I thought that maybe the controller (SteelSeries Stratus XL for Android) had broken but I already checked with a second one (MogaPro Power) and I got the same results with it.

Has anyone else experienced this before? Any idea what I could try to fix this?

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:
Uniform arrays do not work on every GPU I am trying to implement instanced rendering for objects that repeat, so I came up with idea I could simply group objects that loaded same model files, create array with their Model matrices and so on, and finally pass this array as uniform array to shaders, which will be indexed by gl_instanceID to get correct model matrix for given objects.

C++ implementation looks pretty much like this:
    std::vector RelativePositions, Scales;
    std::vector Models;

int ctr = 0;
bool first = true;
int isz = 0; obj->getIndices(isz);

// pDrawData->refObjects holds all Object3D instances which share same model geometry

for (std::list<IObject3D*>::iterator pObj = pDrawData->refObjects.begin(); pObj != pDrawData->refObjects.end(); pObj++) {
    IObject3D *obj = *pObj;
    int render = prepareForRender(obj, flags, isShadow, offset);
    if (!render) continue;
    if (first) {    //this is gonna be same for all objects of this class
        setUniform(Type, (int)obj->getType());
        setUniform(Flags, (int)obj->getFlags());
        first = false;
    }
    Scales.push_back(obj->getScale());
    RelativePositions.push_back(obj->getPos());
    Models.push_back(obj->getModel());
    ctr++;
}
if (ctr) {
    int Rem = 0;
    const int Step = MAX_OBJ_PER_INST;  // = 64
    for (size_t i = 0, j = Scales.size(); i < j; i+=Step) {
        Rem = Scales.size() - i;
        if (Rem > Step) Rem = Step;
        //following functions set uniform array of specified length
        setUniform(Scale, Scales.data()+i, Rem);
        setUniform(RelativePosition, RelativePositions.data()+i, Rem);
        setUniform(Model, Models.data()+i, Rem);
        glDrawElementsInstanced(GL_TRIANGLES, (GLsizei)isz, GL_UNSIGNED_INT, 0, Rem);
    }
}

Rendering object is done via Vertex Shader > Tess Control Shader > Tess Eval Shader > Geom Shader > FragmentShader.
Instance ID is being passed using flat out/in int InstanceID; from shader to shader while being once set in Vertex shader as gl_InstanceID.

Tessellation Evaluation Shader logics look like this:

    #version 430
    layout(triangles) in;

    in vec3 tcPosition[];
    in vec3 tcTexCoord[];
    in vec3 tcNormal[];
    flat in int tcInstanceID[];

    out vec3 tePosition;
    out vec3 teDistance;
    out vec3 teTexCoord;
    out vec3 teNormal;
    flat out int teInstanceID;

    #define MAX_OBJ_PER_INST 64

    uniform mat4 Model[MAX_OBJ_PER_INST];
    uniform vec3 Scale[MAX_OBJ_PER_INST];
    uniform vec3 RelativePosition[MAX_OBJ_PER_INST];

    // ... other uniforms

    void main(void)
    {
        vec3 p0 = gl_TessCoord.x * tcPosition[0];
        vec3 p1 = gl_TessCoord.y * tcPosition[1];
        vec3 p2 = gl_TessCoord.z * tcPosition[2];

        // ... other stuff ...

        teDistance = gl_TessCoord;
        tePosition = (p0 + p1 + p2);
        teInstanceID = tcInstanceID[0];

        switch(Type){
            // ... other types ...
            default:
                tePosition = (vec4(tePosition,1)* Model[teInstanceID]).xyz * Scale[teInstanceID] + RelativePosition[teInstanceID];
                break;
        }
    }

This works fine when I run it on any nVidia GPU when on laptop, but when I try to run it on AMD GPU or Intel Integrated Graphics, it suddenly doesn't work and I only get blank screen.

But if I remove uniform arrays and pass only single variable for uniform, so all instances would suddenly have same model matrix, position and scale, it works even on other GPUs, so problem is definitely with arrays...

Is there any solution to this?

sentences:
Unity3D: Rotating the head and an animation gets clashed A rigged generic models head keeps rotating to follow the camera. When there is an animation like shaking the head, the head animates weirdly as compared to without rotation. Is there anyway to fix it?

The neck gets protruded forward.

the heirarchy is like spine
                           neck
                               neck_02
                                     head #here is my rotation script

For some reason, if I attach the script to neck, the neck doesn't rotate.

The neck gets protruded forward when the head shaking animation occurs

sentences:
Make a bullet shape around model in libgdx How do I make a btBoxShape around a Model or ModelInstance in Libgdx?
This is my code:

modelInstance.calculateBoundingBox(boundingBox);
collisionShape = new btBoxShape(boundingBox.getDimensions(tempVector3).scl(.5f));

This works and creates a box of the right size but it is offset from the model. I cant figure out how to make it around the model and not offset.

sentences:
How do I do 2D z-index parallax in Unity3d? I am new to unity3d and want to develop a simple game like crazy cabie. I have to implement a z-index parallax for moving sprites towards the player and generating new sprite at the farthest z-index.

How can I do this?

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:
How to manage changing Z-Index in an Entity-Component-System? If got an Entity Component System based game-project (like classic zelda).

The Player as well as Enemys are Entities with sprite- and
tranform-components.
The Weapons are also Entities with sprite- and tranform-components.
The player and the Enemies can pickup weapons.
Weapons got an ParentComponent so they will be rendered realtive to
the Carrier-Entity.
There is a script/system for that.
No everytime an player/enemy walks upwards, the weapon must rendered BEHIND/under
the carrier for the illution, that the player walks to the top of the
screen.
I will do this by switching the Z-Index of the transform-component of the carrier with the one of the weapon.
Unfortunately, the rendering system is a Sorted-Iterating-System
which holds a sorted list of all entities with Sprite-Components so
everytime Im changing the Z-Index of an Entity, I have to force the
re-sortening of the list.
This works but sorting an entire list in
java almost every gamellop-update sounds very bad.

Is this really a good idea or should I try something else?
BTW: In practice, Im using libGdx with Ashley as the ECS.

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:
how disable texture after drawing an object? i try to make a textured object then draw other without (only colored).

i had tried to play with glEnable/Disable(GL10.GL_TEXTURE_2D) ,         gl.glEnable/DisableClientState(GL10.GL_COLOR_ARRAY/GL10.GL_TEXTURE_COORD_ARRAY);

But i never get the result i expect.

(first colored + textured then others textured and colored too)
(first colored and not textured then other colored and not textured)

i don't know if this is because i don't disable some things at the good place or if i missing something.

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:
3D objects with animated bones Monogame in the year 2017, is it possible? I've been working on a game for quite some time now and suddenly it seems that I've hit the great wall of..

In the earlier XNA there were possibilities to use animation exported with the 3D object .fbx files, but this was in the old XNA with SkinningData and AnimationPlayer etc.

I can't use these old samples that I've found on the Internet.
How can I in the year 2017 animate an animated 3D object exported from Blender .fbx animate it in Monogame by the use of them bones?

I'm using Monogame in C# VS2017 but the Microsoft.Xna.Framework.Content.Pipeline.Processors and everything else doesn't exist.

The closest thing to an animation that I've made is to split up my object into pieces in Blender and animate each part with CreateTranslation and CreateRotation.. But that's old school to do it that way.

Or, I misunderstood the whole thing?

I'm not going to use Unity.

sentences:
Getting the angle between three points? I have three points, A, B and C (stored as Vector2 in Unity).  I am trying to find the angle at point B if there were a line AB and and a line BC.  I know, this should be a simple google search, and I have found several methods but for some reason, they ALL return totally unexpected results with my data set!

I checked to make sure that the three points I pass to compute the angles are indeed the correct (x,y) coordinates, and that same data is used elsewhere in my code without any problems.

Considering that all functions return strange results, it must be that I am not understanding something here...

here is one formula:

Vector2 A = //some vector2.normalized
Vector2 B = //some vector2.normalized
Vector2 C = //some vector2.normalized
float Angle = Mathf.Atan2(B.y - A.y, B.x - A.x) - Mathf.Atan2(B.y - C.y, B.x - C.x);

Here's another that I tried where p0,p1,and p2 and just vector2's:

function findAngle(p0, p1, p2) {
        var a = Math.pow(p1.x - p0.x, 2) + Math.pow(p1.y - p0.y, 2),
            b = Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2),
            c = Math.pow(p2.x - p0.x, 2) + Math.pow(p2.y - p0.y, 2);
        return Math.acos((a + b - c) / Math.sqrt(4 * a * b));
    }

The data is a List of Vector2 control points for creating Bezier curves. I want to calculate the angle between index 0,1,2 then 2,3,4 then 4,5,6 etc. with the middle index as the angle needed.

I understand that both formulas return radians, but converting to degrees returns sometimes 180 for all points even though the points are all different and the angles vary greatly, sometimes 0 (if I switch the points around), and in the case of the atan2 function above, it gives numbers that "look" like angles, but plotting the points, one can see that the angles do not correspond to the visual plots...  I must be doing something very dumb here and I'm not great with math so any hand-holding is much appreciated.

Here's an image of the output:

sentences:
Unable to Set Text of another Text Object The Idea: Pressing a button in the canvas will allow the player to select a race. A script is attached to an object which is accessed though the OnClick() function of the button.

The script is supposed to get which race is selected based on which button is pressed and fetch a race description in a Text Object named "DescriptionText".

However a description is not displayed, and I get this error:  "NullReferenceException: Object reference not set to an instance of an object
GOnClick.GetRaceDesc () (at Assets/Scripts/GUI_Scripts/GOnClick.cs:24)".

I can't see what I am doing wrong, so here is my code:

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

public class GOnClick : MonoBehaviour {

public string race, description;
void Start()
{
    race = "";
    description = "";
}

void Update()
{
    GetRaceDesc();
}

public void GetRaceDesc()
{
    //Button butnText = GameObject.FindObjectOfType<Button>();
    //race = butnText.GetComponentInChildren<Text>().text;
    *(line 24)* race = gameObject.GetComponentInChildren<Text>().text;
    GameObject descRect = GameObject.Find("DescriptionText");

    if(race == "Dark Elf")
    {
        BaseRace raceSelection = new DarkElfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "High Elf")
    {
        BaseRace raceSelection = new HighElfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Wood Elf")
    {
        BaseRace raceSelection = new WoodElfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Human")
    {
        BaseRace raceSelection = new HumanRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Dwarf")
    {
        BaseRace raceSelection = new DwarfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Orc")
    {
        BaseRace raceSelection = new OrcRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Goblin")
    {
        BaseRace raceSelection = new GoblinRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Tiefling")
    {
        BaseRace raceSelection = new TieflingRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Half Dragon")
    {
        BaseRace raceSelection = new HalfDragonRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Werewolf")
    {
        BaseRace raceSelection = new WerewolfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }

    }

}

Thanks in advance for any help.

sentences:
using a wire-frame shader on a plane how can i also fill in the squares with a solid color so that each square's color can be changed? I'm not sure if using a shader is the best way for what I'm trying to achieve, but I would like to apply a color to each of the squares like in the picture and have the ability to change each color separately. I got the shader on this site: Link to Shader site

Shader "Custom/Geometry/Wireframe"
{
Properties
{
    [PowerSlider(3.0)]
_WireframeVal("Wireframe width", Range(0., 0.5)) = 0.05
    _FrontColor("Front color", color) = (1., 1., 1., 1.)
    _BackColor("Back color", color) = (1., 1., 1., 1.)
    [Toggle] _RemoveDiag("Remove diagonals?", Float) = 0.
}
    SubShader
{
    Tags{ "Queue" = "Geometry" "RenderType" = "Opaque" }

    Pass
{
    Cull Front
    CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma geometry geom

    // Change "shader_feature" with "pragma_compile" if you want set this
keyword from c# code
#pragma shader_feature __ _REMOVEDIAG_ON

#include "UnityCG.cginc"

    struct v2g {
    float4 worldPos : SV_POSITION;
};

struct g2f {
    float4 pos : SV_POSITION;
    float3 bary : TEXCOORD0;
};

v2g vert(appdata_base v) {
    v2g o;
    o.worldPos = mul(unity_ObjectToWorld, v.vertex);
    return o;
}

[maxvertexcount(3)]
void geom(triangle v2g IN[3], inout TriangleStream<g2f> triStream) {
    float3 param = float3(0., 0., 0.);

#if _REMOVEDIAG_ON
    float EdgeA = length(IN[0].worldPos - IN[1].worldPos);
    float EdgeB = length(IN[1].worldPos - IN[2].worldPos);
    float EdgeC = length(IN[2].worldPos - IN[0].worldPos);

    if (EdgeA > EdgeB && EdgeA > EdgeC)
        param.y = 1.;
    else if (EdgeB > EdgeC && EdgeB > EdgeA)
        param.x = 1.;
    else
        param.z = 1.;
#endif

    g2f o;
    o.pos = mul(UNITY_MATRIX_VP, IN[0].worldPos);
    o.bary = float3(1., 0., 0.) + param;
    triStream.Append(o);
    o.pos = mul(UNITY_MATRIX_VP, IN[1].worldPos);
    o.bary = float3(0., 0., 1.) + param;
    triStream.Append(o);
    o.pos = mul(UNITY_MATRIX_VP, IN[2].worldPos);
    o.bary = float3(0., 1., 0.) + param;
    triStream.Append(o);
}

float _WireframeVal;
fixed4 _BackColor;

fixed4 frag(g2f i) : SV_Target{
    if (!any(bool3(i.bary.x < _WireframeVal, i.bary.y < _WireframeVal,
[![Plane with Shader attached][1]][1]i.bary.z < _WireframeVal)))
    discard;

return _BackColor;
}

    ENDCG
}

    Pass
{
    Cull Back
    CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma geometry geom

    // Change "shader_feature" with "pragma_compile" if you want set this
keyword from c# code
#pragma shader_feature __ _REMOVEDIAG_ON

#include "UnityCG.cginc"

    struct v2g {
    float4 worldPos : SV_POSITION;
};

struct g2f {
    float4 pos : SV_POSITION;
    float3 bary : TEXCOORD0;
};

v2g vert(appdata_base v) {
    v2g o;
    o.worldPos = mul(unity_ObjectToWorld, v.vertex);
    return o;
}

[maxvertexcount(3)]
void geom(triangle v2g IN[3], inout TriangleStream<g2f> triStream) {
    float3 param = float3(0., 0., 0.);

#if _REMOVEDIAG_ON
    float EdgeA = length(IN[0].worldPos - IN[1].worldPos);
    float EdgeB = length(IN[1].worldPos - IN[2].worldPos);
    float EdgeC = length(IN[2].worldPos - IN[0].worldPos);

    if (EdgeA > EdgeB && EdgeA > EdgeC)
        param.y = 1.;
    else if (EdgeB > EdgeC && EdgeB > EdgeA)
        param.x = 1.;
    else
        param.z = 1.;
#endif

    g2f o;
    o.pos = mul(UNITY_MATRIX_VP, IN[0].worldPos);
    o.bary = float3(1., 0., 0.) + param;
    triStream.Append(o);
    o.pos = mul(UNITY_MATRIX_VP, IN[1].worldPos);
    o.bary = float3(0., 0., 1.) + param;
    triStream.Append(o);
    o.pos = mul(UNITY_MATRIX_VP, IN[2].worldPos);
    o.bary = float3(0., 1., 0.) + param;
    triStream.Append(o);
}

float _WireframeVal;
fixed4 _FrontColor;

fixed4 frag(g2f i) : SV_Target{
    if (!any(bool3(i.bary.x <= _WireframeVal, i.bary.y <= _WireframeVal,
i.bary.z <= _WireframeVal)))
    discard;

return _FrontColor;
}

    ENDCG
}
}
}

sentences:
Syncing Sprites themselves over a Network Ok, just found out I can't use [SyncVar] for a sprite gameobject. Furthermore that, [SyncVar] works only on simple values. My question is How would I go about syncing a Sprite over a network?

To explain the context for where I need it, I have a code for players to select an Avatar to play with. Player 'A' and 'B' are able to change their avatars in their own respective device. But the changes made by player 'A' are not reflected in 'B' and vice versa.

So the question is How do I sync a Sprite GameObject?

Note: I am using unity 5.4 and unity's default multiplayer system.

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:
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:
Minecraft Mod portable torch/lantern I have just started making a mod for minecraft, I learned how to make items and import custom png's and have gotten all of that to work. I have been searching around the code trying to find a way to make an item being held or in the inventory give off light around the player. I do have experience coding in java, but I am not well acquainted with the minecraft code.

(This is using mcp 5.6 with modloader in minecraft 1.1 with eclipse)

sentences:
What can I do to avoid one-off flags and checks throughout my code? Consider a card game, such as Hearthstone.

There are hundreds of cards that do a wide variety of things, some of which are unique even to a single card! For instance, there is a card (called Nozdormu) that reduces player turns to only 15 seconds!

When you have such a wide variety of potential effects, how do you avoid magic numbers and one-off checks all over your code? How does one avoid a "Check_Nozdormu_In_Play" method in the PlayerTurnTime class? And how can one organize the code such that when you add even more effects, you don't need to refactor core systems to support stuff they've never had to support before?

sentences:
Can't sample texture in HLSL using DX11 Environment:

Windows 7 x64
Visual Studo 2012
DirextX11
HLSL Shader Model 5
Ogre 1.9

Okay, so I'm trying to sample a texture in my pixel shader but I'm coming across some strange problems.  Here's the pixel shader:

struct PS_INPUT {
    float4 pos : SV_POSITION;
    float2 uv  : TEXCOORD0;
};

Texture2D tex0;
SamplerState s0;

float4 pixel_shader(PS_INPUT input) : SV_TARGET {
    float3 texSample = tex0.Sample(s0, input.uv);

    float4 color = float4(1,1,1,1);

    color.xyz = texSample;

    return color;
}

If you want / need it here's the ogre .material definition:

material simpleMat
{
    technique
    {
        pass simpleMat
        {
            vertex_program_ref vertex_shader {}
            fragment_program_ref pixel_shader {}
        }

        texture_unit 0
        {
            texture diffuse.png 2d
            tex_address_mode wrap
        }
    }
}

This produces mostly black on my object, but I get 2 random white pixels.  But here's the strangest part.  When I debug the pixel shader in visual studio texSample nearly always equals zero.  So I decided to try something crazy, I debugged the program, got the value of input.uv and then modified the shader to use these values explicitly.  When I do this texSample actually contains the correct color value.  So yeah...  any help is much appreciated!

Rojuinex

EDIT

Here is a snapshot that shows the issue in detail:

http://www.pasteall.org/pic/show.php?id=74835

EDIT 8/4/2014

Upon further investigation I have discovered that the further the object is from the camera, the darker the texture becomes.  If the camera is right up against the object, the texture has the right color values, but as it moves away the sampler returns darker and darker values until they are black.

sentences:
How to stop camera rotation after reaching a specific angle? I have a camera in my scene that I want to rotate around the player. The rotation is done when the camera rotation state is at CameraRotation.Left or CameraRotation.Right and CameraRotation.None indicates that the camera should stop rotating and just follow the player.

I want the camera to rotate around the player and stop after it reaches a specific angle (180 degrees) in the y axis in the CameraRotation.Left or CameraRotation.Right from the position the camera was at the start of the rotation. It would also be helpful if some direction is given on how to edit the SmoothFollow() method so that it follows the player with the camera still rotated.

The problem is I'm not familiar with rotations and not sure whether to use Euler angles or quaternions so any tips would help.

private void LateUpdate()
{
    if (GameManager._RotateCamera == CameraRotation.None)
    {
        SmoothFollow();
    }
    else if (GameManager._RotateCamera == CameraRotation.Left)
    {
        transform.RotateAround(player.transform.position, Vector3.up, rotationSpeed * Time.deltaTime);
    }
    else if (GameManager._RotateCamera == CameraRotation.Right)
    {
        transform.RotateAround(player.transform.position, Vector3.down, rotationSpeed * Time.deltaTime);
    }
}

// Make the Camera follow the player smoothly
private void SmoothFollow()
{
    Vector3 desiredPoistion = player.position + offset;
    Vector3 smoothedPosition = Vector3.SmoothDamp(transform.position, desiredPoistion, ref velocity, smoothSpeed);

    transform.position = smoothedPosition;

    transform.LookAt(player.transform);
}

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 do directional per fragment lighting in world space? I am attempting to create a GLSL shader for simple, per-fragment directional light.  So far, after following many tutorials, I have continually ran into the issue: my light is specified in world coordinates, however, the shader treats the light's position as being in eye space, thus, the light direction changes when I move the camera.  My question is, how to I transform a directional light position such as (50, 50, 50, 0) into eye space, or, would doing things this way be the incorrect approach to the problem?

sentences:
Xbox thumbstick used to rotate sprite, basic formula makes it "stick" or feel "sticky" at 90 degree intervals! How do you get smooth rotation? I am using a very basic formula to calculate what angle my sprite (spaceship for example) should be facing based on the Xbox controller thumbstick i.e. you use the thumbstick to rotate the ship.

In my main update method:

shuttleAngle = (float) Math.Atan2(newGamePadState.ThumbSticks.Right.X, newGamePadState.ThumbSticks.Right.Y);

In my main draw method:

spriteBatch.Draw(shuttle, shuttleCoords, sourceRectangle, Color.White, shuttleAngle, origin, 1.0f, SpriteEffects.None, 1);

As you can see it's quite simple, I take the current radians from the thumbstick and store it in a float shuttleAngle and then use this as the rotation angle (in radians) argument for drawing the shuttle.

For some reason when I rotate the sprint it feels sticky at 0, 90, 180 and 270 degrees angles.  It wants to settle at those angles. It's not giving me a smooth and natural rotation like I would feel in a game that uses a similar mechanic. PS: My Xbox controller is fine!

sentences:
Why do I have additional glBindBuffer() calls? I have a OpenGL2/OpenGLES2 application and it among others renders a sphere using the following pseudocode:

Update vertices data on CPU
call glBufferSubData(GL_ARRAY_BUFFER, ...) to update them on GPU size
in a loop calls glDrawElements

Now I'm checking it under RenderDoc and see additional calls to glBindBuffer between glDrawElements:

glBindBuffer(GL_ARRAY_BUFFER, 0)
glBindBuffer(GL_ARRAY_BUFFER, my_vbo_id)
glDrawElements

Why I see those additional calls? Why GL driver (or GL library?) inserts them?

sentences:
Execute function every X points In my game, the score can go up quite rapidly and by varying amounts, depending on the action taken.

For instance, at the start of the game, one could climb from 1 - 50 one by one, or they could rocket past 50 by getting a score of 10, 25, and 40.

My question is: How do I call a function every time they pass a factor of 50 (50, 100, 150, 200, etc.)?

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:
Spherical map representation My latest game will take place on a small planetoid. I am looking for good data structure for representing cells on the surface of a sphere.
Triangles, squares, pentagons, hexagons? Which one minimises stretch the most and creates the best tiling?

Spherical mapping is the easiest but the stretch at the poles is unacceptable. Cubemapping is also fairly easy but there would still be considerable stretch near the cube corners.
Subdividing an icosahedron seems the best in terms of stretch but there is the problem of indexing many triangular arrays and finding neighbouring cells at the boundaries would be difficult.

I guess I could use a single linear array of points representing N-gons, each with an array of N neighbour indices, but that seems like a huge waste of space.

The game has RTS elements so I will be storing things like influence maps and performing A* pathfinding and convolution, so the representation has to be efficient.

sentences:
I am trying to implement a falling animation to my game and i am having alot of problems doing so i am trying to have it so that when my character isnt touching anything he plays an animation of falling, yet when he moves from one game object to different one, he plays the animation. for example if he steps from one platform to another, even if he doesnt have to jump, he plays the falling animation. How would i make it so that when he jumps and doesnt touch anything he plays the animation?

  void Update()
{
    if(!colliding)
    {
        animator.Play ("Fall");
    }
  }
  void OnCollisionEnter(Collision collision)
{
    colliding = true;

}
void OnCollisionExit(Collision collision)
{
    colliding = false;
}

sentences:
Test for the presence of the ouya ODK How would it be possible to test for the presence of the ODK at run time?
Currently I took this approach:

private activityDelegate delegate;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //Need to test for the presence of the ouya ODK here
    {
        delegate = new OuyaDelegate(savedInstanceState);
    }
}

But maybe there is a better way of doing this than in the main activity?

sentences:
How to create a material that blends textures in Blender to Unity workflow I'm new to Blender and Unity and trying to figure out the best way to create a material that will use either vertex colors or a texture map to interpolate between other textures on a single mesh.  This is the sort of effect you might use when you want to have a big grassy terrain mesh with a dirt path running down the middle of it and patches of rock here and there - and instead of modeling each of those as separate pieces, you create a single shader that takes a grass, dirt and rock texture map and uses a fourth blending map to decide which to sample from.

I come from a Maya background which provides an HLSL material shader that makes this straight forward.  It's not as clear to me how to do this in Blender, and in particular the best way to set it up so that it imports into Unity cleanly.  I suspect that setting up the shader using Blender's cycles shading network won't create anything Unity can recognize.  Blender also has the Open Shading language, but again I'm unsure how well this will work with Unity.

I could also bake all my textures, but this strikes me as wasteful of memory and bandwidth.

I have experience with both HLSL and GLSL.  Is trying to do this with custom shaders the best way to do about things?  What's the best way to set things up so that both Blender and Unity are happy?

sentences:
Why doesn't light continuous on my model? I created a basic textured cube model with Blender to practice modeling, and then I imported it into Unity. After I put up some lighting it looks pretty ugly. The light is not continuous on a row of textured cubes:

What is more odd, the light on the blocks that makes up the floor is continuous. What am I doing wrong?

This is what it looks like without textures:

If I did not know that these are perfect cubes, I'd say there is a slight curve on surface. I also tried lightening the texture but it also didn't help:

I just simply exported the model from Blender and did not set up any normals or things like that. However, I also did not do anything special with the floor brick model.

Checked the normals and they seem to point to the right direction.

Also I don't really see the difference between the two models.
On the textures panel I also set the projection to flat:

I checked the different panels in Blender and the only normal-related option on the "Object Data" panel is this "Auto Smooth" and it is turned off by default:

sentences:
Unity remote security vulnerablity risk identified. Is there a patch for beta versions? https://unity3d.com/security?utm_campaign=other_emea_announcement_2017-08-18-EMEA-Security-Notification&utm_content=2017-08-17-Global-Editor-Security-Notification&utm_medium=email&utm_source=Eloqua

Ok So I got an email with the attached link stating there is vulnerablity been identified and I need to patch Unity. However I had several crashing errors and other errors since I updated to 2017.1 and so I'm currently using the beta b6 version.

On the link, i didnt see a mention of a patch. Am I supposed to use the 2017 patch? Or is there not a patch for this ? (If thats the case, should I uninstall the beta , or just not use it? Or is it safe to use?)

SIDE NOTE: Is this WHY I keep getting the error saying : Failed to connect , you longer own this project, check your network connections ... etc . Im worried I had already been hacked maybe?

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:
Noticeable quality loss on texture captured using Graphics.Blit vs Shader output directly to a mesh I'm currently using a GPU shader to generate a texture. I want to be able to capture the output of this out I'm using Graphics.Blit to output the shaders result to a RenderTexture(GPU Memory) and then using Texture2D.ReadPixels(System Memory) to grab the data from the RenderTexture.

So far I've got it almost perfect, unfortunately, I'm noticing a significant difference in quality between a plane that uses the shader output directly and a plane that uses the Texture2D returned from my method and applied to the shared material.

The process of my static method is as follows:

Check if the static material variable is set. If not, create a new
instance using the shader and assign it to, the static material
variable, otherwise reuse the existing one.
Create a RenderTexture that uses the same width and height scale as
the plane (128x128) using RenderTexture.GetTemporary() which uses
ARGB32, Linear colorspace and 0 depth buffer.
Set the material keywords and properties based on method input. Call
Graphics.Blit() with null, RenderTexture(from 2) and material (from
1). Create a new Texture2D with the same dimensions as the render texture, ARGB32 and using linear colour space.
Called GetPixels() on the above Texture2D with parameters, of a new
Rect of (0,0) and render texture dimensions and 0 for offsets.
Call Apply() on the Texture2D and return it. I then use a simple
editor script for the class that adds a button to call the above
static function and then apply the output to the material of the
object the script is on.

I don't know what's causing the quality loss, I've added a screenshot of what I'm currently getting below. The left plane is steps detailed above and the right plane is with the shader applied directly to a plane. Both use the same shader properties and keywords.

I don't normally post questions but I've tried everything I can think of to get the quality of texture to match the shader output. I'm wondering if I'm misunderstanding something about how the shader works or if it's a formatting issue. Any ideas are appreciated, thanks.

sentences:
Efficient way to render tilemap I have set up a tilemap system, and am rendering it in a way that lets me pan through the map using a camera offset. However, I have discovered it is incredibly inefficient, but am unsure of how  I can increase efficiency.

Here is my current rendering code:

float lastCamOffSetX = -1, lastCamOffSetY = -1;

public override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);
    spriteBatch.Begin();

    int count = 0;

    int startCol = (int)camOffsetX/world.TileWidth;
    int startRow = (int)camOffsetY/world.TileHeight;
    int endCol = (int)(startCol + viewPortWidth - (camOffsetX/world.TileWidth));
    int endRow = (int)(startRow + viewPortHeight - (camOffsetY/world.TileHeight));

    if (startCol < 0) startCol = 0;
    if (startRow < 0) startRow = 0;

    if (endCol > world.Width) endCol = world.Width;
    if (endRow > world.Height) endRow = world.Height;

    for (int x = startCol; x < endCol; x++)
    {
        for (int y = startRow; y < endRow; y++)
        {
            int screenPosX = (int)((x * world.TileWidth) - (camOffsetX));
            int screenPosY = (int)((y * world.TileHeight) - (camOffsetY));

            Tile tile = world.Data[x, y];

            if (screenPosX >= -1 * world.TileWidth
                && screenPosX <= (viewPortWidth + 1) * world.TileWidth
                && screenPosY >= -1 * world.TileHeight
                && screenPosY <= (viewPortHeight + 1) * world.TileHeight)
            {
                Color color
                    = (tile.TileType == TileType.Land ? Color.Green : Color.Blue);

                DrawRectangle(spriteBatch, new Rectangle(screenPosX,
                    screenPosY, world.TileWidth, world.TileHeight), color);

                count++;
            }
        }
    }

    //Debug.WriteLine(count + " - " + (endCol-startCol)*(endRow-startRow));

    spriteBatch.End();

    lastCamOffSetX = camOffsetX;
    lastCamOffSetY = camOffsetY;
}

private void DrawRectangle(SpriteBatch spriteBatch, Rectangle coords, Color color)
{
    var rect = new Texture2D(this.GraphicsDevice, 1, 1);
    rect.SetData(new[] { color });
    spriteBatch.Draw(rect, coords, color);
}

Currently, I am only drawing tiles which are inside the screen/camera region. How can I improve the efficiency of my script?

sentences: how to detect if an object is hit by a certain raycast in it's own code I have been working on a sandbox game in Unity, and I am wanting to use a raycast on the cursor, but I am needing for the blocks themmselves to detect whether the cursor's raycast is hitting. I am needing the code in javaScript. Thanks in advance!!!

sentences:
Unity - PoolingSystem failing to instantiate I am wanting to spawn monsters into my scene in Unity. I was told to use a Pooling System, so I got the free one Unity offers in the Asset store. I have followed the little documentation that there is, and am encountering an error. I do not know if I am just missing something but I am getting an object reference not set error.

NullReferenceException: Object reference not set to an instance of an object
PoolingSystem.InstantiateAPS (System.String itemType) (at Assets/Advanced Pooling     System/PoolingSystem.cs:104)
MobSpawner.Start () (at Assets/_Scripts/MobSpawner.cs:16)

It throws this on the following code:

private PoolingSystem poolingSystem;

// Use this for initialization
void Start () {
    poolingSystem = PoolingSystem.Instance;

    poolingSystem.InstantiateAPS("Resources/EnemyPrefabs/Skeleton");
}

Could someone please guide me in the right direction or tell me what is wrong here?

sentences:
Why does the order of Farseer collision categories affect collisions? I've discovered a bizarre issue with the Farseer Physics Engine that I can't figure out. I have two Farseer bodies that I'd like to only collide with each other. To that end, I have the following code.

body1.CollisionCategories = Category.Cat1;
body1.CollidesWith = Category.Cat2;

body2.CollisionCategories = Category.Cat2;
body2.CollidesWith = Category.Cat1;

Which works fine. However, if I switch the categories around (shown below), the bodies no longer collide.

body1.CollisionCategories = Category.Cat2;
body1.CollidesWith = Category.Cat1;

body2.CollisionCategories = Category.Cat1;
body2.CollidesWith = Category.Cat2;

Some additional notes that might be relevant:

body1 is static, while body2 is dynamic.
body1 is created before body2 (although I switched the order and nothing changed).

Does anyone know why this happens? Based on my understanding of how Farseer uses collision categories (i.e. as masks using bitwise operations), the order shouldn't matter. Is it something silly I'm missing?

Thank you.

sentences: What exactly is the difference between Unreal Development Kit and Uunreal Engine 4? I want to start learning game development and I would obviously come across this tool. So every where I went people mentioned Unreal Engine 4 to be a viable choice, I've tried a bit of Unity and now I want to try Unreal. Only issue I came across UDK and UE4, I downloaded UDK which turns out to be different from tutorials and I can't seem to find any info on that and besides I could only run the software once because after the first time it starts a game, I re-installed UDK I still get the issue, but anyways that's a different topic, what I want to know is whether UDK and UE4 are different and if they are, where do i get UE4, becauuse when I down UE4 (from - https://www.unrealengine.com/dashboard), it downloads a game launcher and no development tool. In case they are same, why is my version of UDK different fr

sentences: colliding 2 moving and rotating sprites in xna 2d I recently started making a game in windows phone XNA, I have a rocket in the middle that I can rotate and has a thrust to speed up in the direction it is facing and meteors coming out. The point is to survive as long as you can and avoid collision with the meteors. I can't manage to implement the collision between two moving and rotating sprites which are the rocket and a random meteor. I've seen rectangular collision which to me appears bad but maybe I am coding it a bit wrong and the pixel collision is way complicated :/ any help would be appreciated, thanks in advance :)

sentences:
How can I refactor an enum so that it is still available in the inspector? I am trying to use an enum so that it is available in the inspector. This code works:

public ArmorTypeEnum ArmorType;
public enum ArmorTypeEnum { Light, Medium, Heavy };

How can refactor it into a single line?

How can I make ArmorTypeEnum private while keeping ArmorType public?

sentences:
How do you handle iPhone graphics for both high and low DPI settings? How do you guys create your game graphics for iPhone? Considering you need a retina version and a nomal one?

Do you create a big version of your image, save HD, then resize to smaller version, and save Normal?

Or do you create a vector image with say, fireworks, save HD, then resize, then save Normal?

sentences:
Cocos2D - Fill a Sprite with a pattern I have a CCSprite with a certain shape in Cocos2D and I would like to fill it with a pattern, as seen here:

I've seen a lot of examples where they fill a rectangle with a pattern, or even a dynamically-created polygon, but not another CCSprite. Is it possible to do so?
Thanks!

sentences:
Drop in quality of rendering of texture Platform: Android OpenGL ES 2.0

I'm drawing a texture on to a square using OpenGL ES2.0.
The texture scrolls infinitely in vertical direction.

The rendering quality drops very rapidly after a few frames and the texture quality is deteriorated.

Screenshot #1

Screenshot #2

How to correct this issue?

sentences:
Keystone Correction using 3D-Points of Kinect With XNA, I am displaying a simple rectangle which is projected onto the floor. The projector can be placed at an arbitrary position. Obviously, the projected rectangle gets distorted according to the projectors position and angle. A Kinect scans the floor looking for the four corners.
Now my goal is to transform the original rectangle such that the projection is no longer distorted by basically pre-warping the rectangle.

My first approach was to do everything in 2D: First compute a perspective transformation (using OpenCV's warpPerspective()) from the scanned points to the internal rectangle's points und apply the inverse to the rectangle. This seemed to work but was too slow as it couldn't be rendered on the GPU.

The second approach was to do everything in 3D in order to use XNA's rendering features. First, I would display a plane, scan its corners with Kinect and map the received 3D-Points to the original plane. Theoretically, I could apply the inverse of the perspective transformation to the plane, as I did in the 2D-approach. However, since XNA works with a view and projection matrix, I can't just call a function such as warpPerspective() and get the desired result. I would need to compute the new parameters for the camera's view and projection matrix.

Question: Is it possible to compute these parameters and split them into two matrices (view and projection)? If not, is there another approach I could use?

sentences:
Rotation of a ball moving on a surface I have a ball that moves along a platform. The ball is characterized as a sphere that has a radius and a position. The platform basically is a rectangle consisting of two vertex triangles. Its class also stores the normal of the platform.

While moving the ball and applying the physics of gravity doesn't pose a problem, I just can't get the sphere to rotate correctly. To represent the rotation(s) I'm using Qt's QQuaternion class.

Here's my current rotation code:

QVector3D right = QVector3D::crossProduct(tile->getSurfaceNormal(), step).normalized();
QVector3D forward = QVector3D::crossProduct(right, tile->getSurfaceNormal()).normalized();

float radian = QVector3D::dotProduct((ball - position), forward) / radius;
angularRate = ((radian / interval) * 180.0f / M_PI) * right;

QQuaternion rotation(angularRate.length() * interval, angularRate);
orientation = rotation * orientation;

The orientation quaternion is initialized like this:

orientation = QQuaternion(0.0f, QVector3D(0.0f, 0.0f, 1.0f));

When drawing the ball I update the model matrix (QMatrix4x4) like this:

    modelMatrix.setToIdentity();
    modelMatrix.translate(position.x(), position.y(), position.z());
    modelMatrix.rotate(orientation);
    modelMatrix.scale(radius);

What I noticed when debugging is that the final model matrix gets NAN values in the first three columns. Is there any physical flaw in my calculation or could it have to do with the model matrix itself?

If that's important, here's the full code for updating the ball's properties:

void Ball::update(float interval) {
    collision = false;

    // Calculate new velocity
    velocity += (MOVE_FORCE / mass * interval) * pushDirection;
    velocity.setY(velocity.y() - (GRAVITY * interval));

    /* Collision detection */
    QVector3D normal(0.0f, 0.0f, 0.0f);
    QVector3D step = interval * velocity;
    QVector3D ball = position + step;

    // Check all tiles for collision with ball
    for (unsigned int i = 0; i < tiles->length(); i++) {
        Tile *tile = tiles->at(i);
        QVector<QVector3D> mainVertices = tile->getVertices();

        QVector3D a1 = VectorMath::closestPointOnTriangle(ball, mainVertices[0], mainVertices[1], mainVertices[2]);
        QVector3D a2 = VectorMath::closestPointOnTriangle(ball, mainVertices[2], mainVertices[3], mainVertices[0]);

        float d1 = (ball - a1).length();
        float d2 = (ball - a2).length();

        QVector3D a = (d1 <= d2) ? a1 : a2;
        QVector3D aN = a - tile->getAdjustedSurfaceNormal();

        float aBallLength = (a - ball).length();
        float aNormalBallLength = (aN - ball).length();

        if (aBallLength <= radius || aNormalBallLength <= radius) {
            QVector3D distance = (aBallLength <= aNormalBallLength) ? a - ball : aN - ball;
            float l = distance.length();

            QVector3D move = -((radius - l) / l) * distance;

            // Rotation
            QVector3D right = QVector3D::crossProduct(tile->getSurfaceNormal(), step).normalized();
            QVector3D forward = QVector3D::crossProduct(right, tile->getSurfaceNormal()).normalized();

            float radian = QVector3D::dotProduct((ball - position), forward) / radius;
            angularRate = ((radian / interval) * 180.0f / M_PI) * right;

            ball += move;
            normal += move;

            collision = true;
        }
    }

    // Set new ball position
    position = ball;

    normal.normalize();

    // Applying rebound
    if (collision) {
        float velocityNormal = QVector3D::dotProduct(velocity, normal);
        QVector3D rebound = (-(1 + ELASTICITY) * velocityNormal) * normal;

        velocity += rebound;
    }

    // Damping
    velocity *= DAMPING;

    QQuaternion rotation(angularRate.length() * interval, angularRate);
    orientation = orientation * rotation;

    if (position.y() < -10.0f) {
        reset();
    }
}

sentences:
Color mapping of difference I have two arrays A and B. I want to do color mapping of their difference A - B. So far, I am doing this:

1) calculate d = A - B
2) find min / max in d
3) linear mapping of d from (min, max) to (0, 1)
4) convert (0, 1) to color

The problem is, that sometimes, there are noise values in my data. For example, several values in B are too large (like 100 times bigger than the rest) and it leads to enormous difference and increased min or max. After mapping to (0, 1) all other values are "wiped". How can I solve this?

sentences:
Bullet holes on curved surfaces and corners So right now I am making an FPS game where the gun creates bullet holes (plane with texture) on impact, but there is a problem with that, if I shoot at the edge the plane will stick out and also bullet holes will not look proper when I shoot at a curved surface. I know there's at least 2 ways one is shaders and another mesh manipulation, but I could not find any tutorials on how to do it and never understood neither of them. Is anyone able to explain in detail exactly how I would achieve the effect?
Thanks in advance.

sentences: Can project.json jsList accept folder names? Using cocos2d for the web/js, it seems every script file must be explicitly added to project.json. Is there a way to give it a path instead, and it will load all scripts in the folder (and sub-folders too)?

sentences:
set zfar/znear in openGL using shaders (QT env) I have a QT canvas and I'm using shaders to build my scence.
I've set the camera image plane at some position, and would like to view object from the image plane to infinity. How do I set the zfar and znear values?

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:
In a casual top-down racing game, should collisions affect the car's engine? Is there a way to deter players from colliding with obstacles in a top-down casual racer which keeping the game fun and lighthearted and yet make player's skill matter?

Should collisions affect car engine performance in a casual racing game? If so, in what way could it be done that keeps it fun?

Please use references (to other games) and examples in your answers.

sentences:
WebSocketSharp For Unity I have integrated WebSocketSharp with Unity 2018.4.14f1 and it works well with Android and IOS. I wanted to know that most of the other socket.io plugins for unity have a wrapper of Class Packet over the top which binds and sends packetID, EventType along with Data.

My question is, do we need to write such a wrapper for WebSocketSharp also in Unity?

sentences:
What language or platform is used to develop apps for Google+? Does anyone know what language or platform is used to develop apps for Google+?

I'm hoping Python, but I know google has a lot of other mediums they could use for this. I'm fine with hearsay as I know the game portion of google+ is pretty new.

sentences:
How can I design lots of different attack types that can be combined? I'm making a top down 2D game and I want to have a lot of different attack types.  I'd like to make the attacks very flexible and combine-able the way The Binding of Isaac works.  Here's a list of all the collectibles in the game.  To find a good example, lets look at the Spoon Bender item.

  Spoon Bender gives Isaac the ability to shoot homing tears.

If you look at the "synergies" section, you'll see it can be combined with other collectibles for interesting yet intuitive effects.  For example, if it combines with The Inner Eye, it "Will enable Isaac to fire multiple homing shots at once".  This makes sense, because The Inner Eye

  Gives Isaac a triple shot

What's a good architecture to design things like this?  Here's a brute force solution:

if not spoon bender and not the inner eye then ...
if spoon bender and not the inner eye then ...
if not spoon bender and the inner eye then ...
if spoon bender and the inner eye then ...

But that will get out of hand very fast.  What's a better way to design a system like this?

sentences:
How to use the unreal "automation spec" with the "automation driver" and latent actions? I would like to be able to create an automated test for Unreal that will load a specific map/level and then use the automation driver, which as I understand it, is a way of faking user input, to do things on that level.
My goal is simply to load my "main menu" level and then exit out of it.
My problem is this:
The documentation shows you how to use the automation driver with the automation spec style of automated test. But none of the automation spec tests in the UE4 source do anything with assets (or anything resembling a latent action, as with the other style of tests). Most of the automation spec tests are more akin to unit tests that have no dependency on data, or AutomationDriver.spec.cpp, which has its own hard coded test UI made using SAutomationDriverSpecSuite
There seem to be no examples at all for using the automation driver with the "simple" or "complex" tests (IMPLEMENT_SIMPLE_AUTOMATION_TEST / IMPLEMENT_COMPLEX_AUTOMATION_TEST), and the automation driver documentation just states that it can be pretty tricky unless you're using it in conjunction with an automation spec

sentences:
Sprite character/item less than tile size I am starting to work on a 2d top down tile-map game for fun and learning purposes. I have read some great answers here re tile-map size vs character sprite size, pixel density, ppu, screen resolution etc.

A standard route is to set a constant PPU and do characters as 2 tiles (vertically usually). We went with 32x32 pixels for the tile and 32x64 for the character.

Unfortunately, our artist didn't draw the character to fill out that space on the extremes (the feet and head do not touch the vertical edges and there is also space between the character and the horizontal edges) and when Unity slices the sprite-sheet we get smaller characters of 28x53.

I imagine this is a problem for keeping the consistency I outlined above with the tile size.

Is this a problem? If so, are the solutions to this to either change the tile size to 28x28 or ensure that the sprite design actually fills the tile space (that is, touching edges of the 32x64 area)? Must one draw items as always filling out the full tile size or can one make, say potions, in a 32x32 tile but only take up say 12x16?

sentences:
What does "Poser-like" mean? The Wavefront OBJ exporter of 3DSMax says it can flip YZ axis. Claiming this is "Poser-like". What does this mean?

And what is the exact transformation if we decide to flip?
Is it simply this?

x => x
y => -z
z => y

UPDATE: related matrix transformation

1  0  0
0  0 -1
0  1  0

sentences:
Multiple concurrent Tweens I'd like to be able to direct a game object to move to a new target position over a certain amount of time. There are lots of different easing functions available, but for now let's say I'm just planning to use a standard quadratic ease-in ease-out function and also a quadratic ease-out function.

For example

Math.easeInOutQuad = function (t, b, c, d) {
    t /= d/2;
    if (t < 1) return c/2*t*t + b;
    t--;
    return -c/2 * (t*(t-2) - 1) + b;
};

Now suppose while it is still in the process of moving to that target and I want to give it a new target. Rather than have it instantly change directions with a zero starting velocity, I'd like a smooth transition.

How is this done mathematically and programmatically?

I want to avoid keeping a dynamic array of tween commands for every parameter of each game object. (I want to tween all sorts of parameters besides position.) that could get really heavy and bloated. But that's the only thing that comes to mind that might work... Keeping an array of active tweens and averaging all of them.

Maybe some easing functions lend themselves better toward being interrupted? Or is there a way to recalculate the four inputs to the ease function when a new target is set, such that the same function can continue to be used once per frame without a jarring speed/direction change, and ending at the second target instead?

sentences:
Zune same features as WP7? (gesture, accelerometer) We don't have zune HD in Canada (yet) just wondering if it has the same programmable features as WP7? Like gestures and accelerometer.

Basically if I am just making a game, with screen controls (thumbsticks on the screen) is this an easy port to zune?

Thanks!

sentences:
Collision in different layer I have a game object called gameObject1 on the screen. It holds an image called red. When I drag an image called  "animal" on  gameObject1 the collision happens correctly and destroys the "animal" in the same layer. Then I increment the score, but when I drag an image called  "animal" on  gameObject2 I want to decrement my score (with out collision). I know the collision on a different is not happening.

 void OnCollisionEnter2D(Collision2D col)
    {

            if(Input.GetMouseButtonUp(0))
            {
        if (col.gameObject.name == "Semi arid" )
        {
            //obj1.rigidbody.isKinematic = false;
                scoreCalculate.currentScore+=10 ;

                Destroy(gameObject);
                //Debug.Log ("Scored1............"+scoreCalculate.currentScore);
                Instantiate(obj1, ObjectSpawnPosition1, Quaternion.identity);
                Instantiate(green, ObjectSpawnPosition1, Quaternion.identity);
                obj1.renderer.enabled = true;
                green.renderer.enabled = true;}

sentences:
how can you build with libTcod on OsX? I've had problems building on libtcod on OsX but i'm not the only one (see http://doryen.eptalys.net/forum/index.php?topic=621.0) but the beautiful RL Brogue uses Tcod and even builds on a Mac (https://sites.google.com/site/broguegame/).

anyone else get to developing on OsX with libtcod?  hopefully with Make, not XCode tho...

sentences:
Overriding all object inspectors in Unity How can this be done? I want to add a single label to every component( including non-misbehavior ones ) in the inspector. I've tried:

[CustomEditor( typeof( Object ) )]

And:

[CustomEditor( typeof( Component ) )]

This seems to work for all components that don't seem to have a custom editor already( like BoxCollider, and Transform ). It seems if a component has a custom editor already, it ignores the one I've defined. Even if I change the attribute to this:

[CustomEditor( typeof( Transform ) )]

There is still no change to the Transform inspector. How can I define my own custom editor for these components?

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:
get tetrahedron centroid velocity if vertex velocities known If i have a tetrahedron and i know the velocities of the 4 vertices, how can I find the velocity of the Centroid?

I know how to get the result if i know the velocity of the Centroid (i can use Barycentric coordinates to find the vertex velocities).

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:
HLSL equivilant to "Object" data from "Texture Coordinate" node in Blender I mocked up a shader how I wanted it with the node editor in Blender. Now I'm trying to write it in HLSL. In Blender there is a node group called "Texture Coordinate". If I use the "uv" node from the group it behaves like a normal unlit frag shader but if I use the "object" node to give coordinates to the texture, it ignores the uv data and just maps the texture like an image overlayed onto the object.

This is actually the effect I want. However, I can't find a way to replicate this in HLSL. As far as I can see I can use TEXCOORD0 and POSITION as texture coordinates to produce uv mapping and world mapping respectively for a texture onto an object. Maybe what I want is object mapping?

And if it matters I'm using a generated texture

sentences: How to implement a network proximity checker in Unity using LLAPI? I'm trying to implement a network proximity checker using my own functions in Unity, using LLAPI. How can I implemnet a network proximity checker, with similar functionalities than the ones in the HLAPI proximity checker?

sentences:
How to get last 20 banned Steam IDs I am working on a cheat analysis system using data from Steam. From this page, we can get the last 20 checked Steam IDs. Is there a way to get the last 20 banned Steam IDs?
VacList has a section with the last banned accounts, but I don't know how to extract the data. A solution like that provided by vacbanned.com would be much better.

sentences:
Animations not working using scene2d and actor class in LibGDX I have a problem making a simple animation using the Actor class.

public class fondoanima extends Actor {

protected TextureRegion currentFrame;
protected TextureRegion[] walkFrames;
protected Animation walkAnimation, idleAnimation, currentAnimation;
private Texture texture;
float stateTime;

public fondoanima() {

    texture = new Texture(Gdx.files.internal("image.png"));
    TextureRegion[][] tmp = TextureRegion.split(texture, texture.getWidth()/5, texture.getHeight() / 1);

    walkFrames = new TextureRegion[5];
    for (int j = 0; j < 5; j++) {
        walkFrames[j] = tmp[0][j];
    }

    walkAnimation = new Animation(0.4f, walkFrames);
    currentAnimation = walkAnimation;

    stateTime = 0f;

    }

@Override
public void draw(Batch batch, float parentAlpha) {
    // TODO Auto-generated method stub
    super.draw(batch, parentAlpha);

    Color col = getColor();
    batch.setColor(col.r, col.g, col.b, col.a*parentAlpha);
        batch.draw(currentFrame, 10, 10);

}

@Override
public void act(float delta) {
    // TODO Auto-generated method stub
    super.act(delta);

         stateTime += Gdx.graphics.getDeltaTime();
        currentFrame = currentAnimation.getKeyFrame(stateTime, true);
}

public void dispose(){}

I have been guided by different examples and the wiki, But I get not make it work. It is an animation that will be as the background. (image.png=>1600x350=>5 images are linked horizontally). Thanks.

Solution:
initialize currentFrame = tmp[0][0];

sentences:
How to Cease the Ragdoll Wiggle Dance When I instantiate a ragdoll object, it collapses nicely, but the movement never stops. It wiggles continuously. I'm using CharacterJoint components.
None of the colliders (box and capsule) intersect. They are all spaced by at least a small amount.
I tried playing with angular drag of the colliders, but that seems not to work. There do not seem to be any values in the CharacterJoint that affect this. But I'm probably wrong.
How can I get the physics to stop "wiggling" after a certain threshold?

sentences: Manually remove inactive CCParticleSystem from scene? When using particle systems that have a lifetime, with CCParticleSystem and its derived classes, should I manually remove the finished systems from their parent nodes once the particle animations are complete? Or this is done automatically? I don't want to leave dead particle systems in my scene, for obvious reasons.

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:
Generating circular bounding volume / AABB for bone animated object I have the animated bounding boxes for the individual bones of an object which comes from a pre-computation of the bone's bounding boxes multiplied with the bone matrix. In this question I'm referring to the surrounding aka overall BB for the model. I get it by looping through the precomputed bounding boxes of the bones.

I'm able to get an OBB but not an AABB or circular volume because I can't get into the correct "space" for the center of the volume. I thought that getting an AABB would be very easy, but since I have the min/max points in bone space (?) I need to do some operation to disable rotation. All I can get is OBB :(

I figure that the aabbV4 vector is in "bone space". So, I have to take the inverse of that space somehow, but since I have the combined value of each bone, I need the AABB / circular volumes to follow tutorials on collision detection and not just OBB that I have now.

So, each object has multiple bones which have a bounding box which animate each frame according to a bone matrix. Then, the mvpGet() function creates the MVP matrix which moves / rotates / scales the whole thing.

I render the OBB / surrounding volume of the bones like this:

for (auto &i : myAbj.allObj)
{
    if (i->bb->val_b && i->anim->val_b)
    {
        i->aabbV4.clear();

        for (auto &j : i->bbSkelAll)
        {
            for (auto &k : i->aiGbones)
            {
                if (k.name == j.name)
                {
                    i->obbMVP = glm::transpose(k.animatedXform) * j.obbMVP; // precomputed obbMVP

                    //AABB - STEP 1 - GATHER / STORE
                    glm::vec4 bbSkelXformMin = glm::transpose(k.animatedXform) * glm::vec4(j.min, 1.f);
                    glm::vec4 bbSkelXformMax = glm::transpose(k.animatedXform) * glm::vec4(j.max, 1.f);
                    i->aabbV4.push_back(bbSkelXformMin);
                    i->aabbV4.push_back(bbSkelXformMax);

                    break;
                }
            }

            i->mvpGet();
            i->render();
        }
    }
}

 //AABB - STEP 2 - MIN / MAX
for (auto &i : myAbj.allObj)
{
    if (i->bb->val_b && i->anim->val_b)
    {
        glm::vec4 aabbMin = (i->aabbV4.empty()) ? glm::vec4(0.f) : i->aabbV4[0];
        glm::vec4 aabbMax = (i->aabbV4.empty()) ? glm::vec4(0.f) : i->aabbV4[0];

        for (uint j = 0; j < i->aabbV4.size(); ++j)
        {
            aabbMin = glm::min(i->aabbV4[j], aabbMin);
            aabbMax = glm::max(i->aabbV4[j], aabbMax);
        }

        glm::vec3 aabbSize = aabbMax - aabbMin;
        glm::vec3 aabbCenter = .5f * (aabbMin + aabbMax);
        i->aabbMVP = glm::translate(glm::mat4(), aabbCenter) * glm::scale(glm::mat4(), aabbSize);

        i->aabbTgl = 1;
        i->mvpGet();
        i->render();
        i->aabbTgl = 0;

        cout << "aabbCenter = " << glm::to_string(aabbCenter) << endl;
    }
}

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

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

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

sentences:
explaining collision check code I came across the following code in a game book but I can't get it, does it check if a point (left, top) in a rectangle?

bool CheckCollision(float left, float top,  float SpriteX, float SpriteWidth, float SpriteY, float SpriteHeight)
{
    return !((left >SpriteX + SpriteWidth) ||
            (top > SpriteY + SpriteHeight) ||
            (SpriteX > left + SpriteWidth) ||
            (SpriteY> top +SpriteHeight));

}

sentences:
Understanding pixel art in Unity 2d I am struggling to understand the basics behind pixel art in Unity.

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

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

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

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

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

sentences: Unity ceiling light issues I'm trying to get back into Unity and I've been playing around with lighting. I modelled a simple lightbulb in Maya and have been trying to create a hanging ceiling light but I'm struggling to get it to work. No matter where I place the point light, it appears to originate from the ceiling and the bulb remains dark. Ideally, I would like the light to originate from inside the bulb and spread across most of the room, while also making the bulb glow. I'm sure this is a simple task but I would really appreciate any tips in the right direction. Thanks

sentences:
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 can I draw a texture line by line I wish to draw a texture to the screen line by line (horizontal lines).
Can I do this in xna?

At first I wish to just start at the top of the texture, draw one single horizontal line of pixels and x no of milliseconds later draw the next line and so on until the texture is fully drawn.
In the future I may want to draw these horizontal lines in any order.

Any ideas how best to achieve this?

sentences:
Libgdx FPS drop drawing alot of text i'm drawing text above monster head and it's fine. But when there is to many monsters and their name gets render every second cause fps go down. When i disable the font drawing, then the fps is fine. Any idéa how to tackle this perfomence issue?

Thanks.

sentences:
How many rendering passes is "normal"? I've been implementing John Chapman's method for SSAO (an excellent tutorial by the way), and I've completed it all minus the final part: blurring it. I believe this is what the entire process should be like:

First pass: render normals and depth to textures. (plus diffuse/specular albedo and such)
Second pass: render scene without ambient occlusion to texture, render ambient occlusion to another texture.
Third pass: blur the AO texture, multiply with scene texture for end result.

Then, if I wanted to implement bloom and depth of field, would I need yet another pass (or two)? Do modern games really go through a ton of rendering passes to add effects, or is there something obvious I'm missing? Some way to drop the number of passes needed?

sentences:
CCSpriteFrameCache: Frame '%s' not found I have just started using the Cocos2D library for Android. I am trying to make a walking bear animation.

For that I am using a CCSpriteFrameCache, but I'm getting a "frame not found" error in the log.

I have added an AnimBear.plist file and an AnimBear.png file (combined image of the various movements of the bear) to the assets folder.

My Java code is as per below :

CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFrames("AnimBear.plist");
CCSpriteSheet spriteSheet = CCSpriteSheet.spriteSheet("AnimBear.png");

scene.addChild(spriteSheet);

ArrayList<CCSpriteFrame> walkSprites = new ArrayList<CCSpriteFrame>();

for (int i = 1; i <= 8; ++i)
{
    walkSprites.add(CCSpriteFrameCache.sharedSpriteFrameCache().getSpriteFrame("bear" + i + ".png"));
    System.out.println("bear image is added");
}

CCAnimation walkAnimation = CCAnimation.animation("bear", 0.1f, walkSprites);

bear = CCSprite.sprite(walkSprites.get(0));

this.walkAction = CCRepeatForever.action(CCAnimate.action(walkAnimation, false));

bear.runAction(walkAction);

Now here are the errors I get:

  walkSprites.get(0) line throws a Null Pointer Exception.
  CCSpriteFrameCache.sharedSpriteFrameCache().getSpriteFrame("bear" + i + ".png") line prints "CCSpriteFrameCache: Frame '%s' not found" in the logcat

Can anybody help me please, what am I doing wrong?

Thanks in advance.

sentences:
Glow effect shader for mesh generated at runtime I'm using the leap motion-paint module and i would like the ribbons that are generated at runtime to have a glow effect, I tried editing the existing shader by adding a glow property but the colors did not change. I'm not experienced with shaders so any help would be much appreciated.

EDIT: I tried adding post-processing effects for bloom & glows, all the objects have a glow effect except the ones i'm generating at runtime..

 Shader "LeapMotion/TubeShader" {

Properties{
    _Color("Tint", Color) = (1,1,1,1)
    _Glossiness("Smoothness", Range(0,1)) = 0.5
    _Metallic("Metallic", Range(0,1)) = 0.0
     _Glow("Intensity", Range(0, 3)) = 1
  }
  SubShader{
    Tags { "RenderType" = "Opaque" "Glowable"="True"}
    LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0

struct Input {
  float4 color : COLOR;
};

half _Glossiness;
half _Metallic;
fixed4 _Color;
half _Glow;

void surf(Input IN, inout SurfaceOutputStandard o) {
  o.Albedo = (_Color* _Glow * IN.color).rgb * ;
  o.Metallic = _Metallic;
  o.Smoothness = _Glossiness;
}
ENDCG

}
  FallBack "Diffuse"
}

sentences:
Unity 3D - Rotate towards object with random offsets Title is a little confusing, but let me explain:

I want to make the enemies look at the player, and shoot at him, with random precision, meaning that one time the enemy will shoot a little bit to the left of the player, next time a little bit to the right of him, and sometimes exactly at him.

Currently I have this scene:

The turret rotates, and when the green direction spots the player, it shoots a bullet facing the player (the green arrow).

Now I need where the rotation is passed for the Instantiate, to have some random precision, and I don't know how to do it. Here's what I have so far

Vector3 pos = new Vector3(firingPoint.transform.position.x, firingPoint.transform.position.y, firingPoint.transform.position.z);

float playerX = playerObject.transform.position.x;
float playerY = playerObject.transform.position.y;
float playerZ = playerObject.transform.position.z;

float randomX = Random.Range(playerX - 1f, playerX + 1f);
float randomY = Random.Range(playerY - 1f, playerY + 1f);
float randomZ = Random.Range(playerZ - 1f, playerZ + 1f);

Quaternion aimPrecision = Quaternion.LookRotation(new Vector3(randomX, randomY , randomZ));

Instantiate(bulletPrefab, pos, aimPrecision);

How can I do this?

EDIT: Right now, the enemy shoots like this:

but never towards me, or backwards

sentences:
What is the state of the art in procedural character animations? I'm a programmer and I'm interested in programmatic character animation — walking or running, bipedal or many-legged: what is the state of the art today?

I heard about NaturalMotion's Euphoria system and Ubisoft's IK Rig, and they look amazing. Where can I find more info about similar algorithms?

sentences:
How to calculate a quad based on a triangle pairs shared edge Based on two given triangles, I would like to calculate a quad that can be used as a 'fat' line for the edge between the triangles.

I have googled around and while it is very easy to draw lines in OpenGL or DirectX, the problem is that you can only guarantee a thickness of 1 pixel.

To overcome this I need to generate a quad for the line.

So given the below image...

I have a set of triangles, and I want to draw a line where the red dots are.
I know the start and end vectors for this line. And all the details of the triangles

I need to create a quad so that I can define the thickness (seen as the blue arrow)

An extra complication is that the triangles may not be on the same plane.

So from the side perspective, the 'line' would need to be created with its edge growing like this. Where both black lines are the sides of two separate tringles and the shared edge is from the point and moves into the screen.

All the calculation for this will be done offline

I am hoping that just a nudge in the right direction and I will be able to hammer this out on my own. (maybe)

OR if there is another way to solve the fat line problem then let me know.
I will be rendering this using OpenGL ES 1 (without a shader)

Thanks.

sentences:
Libgdx rendering problems Have problems with rendering moving character using ShapeRenderer, it twitches while moving, and I don't understand where from comes the problem - bad game structure (do I need to override draw method from my actor,or just draw all entities in Stage's draw method) or troubles with movement logic.I'll add information if needed.

MainClass:

public class MFightGame extends Game {

@Override
public void create() {
    setScreen(new GameScreen());
}

@Override
public void render() {
    super.render();
}}

GameScreen:

public class GameScreen implements Screen {

private GameStage stage;

@Override
public void show() {
    stage = new GameStage();
}

public GameScreen() {

}

@Override
public void render(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.draw();
    stage.act(delta);
}

@Override
public void resize(int width, int height) {
    // TODO Auto-generated method stub
}

@Override
public void pause() {
    // TODO Auto-generated method stub
}

@Override
public void resume() {
    // TODO Auto-generated method stub
}

@Override
public void hide() {
    // TODO Auto-generated method stub
}

@Override
public void dispose() {
    // TODO Auto-generated method stub
}}

GameStage:

public class GameStage extends Stage {
private Creature creature;
private final float TIME_STEP = 1 / 300f;
private float accumulator = 0f;
private ShapeRenderer renderer;
private OrthographicCamera camera;

public GameStage() {
    creature = new Creature(100,100);
    addActor(creature);

    camera = new OrthographicCamera(800, 600);
    camera.position.set(camera.viewportWidth / 2f,
            camera.viewportHeight / 2f, 0);
    camera.update();
    renderer = new ShapeRenderer();
    renderer.setProjectionMatrix(camera.combined);
    Gdx.input.setInputProcessor(new InputHandler(creature));

}

@Override
public void act(float delta) {
    super.act(delta);
    accumulator += delta;
    while (accumulator >= delta) {
        accumulator -= TIME_STEP;
    }
}}

sentences:
How to deal with weapon power-creep in an RPG? Power creep is a process that sometimes occurs in games where new content slowly outstrips the power of previous alternatives. This leads to players abandoning previous options in favour of the latest and more powerful alternatives, resulting in an inevitable increase in power throughout the game.

I am developing a private RPG that has approximately 10 players. Although the scale of the game is very small, it is falling victim to power-creep. Four players have reached the current "end-game" weapon and armor set and are running out of things to accomplish in terms of collecting the most powerful items.

I have a lot of great ideas planned, but many of them involve releasing weapons that are not stronger than the current strongest. The negative of this is that the players who have already achieved something greater don't look forward to the content update, and tend to come online less often. I don't want to release a weapon that is stronger, because this releases a lot of new issues with balancing in other areas of the game.

I have a couple of ideas that could slow this issue:

Although the new weapons may hit less damage, they may perform different effects that benefit the player in different ways
Reduce the damage of all weapons, so the slot for the previously-strongest weapon opens up for a new weapon.

How do I slow/stop power-creep of weapons and armors? (This question is not about finding ways to keep players online longer).

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:
How do I create a camera? I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it.

I have read about quaternions and matrices, but I do not understand how to implement it. Particularly, it seems you need "Up", "Forward" and "Right" vectors, a Quaternion for rotations, and View and Projection matrices.

For example, an FPS camera only rotates around the World Y and the Right Axis of the camera; the 6DoF rotates always around its own axis, and the orbital is just translating for a set distance and making it look always at a fixed target point.

The concepts are there; implementing this is not trivial for me.

SharpDX seems to have has already Matrices and Quaternions implemented, but I don't know how to use them to create a camera.

Can anyone point me on what am I missing, what I got wrong?

I would really enjoy if you could give a tutorial, some piece of code, or just plain explanation of the concepts.

sentences:
How can I make a "paint" effect? I am wondering how one could implement "paint" in games. As a reference, I have two games I am specifically thinking about which are Super Mario Sunshine with its "goo" and Splatoon.

I'm wondering how I could replicate that kind of paint effect, where paint can be sprayed on to both the walls and floors of the environment, and on to objects.

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 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:
How to precisely limit fps I am having trouble making my game's main loop to run at exactly N fps. Let's say i want game to run at constant 60 fps. Here is part of my code:

int ticksPerSecond = 60;
int skipTicks = 1000 / ticksPerSecond;
int maxFrameskip = 10;

// ...

while(true)
{
    loops = 0;
    while (Environment.TickCount > nextGameTick && loops < maxFrameskip)
    {
        OnUpdate();
        nextGameTick += skipTicks;
        loops++;
    }

    Render();
}

As a result i am getting around 64 fps, not 60. Why is that and what am i doing wrong here?

sentences:
What is a simple deformer in which vertices deform linearly with control points? In my project I want to deform a complex mesh, using a simpler 'proxy' mesh.

In effect, each vertex of the proxy/collision mesh will be a control point/bone, which should deform the vertices of the main mesh attached to it depending on weight, but where the weight is not dependant on the absolute distance from the control point but rather distance relative to the other affecting control points.

The point of this is to preserve complex three dimensional features of the main mesh while using physics implementations which expect something far simpler, low resolution, single surface, etc.
Therefore, the vertices must deform linearly with their respective weighted control points (i.e. no falloff fields or all the mesh features will end up collapsed) - as if each vertex was linked to a point on the plane created by the attached control points and deformed with it.

I have tried implementing the weight computation algorithm in this paper (page 4) but it is not working as expected and I am wondering if it is really the best way to do what I want.

What is the simplest way to 'skin'* an arbitrary mesh, to another arbitrary mesh?

*By skin I mean I need an algorithm to determine the best control points for a vertex, and their weights.

sentences:
Webgl build error in unity I get an error while trying to build a game for webgl. I have created a new 3d project with only a cube in it and have not created any scripts. When I try to build and run the webgl option, these are the errors I get.

    Failed running "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"G:\webgl\Assets\..\Temp\emcc_arguments.resp"

stdout:
stderr:INFO:root:Checking JS engine ['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096'] failed. Check your config file. Details: [Error 5] Access is deniedCRITICAL:root:The JavaScript shell (['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096']) does not seem to work, check the paths in the config file
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bb] in <480b5a3bd3214ce5831f6dd8c68fdc55>:0
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <480b5a3bd3214ce5831f6dd8c68fdc55>:0
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This is what the editor log shows:

C:\Program Files\Unity\Hub\Editor\2019.3.13f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe exited after 228169 ms.
Filename: "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe"
Arguments: -E "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"G:\webgl\Assets\..\Temp\emcc_arguments.resp"
index: -1
Failed running "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" -E "C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\Emscripten\emcc" @"G:\webgl\Assets\..\Temp\emcc_arguments.resp"

stdout:
stderr:INFO:root:Checking JS engine ['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096'] failed. Check your config file. Details: [Error 5] Access is deniedCRITICAL:root:The JavaScript shell (['G:\\nodejs\\node_modules\\npm\\bin', '--stack_size=8192', '--max-old-space-size=4096']) does not seem to work, check the paths in the config file

I'm not sure how to resolve this....Can someone please help...

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:
Rendering only a part of the screen in high detail If graphics are rendered for a large viewing angle (e.g. a very large TV or a VR headset), the viewer can't actually focus on the entire image, just a part of it. (Actually, this is the case for regular sized screens as well.)

Combined with a way to track the viewer's eyes (which is mostly viable in VR I guess), you could theoretically exploit this and render the graphics away from the viewer's focus with progressively less details and resolution, gaining performance, without losing perceived quality.

Are there any techniques for this available or under development today?

sentences:
How can I mock Google Play purchases? I would like to know what best practices should I do for testing the functionality when a user buy an item/power-ups via Google Play and purchased with real money?

For example, basically, creating a simple test of purchasing and saving an item stored in the inventory during the game using a game money. (e.g. Gil from Final Fantasy series or Zenny from Tron Bonne for the PlayStation 1) I know how to make money purchase update only via game money when I'm programming in Unity3D or Eclipse w/ LibGDX library.

Now, let say I have to create a program that checks the user if actually purchase a power-up items using real money. Next, the system needs to check for online status. If connected, it will simply go to the Google Play dialog and asks the user if he/she wanted to proceed purchasing of items. If yes and the credit card balance is sufficient, then goes back to the game app and check if the boolean returns true, then item that the user is bought will be saved.

Another example is that the amount of real money will be calculated via programming and if insufficient, the user asks to add more real money value by purchasing it via Google Play. If return true, then, the real money value will be reloaded.

This concept is basically needed for game developers. However, is there a safe way to test the real money purchase test stuff without using a credit card value or something before the actual publishing of the game app in Google Play along with this feature? Is there a tutorial, start-up guide, recommendation or something for this? Please, I would like to know how will I start. Thank you.

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:
Animation "Offset" in Unity 2D animation I was playing around with Unity and its 2D Animator. When I press a Button now (to play for example the walk left Animation) it takes about 1 sec to begin the animation and same when I release the button to stop it. It's the same problem with every other animation.

Here's my Player Movement Controller:

using System.Collections;
using UnityEngine;

public class Player_Movement : MonoBehaviour {

public float speed = 10;
float old_pos;
float old_height;

void Start()
{
    old_pos = transform.position.x;
    old_height = transform.position.y;
}

void FixedUpdate()
{

    float h = Input.GetAxisRaw("Horizontal");
    float v = Input.GetAxisRaw("Vertical");

    Vector2 dir = new Vector2(h, v);
    GetComponent<Rigidbody2D>().velocity = dir.normalized * speed;

    GetComponent<Animator>().SetBool("isWalkingLeft", (h < 0));

    GetComponent<Animator>().SetBool("isWalkingRight", (h > 0));
  }
}

The problem also occurs when I switch directions and the animation should instantly switch over.

sentences:
C# XNA Is key toggled? I've got a question about toggling keys. How do You check if the key is toggled?

Here's my quick and easy code:

    public class KeyToggle
    {
        private bool isEnabled = false;
        private Keys key = Keys.None;

        public KeyToggle(Keys key)
        {
            this.key = key;
        }

        public bool IsEnabled()
        {
            if (keyboardState.IsKeyUp(key) && previousKeyboardState.IsKeyDown(key))
                isEnabled = !isEnabled;

            return isEnabled;
        }
    }

    private KeyToggle keyToggleF12 = new KeyToggle(Keys.F12);

    protected override void Update(GameTime gameTime)
    {
        if (keyToggleF12.IsEnabled())
            Method();
    }

Do You have any better idea for checking if the key is toggled?

EDIT: I didin't mean if the key is clicked (aka current up, previous down). Toggled key is like CapsLock, You press it once and it's enabled, press it once more and it's disabled. I've updated my code a little bit:

    private List<KeyToggle> keyToggleList = new List<KeyToggle>();

    protected override void Update(GameTime gameTime)
    {
        if (IsKeyToggled(Keys.F12))
            Method();
    }

    public static bool IsKeyToggled(Keys key)
    {
        if (ReferenceEquals(keyToggleList.Find(x => x.Key == key), null))
            keyToggleList.Add(new KeyToggle(key));

        return keyToggleList.Find(x => x.Key == key).IsEnabled();
    }

sentences:
Middleware to Bring 3D Meshes into OpenGL ES 2.0 Say I develop a game for mobile platform running OpenGL ES 2.0. I have done 2D part, and now I wish to import some 3D objects.

The imported 3D objects must contain the following:

Vertices positions
Normals
UVs
Texturing information
Animation information
Collision mesh
Maybe some other things...

I am aware, that I could and (maybe should) create my own file format that brings these data from 3D authoring application (3ds Max, Maya, Softimage) into the game.

However, doing so from scratch is going to be really be a lot of work. Therefore, is there any available solution/middleware, that will let me import 3d meshes into my game, ready to use?

The solution/middleware should be:

easy to use
easy to port
efficient
not consuming too much memory with unnecessary things
containing all the above mentioned features plus things I haven't considered yet

Programming language is: C++.

Currently, I'm developing under Windows 7, Visual Studio 2010, and OpenGL ES 2.0 emulator.

Later, the product will be ported to iOS and possibly Android.

sentences:
Framerate and game loop on mobile I'm searching how to manage game framerate on mobiles devices, here is my problem:

On a computer with got something like that:

void main()
{
    while(game.isRunning())
    {
        event.handle(eventInfos);
        game.update(dt);
        graphic.render();
    }
}

On a mobile device with got something like that:

void update()
{
    game.update(dt);
}

void render()
{
    game.render(dt);
}

void event()
{
    game.handle(eventInfos);
}

When I search on internet, I found something like that everytime:

-> GameLoop

-> Fix your time step

I'm using IOS (With GLKViewController) and Android (with the NDK), and I've that rendering method is call from another thread

Thanks for your help!

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:
Moving cars on a tiled map I'm writing a game which is situated on a tiled map. I have a PlayState on which there's a Board which cosists of Fields.

My Board is an isometric map of a city, where each tile is a kind of road. Depending on the type of the road, there's a different texture of a car (if we go up/ down or left/ right) + on some tiles a car will take more than one texture (because it turns).

I don't know what's the correct idea of putting a car into the game. Should a class Car be part of Field? Probably not because there are moments in which the car is on more than one field. So maybe a part of Board? But the texture of a car depends on the type of the road that it is on. What is more, I must deal with the fact that once a car is on a field, it moves in the boundaries of it - so should I insert some coordinates of a field itself?

Could someone write a pseudocode of classes Board and Field with the necessary variables? And explain how I should deal with car's movements? I'm working in Java's Libgdx if it matters.

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:
Recommended list of games to develop at the beginning? I am looking for simple games that I should develop to learn the basics of how different game mechanics work. I have read in many places that it is good to make Pong.

Is there a recommended list of basic games to try recreate when starting with game development?

sentences: How to rotate a rectangle? I can easily rotate sprites using the Draw method. However I would like to simply rotate a Rectangle (the structure) so that I can get the coordinate of the four corners of the rectangle. How can I do that?

sentences:
Implementing a Turn Radius for a Character I'm working on a 3rd person platformer in Unity where I'm attempting to capture a Mario 64 style feel. Part of the game involves attaining really fast speeds. Currently, my turning code is pretty simple, and is essentially a mapping of the left-stick onto the character.
Omitting some more complex logic (accounting for smooth acceleration & the like), the base of my movement code is:
rigidbody.AddForce(direction * speed);
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction, normal), delta);

This is really responsive and feels good, but at the high speeds the player will attain, it starts to break down. As such, I wanted to add a "turn radius" so that it feels more realistic to attempt to turn at high speeds and face some resistance.
Really, I don't want to go full on "Arthur Morgan" super belabored semicircle turns, but just provide some sense of "weight" and momentum influence to directional changes. Given how simple my current movement is, I'm not sure where to start when it comes to adding in this type of behavior.
I checked out questions like this mario one and lots of other turning related questions, but most I could find were related to the direciton the character was facing, and less about it's movement or velocity. Any input here is appreciated!

sentences:
Asset is up to date but does not have a correct hash assigned in GuidPersistentManager I have a ScriptedImporter that generates a few extra assets, this works fine except when I re-import it after version upgrade, I get the following message:

Asset with guid 'bbe94cef9d5f3464ab6ba6913e6747a2' and path '...' is up to date, but does not have a correct target hash assigned to it in the GuidPersistentManager
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

Inside that ScriptedImporter I've tried File.Delete, AssetDatabase.Refresh, AssetDatabase.ImportAsset but neither helped out, only when I delete it manually it does work.

Furthermore, that error message is quite useless as basically Unity handles it but still notifies you.

Note that the asset generated is next to the format being imported, this is because if for instance you create a texture and add it to the AssetImportContext then it becomes readonly in the Inspector and cannot be tweaked further. So basically I generate a PNG file in same folder which then has the usual TextureImporter that can be edited as will.

Question:

How to avoid incorrect GUID errors when re-importing an asset generated by a ScriptedImporter?

Alternatively, how to solve this incorrect GUID clash when overwriting an asset?

sentences:
Why won't PNGs load successfully to game from server? I'm working on a game which involves loading pictures from a server and rendering them as sprites. The images are stored as PNGs and open normally from on the server. I get no errors when downloading. And as a test I saved the images to files and they seem to save properly.
But, when I try rendering the sprites in the game, Unity doesn't understand what they are and just shows red questionmarks. The sprites load fine if I try loading them from Resouces/Assets folder.
Here's how I'm downloading the pictures:
Using UnityWebRequest, images are downloaded as Texture2D objects, converted to PNGs and then saved to a static-class called GameData.
Here's what the code for the image download looks like:
foreach (String imgName in imgNames) {

        using( UnityWebRequest imgRequest =  UnityWebRequestTexture.GetTexture(pathName+imgName)) {

           yield return imgRequest.SendWebRequest();

         if(imgRequest.isNetworkError || imgRequest.isHttpError) {
             ...
         }

          else  if(imgRequest.isDone) {
            Texture2D texture = DownloadHandlerTexture.GetContent(imgRequest);
            byte[] spriteBytes = texture.EncodeToPNG();
            File.WriteAllBytes(Application.dataPath + "/debug_sprites/"+imgName+".png" , spriteBytes );
            var rect  = new Rect(0, 0, 8, 8);
            Sprite spriteS = Sprite.Create(texture, rect, new Vector2(0.5f,0.5f));
            GameData.SetImg(imgName, spriteS);

          }
          downloadStatus.text = "Downloading file "+ ++i +" of "+(imgNames.Count+audioNames.Count);
   }

The code for where the image is saved in GameData:
public static void SetImg(string imgName, Sprite img) {

             imgDict.Add(imgName, img);

}

And here's the code where the sprites are supposed to get rendered to the game:
firstImage = GameData.GetImg(choice1.text);
//firstImage = Resources.Load<Sprite> (choice1.text);
GameObject go = GameObject.Find ("ChoiceOneTarget");
SpriteRenderer spriteR = go.GetComponent<SpriteRenderer> ();
spriteR.sprite = firstImage;

Note: I've tried downloading both with and without the extension name, but it didn't change anything.

sentences:
Organizing platformer game into classes I'm making a platformer game and I'm having some trouble wrapping my head around how to organize my classes. I'm wondering what the best way to have everything interact would be without passing parameters all over the place. I've heard of MVC, but does this apply? Should I look into it more?

Thanks in advance

sentences:
Uniforms stop working when loading multiple programs via glUseProgram() The rendering keeps happening, and the debugger shows my camera is getting its position updated properly, but for some reason the camera doesn't appear to have its position updated. I'm not sure what I'm doing wrong.

Can uniforms fail to get set when swapping between different programs/shaders?

sentences:
Spritegroups and colorkeys I have a problem using spritegroups in pygame. In my situation I have 2 spritegroups, one for humans, one for "infected". A human is represented by a blue circle:

image = pygame.Surface((32,32))
image.fill((255,255,255))
pygame.draw.circle(image,(0,0,255),(16,16),16)
image = image.convert()
image.set_colorkey((255,255,255))

An infected by a red one (same code, different color).

I update my spritegroups as follows:

 self.humans.clear(self.screen, self.bg)
 self.humans.update(time_passed)
 self.humans.draw(self.screen)

 self.infected.clear(self.screen, self.bg)
 self.infected.update(time_passed)
 self.infected.draw(self.screen)

Self.bg is defined:

self.bg = pygame.Surface((SCREEN_WIDTH, SCREEN_HEIGHT))
self.bg.fill((255,255,255))
self.bg.convert()

This all works, except that when a red circle overlaps with a blue one, you can see the white corners of the bounding box around the actual circle. Within a spritegroup it works, using the set_colorkey function. This does not happen with overlapping blue circles or overlapping red circles.

I tried adding a colorkey to self.bg but that did not work. Same for adding a colorkey to self.screen.

sentences:
Isometric - Do I need to add shade to the sprite images itself, or render shade during runtime? So I'm drawing sprites right now for my game world. It's going to be isometric, not rotatable, 2.5 Dimensional. Do I need to add in the shadow to my sprites right now (which would mean to have 5~6 variations of each sprite based on the shadow angle) or do I do that on runtime as the light source changes in the game?

Example: Say I have this drawn from a tileset.

https://imgur.com/a/LMVlD

The horizontal tiles (https://imgur.com/a/2pnK4) are reused on the top part of the wall and the bottom part of the wall. But the south side is lighter on the bottom part of the wall for reasons. I want to know if it's better to make 2 different images or make the color darker through coding. Thank you.

sentences: physics.addBody() with custom shapes in Corona SDK Does the physics.addBody() only work with Circles and Rectangles? Or is it possible to physics.addBody() on vector shapes or sprites or with masks or something?

sentences:
Best way to gain C++ working experience for a job in games (coming from C#) I am a software developer, experienced with C# (5 years experience) alongside a few other languages.

My "dream job" is working in video games as a developer.

Most jobs require knowledge of C++, which i currently don't have (except for some of the basics).

I've looked around, and most big game companies require something along 3-5 years of previous experience with C++.

My question is -- what would be a good route to get myself up to this required experience level, coming from C# ?

I've thought of some possible ways to do it:

Get more knowledge about C++ from books.
Participate in open-source projects that are written in C++.
What would be the best way to learn C++ and have working-level experience with it, in particular for the game industry?

sentences: How to get a turret to shoot at player in a shmup I'm developing a basic vertical shoot em up on the DS and am trying to get stationary turrets to shoot at the player in a shoot em up. Early on I simply had them shooting in fixed 8 directions N, S, E W, NE, NW, SE, SW, depending on the player's relative position, but I want something more specific. My attempts have been awkward at best, and my aiming algorithm is not very crude and often the turrets miss by a mile. I am looking for a simple algorithm that plots a basic straight line trajectory towards the player's xy position. Nothing fancy like predictive aiming. Does anybody know of an algorithm or an article that covers such an algorithm?

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:
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 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:
libgdx Vector.cpy question Why do people use this:

public void set(Vector2 v) {
    this.vector2 = v.cpy();
}

insted of just using:

public void set(Vector2 v) {
    this.vector2 = v;
}

What I don't know that I should know?

sentences:
How do games have low tick rates without causing input lag? For example, Minecraft. It updates the gamestate at a rate of only 20/second. And from what I've read, these multiplayer games do the same with their network communication, sending updates at that same speed. So it sounds like the entire game is, internally, running very slow (ignoring the render interpolation to not appear slow).

But what I don't understand is how player input doesn't feel laggy as a result. If player input was only being sampled 20/second, you would feel the delay. But that isn't the case in Minecraft, it is extremely responsive. I assume that means player input is being sampled as fast as possible, at renderer speed. But that means the game is gathering input way faster than it can use it. If it updates the gamestate and talks to the server 20 times in a second, but gathers 200 input samples in that same time, how does it handle that?

Is it perhaps just faking it locally, taking the latest player input and interpolating the renderer with it to appear responsive, even though that input isn't actually being used anywhere in the game?

How does it decide which particular input sample to use when it's comes time to do a gamestate/network update without losing information?

I don't understand how to resolve the conflict between having too many input samples to use, and having input feel too slow.

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 could I give a lifespan to my MMO characters? A problem I've encountered in some MMO games, is that players congregate around the endgame content, meaning that when a new player joins they are basically playing a solo game until they reach a high enough level to join the other players.

To combat that, I'm considering giving the player characters a finite lifespan. For example making it so that after X hours of gameplay, or once they reach level X, they start losing power instead of gaining it. Then they are encouraged to reincarnate, starting again from level 1 and only carrying over some small subset of their abilities.

My hope is that this will make the early game content (probably randomly generated, to keep it interesting) more useful, and more busy.

My questions is:

How could I implement this to make it appealing to the players?

sentences:
opengl offscreen rendering in linux is slow My opengl application runs at about 110 fps. The moment I add off-screen rendering, it slows down to 15 fps. I am using frame buffer objects and glReadPixels to render off-screen. I have searched on net and found that GPU memory to CPU memory data transfer is slow and vice versa is fast. I have ATI Mobility Radeon™ X2300 with 128MB video memory.
So my questions are
1) Is there is way to increase VRAM to CPU ram data transfer speed?
2) Are there any GPUs in market optimized for better read speed?

sentences:
How to set end of joint that has fixed transform? I'm implementing chains locked the door, and used Hinge joints to linked the chains like this picture:

As you can see, last chain doesn't have connected body because it is end. And when the game starts, links were broken:

How to make last chain just hang in the position like first hinge object?

Also, chains are too way swaying, is there a way to reduce it? I increased every chain's mass to 100~1000, but seems nothing changed. Give it too much mass results broken joints.

Any advice will very appreciate it!

sentences:
iOS custom memory allocator I'm about to start writing an iOS game and I'm going to use mainly C++/C for the core gameplay logic.

I really like pre-allocating everything in the game and try to avoid any dynamic allocations as much as possible. With my own C++/C code it's not a big deal. However there are some ObjC libraries which I'd like to re-use and I'm not sure how to inject my custom memory allocator to Cocoa based classes.

Is there any central 'inject point' in Cocoa where I can do that?

sentences:
Should I send the entries using a tickrate? Netcode Authoritative Server I am developing a 2D platform and shooting video game in Unity 2D with authoritative logic / physics on the server (The physics server is also developed in Unity to be able to use the box2D library on both the client and the server).
Currently I am working on the basic communication functionality between the client and the server using socket to send the client's inputs to the server and executing the physics on it. And this is where I find myself with a question that I can't solve after searching a lot on google and forums.
When should you send the client's inputs to the server? Setting a delivery tickrate or each time the user clicks on the controls?
As I have analyzed on my own, what seems more efficient at first is to send the inputs to the server each time the client presses one of the game controls. And on the other hand that the server sends the clients the status of the game (player movements, changes in physics, etc.) using a tick rate.
This is a diagram of the communication and behavior that I am developing:

As you see this operation. Should I also set a tickrate on the client?
Thank you very much.

sentences:
Why the loop is never working in the Waypoints? using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.AI;

public class Waypoints : UnityEngine.MonoBehaviour
{
    public List<GameObject> waypoints = new List<GameObject>();
    public Animator _animator;
    public int waitTimeBeforeGo;
    public int num = 0;
    public float minDist;
    public float speed;
    public bool rand = false;
    public bool go = true;
    public bool loop = false;
    public bool waitTime = false;
    public float smoothRotation;

    private bool lastPoint = false;

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        float dist = Vector3.Distance(gameObject.transform.position, waypoints[num].transform.position);

        if (waitTime == true)
        {
            StartCoroutine(WaitBeforeGo());
        }
        else
        {
            if (go)
            {
                //_animator.SetBool("Walk", true);

                if (dist > minDist && lastPoint == false)
                {
                    Move();
                }
                else
                {
                    if (!rand)
                    {
                        if (num + 1 == waypoints.Count)
                        {
                            if (loop == true)
                            {
                                num = 0;
                            }

                            lastPoint = true;
                            //_animator.SetBool("Idle", true);
                        }
                        else
                        {
                            num++;
                        }
                    }
                    else
                    {
                        num = Random.Range(0, waypoints.Count);
                    }
                }
            }
        }
    }

    public void Move()
    {
        Quaternion lookOnLook =
 Quaternion.LookRotation(waypoints[num].transform.position - transform.position);

        transform.rotation =
        Quaternion.Slerp(transform.rotation, lookOnLook, Time.deltaTime * smoothRotation);

        gameObject.transform.position += gameObject.transform.forward * speed * Time.deltaTime;
    }

    IEnumerator WaitBeforeGo()
    {
        yield return new WaitForSeconds(waitTimeBeforeGo);

        waitTime = false;
    }
}

For some reason when it's getting to this part it keep doing this part over and over again like in a endless loop and never continue :
if (num + 1 == waypoints.Count)
                            {
                                if (loop == true)
                                {
                                    num = 0;
                                }

                                lastPoint = true;

It keep doing the lines num = 0 and lastPoint = true all the time in a loop and never continue to the rest of the code.
For example there is only 1 waypoint it's moving to the waypoint but never get back it's staying at the waypoint. The loop(ping pong) is never working.

sentences: How to clear the scores? My issue is when I exit the game the lives and scores still appears in my game menu so how do I clear them after I quit the game and get back to the menu?

sentences:
Calculate UV sphere vertices (altitude) There is an fantastic answer by DMGregory here where he explains how to calculate and generate the vertices of an UV Sphere: OpenGL calculate UV sphere vertices

Based on his code, how can we change the "altitude" of each individual vertex?

To create something like this:

sentences:
Finding the Dimension of OBJ objects I am having a Three OBJ file , Cone , Sphere and Cube. How can i find the dimension of these objects , so that i can use it in my collision detection class.

i.e How can i find Radius , Length of Cube and Radius and Height of cone.
Or is there any better way for collision detection , I have Hundreds of random particle in my game which may or maynot collide with these objects.

sentences:
Animation package from Assert Store not working probably with Unity Model/Custom Model? I downloaded the animation pack from here:
https://www.assetstore.unity3d.com/en/#!/content/25794
The assert contains a fbx file, which contains a bunch of animations.

Then in Animator window I added a State and transitions between states and have set the Motion in the inspector of the state.
Then I look at the preview in Animator's inspector with it original Model, the animation works properly:

If I apply Unity Model or my custom Model in the preview, its became:

Why is that?  How can I fix it?
Or did I use it incorrectly?

sentences: Can I release Kinect based games? I've been reading up some hacks on Kinect development to work around the fact that there is no official SDK from Microsoft. Even if we do manage to create a game, can we distribute it through the XBox marketplace? Or will it cause any issues?

sentences:
Method for spawning enemies according to player score and game time I'm making a top-down shooter and want to scale the difficulty of the game according to what the score is and how much time has Passed. Along with this, I want to spawn enemies in different patterns and increase the intervals at which these enemies are shown. I'm going for a similar effect to Geometry wars. However, I can think of a to do this other than have multiple if-else statments, e.g. :

        if (score > 1000) {
    //spawn x amount if enemies
        }
        else if (score > 10000) {
    //spawn x amount of enemy type 1 & 2
        }
        else if (score > 15000) {
       //spawn x amount of enemy type 1 & 2 & 3
        }
        else if (score > 25000) {
       //spawn x amount of enemy type 1 & 2 & 3
       //create patterns with enemies
        }
       ...etc

What would be a better method of spawning enemies as I have described?

sentences:
Do multiple small script files use more RAM than one bigger script file? So I'm still new to making games that have a baseline for computer resource usage and I'm confused with my question. I can't find an answer anywhere on the internet so I'm here.

Simple Question:

  Which uses more resources? x10 small scripts or x1 mega script?

Detailed Question:

  Would x10 small scripts that consist of about 70 - 100 lines of code, be more resource consuming than x1 mega script containing about 700 - 1000 lines code?

sentences:
2D Distortion shaders for water effect I'm working on Unity, and I'm trying to improve my water.
The water will be seen top down, and I want to apply a shader to it to make it better looking.
I understand the concept of distortion shaders and using noise to make the maps for the displacement.

However I don't know what is the best option when implementing this.

-When using noise for this effect, should I create this noise texture each drawing cycle?

-How can I keep the distortion animation smooth? Since noise is random, how can I make a smooth animation for the distortion?

-Be it calculated each cycle, or having a precalculated set of distortion maps, how does the shader recieve this info? Each cycle the shader recieves a different distortion map? Or does the shader hold all the distortion maps?

I have seen tutorials and guides, but they explain it on a high level, leaving a lot of gaps in the process, and not being very experienced with shaders, I don't know how to handle it.

sentences:
Multiplayer Network Game - Interpolation and Frame Rate Consider the following scenario:

Let's say, for sake of example and simplicity, that you have an authoritative game server that sends state to its clients every 45ms.  The clients are interpolating state with an interpolation delay of 100 ms.  Finally, the clients are rendering a new frame every 15ms.

When state is updated on the client, the client time is set from the incoming state update.  Each time a frame renders, we take the render time (client time - interpolation delay) and identify a previous and target state to interpolate from.  To calculate the interpolation amount/factor, we take the difference of the render time and previous state time and divide by the difference of the target state and previous state times:

var factor = ((renderTime - previousStateTime) / (targetStateTime - previousStateTime))

Problem:  In the example above, we are effectively displaying the same interpolated state for 3 frames before we collected the next server update and a new client (render) time is set.

The rendering is mostly smooth, but there is a dash of jaggedness to it.

Question:  Given the example above, I'd like to think that the interpolation amount/factor should increase with each frame render to smooth out the movement.  Should this be considered and, if so, what is the best way to achieve this given the information from above?

sentences:
Prevent instances from overlapping gamemaker studio I have a game where multiple instances of an enemy move towards a player in their step process.  There can be as many as 50 instances on screen.

The issue is that the instances all end up in 1 big group as they follow the player.
I would like to prevent them from getting more than 2 pixels of each other.

the code is as follows:

if distance_to_object(player) < 160 {
  direction = ppoint_direction(x,y, player.x, player.x, player.y)
  p_potential_step(x,y, player.x, true);
}

If I put a distance check of 2px in this code, the instance starts making jerky movements and spins. I would like the instance to continue following the player, but just not allow themselves to overlap.

sentences:
Implementing Browser in Unreal Engine 4.10 I am looking to add some oauth to a game I am working on. I can get the user auth to work in the browser that comes with UE4, however there is not any capability to detect changes to the currently loaded URL so I can grab the token after the user loggs in. So I'm trying to create one. I created a new C++ class that extends UWebBrowser, added this line to the Build.css file

PublicDependencyModuleNames.AddRange(new string[] {"Http", "UMG"});

And I have this in my browser .h file so it will be available to use in blueprints

virtual const FText GetPaletteCategory() { return FText::FromString("Oauth Browser");

Now I just need to be notified of when the URL changes so I can grab to auth token but I can't seem to find a way to implement for that. I have read that it can be done though. Can anyone shed more light on this subject for me? I'd appreciate it.

sentences:
Godot Procedural map, Need help to avoid overlapping areas I have piece of code that using a tile set, i can draw an area of what is going to be a small town/city.
The code seed_cities, make an X number of cities randomly on the map, whereas draw_city just paints the city over the screen.
My problem is that from time to time, 2 or more citites overlap in the map.
func seed_cities(num_cities):
    var initial_point
    var final_point
    for i in range(0, num_cities):
        initial_point = Vector2(int (rand_range(0, screen_size.x/10)), int (rand_range(0, screen_size.y/10)) )
        range_x = randi() % 10 + 5  # 5 being minium longitude
        range_y = randi() % 10 + 5  # 5 being minium longitude
        final_point = Vector2(range_x, range_y)
        var city_position = {
                initial_point: initial_point,
                final_point: final_point
        }
        cities.append(city_position)
        # TODO check if there is another city before
        draw_city(final_point,final_point)

now, i tried to use the function line_intersects_line_2d , but the appears an error saying that line_intersects_line_2d is not declared on the current class, so i have another method of checking if the cities overlap. i was thinking of using that or creating an area2D with code to check if there is a collision.
func draw_city(initial_point, final_point):
    for x in range(0,final_point.x):
         $Objects.set_cell(initial_point.x + x , initial_point.y,4)
         $Objects.set_cell(initial_point.x + x, initial_point.y + final_point.y,4)
    for y in range(0,final_point.y+1):
         $Objects.set_cell(initial_point.x, initial_point.y + y,4)
         $Objects.set_cell(initial_point.x + final_point.x, initial_point.y +y,4)

Any ideas on what i need to import to use line_intersects_line_2d?
What other way i can check if 2 cities overlap before saving it's position and draw them on the map?

sentences:
What is closing and separating velocity in Ian Millington's game physics book? I'm working on a physics engine in C++ and chose Ian Millington's Physics Engine Development book as a guide and reference to help me out understand physics concepts and how to implement them.
Yesterday I was reading through the Hard Constraints chapter, particularly the simple collision resolution section and came across an explanation of a physics formula that I couldn't fully comprehend. Millington says "The closing velocity is the total speed at which two objects are moving together" and it is calculated with the following formula:
$$V_c= \dot{P}_a\cdot(\widehat{P_b-P_a})+\dot{P}_b\cdot(\widehat{P_a-P_b})$$
Where \$V_c\$ is the closing velocity, \$P_a\$ and \$P_b\$ are object \$a\$ and \$b\$ respectively. Also he further discusses another formula called the separating velocity which is written as follows:
$$V_s=(\dot{P}_a-\dot{P}_b)\cdot(\widehat{P_a-P_b})$$
Where \$V_s\$ is the separating velocity. Now I don't really understand what these formulas actually are or what they represent in the physics world. I also have trouble wrapping my head around why we need these formulas to perform collision resolution since he used the separating velocity formula to resolve the velocity upon collision and why we need the dot product. It would be really helpful if someone can provide visual explanation that would significantly help me understand what's going on.

sentences:
FBO Depth Buffer not working I'm trying to get the depth buffer for my 2D game working by offsetting the z value of the rectangles. For some reason, my depth buffer is coming back empty. The value is always 0. I'm assuiming there is something wrong with how I attach the depth buffer to the FBO? But I've looked over that code many times and don't see anything wrong with it. Let me know if you need more information.

I have depth testing enabled with GL_LEQUAL.
I have znear and zfar set to 1.f, -10.f and I have 9 quads setup at three different depths.
I have set glClearDepth(1.0) and I clear bot the COLOR_BUFFER_BIT and DEPTH_BUFFER_BIT before I draw to the FBO, however the value is still 0.

FBO setup:

RenderTarget::RenderTarget(int width, int height) {

    mWidth = width;
    mHeight = height;
    mVbo = 0;

    // Create the color buffer
    glGenTextures(1, &mTextureId);
    glBindTexture(GL_TEXTURE_2D, mTextureId);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, mWidth, mHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

    // Create the depth buffer
    glGenTextures(1, &mDepth);
    glBindTexture(GL_TEXTURE_2D, mDepth);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, mWidth, mHeight, 0, GL_RED, GL_BYTE, NULL);

    /*glGenRenderbuffers(1, &mDepth);
    glBindRenderbuffer(GL_RENDERBUFFER, mDepth);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32, mWidth, mHeight);*/

    // Create the frame buffer
    glGenFramebuffers(1, &mFbo);
    glBindFramebuffer(GL_FRAMEBUFFER, mFbo);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextureId, 0);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, mDepth, 0);

    GLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    assert(err == GL_FRAMEBUFFER_COMPLETE);

    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    createVbo();
}

Fragment shader

#version 120

uniform sampler2D diffuseMap;
uniform sampler2D lightmap;
uniform sampler2D depthMap;

varying vec4 texCoord[2];

void main()
{
    vec4 color = texture2D(diffuseMap, gl_TexCoord[0].st);
    vec4 light = texture2D(lightmap, gl_TexCoord[0].st);
    vec4 depth = texture2D(depthMap, gl_TexCoord[0].st);

    vec4 final = color * vec4(0.1);
    final += color * light;
    gl_FragColor= vec4(depth.r, depth.r, depth.r, 1.0);
}

Method to draw sprites to the screen/framebuffer

void GraphicsDevice::drawSprite(ISprite *sprite, float x, float y, float z, Material::TextureType type, Color c) {

    glActiveTexture(GL_TEXTURE0);
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);

    glBindBuffer(GL_ARRAY_BUFFER, sprite->getVbo());

    glBindTexture(GL_TEXTURE_2D, sprite->getMaterial()->getTexture(type)->getId());

    glPushMatrix();
    glTranslatef(x, y, z);
    glColor4f(c.r, c.g, c.b, c.a);

    glVertexPointer(3, GL_FLOAT, sizeof(Vertex), (void*)offsetof(Vertex, x));
    glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), (void*)offsetof(Vertex, tx));

    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

    glPopMatrix();

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);

}

sentences:
How can I change the list of enum options displayed in the inspector? I have an array of enums:

using UnityEngine;

public class EnumsInInspector : MonoBehaviour
{
    [SerializeField]
    public EnumType[] myEnums = new EnumType[3];

    public enum EnumType
    {
        A,
        B,
        C
    }
}

I want it so that if the enum at index 0 is B, then when selecting the enum at index 1, only A and C are options, and B is no longer available.  How can I achieve this?

sentences: Bouncing effect in Farseer WP7 I'm not quite sure what I need to do, but I have a ball falling from the sky and it needs to bounce when it hits an object. Do I configure the ball in some way or do I need to setup a spring object or possibly do something on collision?

sentences:
What's the best way to time a character AI movement on android/java? I'm creating an android game and I'm trying to figure out the best way to time a character position change, something like this:

public void move() {
    //this.posX += 5;
    this.posY += 5;

    if (posY < 350) {
    new Timer().schedule(new TimerTask() {
        public void run()  {
            this.move();
        }
        }, 300, 300);
    }
}

Is this the best way? I'm using Canvas. Thanks for your time.

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:
Traversing an acyclic binary tree to construct paths from a given starting node, but the paths come out wrong The tree is an acyclic binary tree. It's composed of node objects that have a list of connections to link objects (at most 3), and link objects that have a list of connections to node objects (always 2). I am trying to construct a list of possible paths to other nodes that can be reached given a fuel budget and a fuel cost on each link. What it is supposed to do is go through each non-backtracking connection of a node, and spawn a new route and thread to investigate that, leaving the current one to end at that node and thus create a list of routes to every node in the reachable area. When executed, the list of end destinations are valid but many of the paths that are constructed to get to them are wrong, going down other branches in the tree that are extraneous or entirely outside of the reachable area bounded by the fuel budget as well as jumping between nodes that aren't directly connected. There seems to be some pattern in the errors, when going down from the root of some branches of the tree the path goes down every offshoot in order first instead of going in a straight line, and when going up the tree the path tends to go further out and make triangle shapes, often landing somewhere other than the listed destination. I have already checked the link and node connections themselves to see if they are assigned properly, and they are. What am I getting wrong?
Route class definition
var origin:Node
var destination:Node
var totaldV:float
var totalt:float
var dVBudget:float
var tBudget:float
var tdVRatio:float
var links:Array
var nodes:Array

func duplicate_values(originator:Route):
    origin = originator.origin
    destination = originator.destination
    totaldV = originator.totaldV
    totalt = originator.totalt
    dVBudget = originator.dVBudget
    tBudget = originator.tBudget
    tdVRatio = originator.tdVRatio
    nodes = originator.nodes
    links = originator.links

func _init(originator_route):
    if originator_route != null:
        duplicate_values(originator_route)

Tree traversal algorithm
var routes:Array
onready var root = get_node("..")

func traverse(current_node:Node, previous_route:Route):
    if previous_route == null:                             # Starts off the recursion by providing an initial node
        previous_route = Route.new(null)
        previous_route.origin = current_node
        previous_route.nodes.append(previous_route.origin)
        previous_route.dVBudget = 2000
        previous_route.totaldV = 0
    for link in current_node.connections:
        if (previous_route.totaldV + link.dV < previous_route.dVBudget &&
        !IsBacktracking(previous_route, LinkDestination(link, current_node))):   # If there is enough fuel and the link isn't backtracking, go through it.
            var working_route:Route = Route.new(previous_route)    # Copy the previous route to make the new route
            routes.append(working_route)
            working_route.destination = LinkDestination(link, current_node)
            working_route.totaldV += link.dV
            working_route.totalt += link.t
            working_route.links.append(link)
            working_route.nodes.append(working_route.destination)
            traverse(working_route.destination, working_route)
    DisplayRoutes()
    root.get_parent().pathSelectionFlag = true   # UI control boolean

func IsBacktracking(route:Route, destinationNode:Node) -> bool:
    for nodeI in route.nodes:
        if (destinationNode == nodeI):
            return true
    return false

func LinkDestination(link:Node, originNode:Node) -> Node:    # Finds the node on the other side of a link
    for nodeI in link.connections:
        if (nodeI != originNode):
            return nodeI
    return originNode

sentences:
How should I organize Lua scripts so that some entities do not have access to functions they shouldn't? For my game in C++ I'm using different objects (like player, enemy, et cetera) which will have to be controlled by a Lua script. My problem is that if I were to write a function in my player script, all my other scripts will have access to it as well, and I don't want that.

I can think of three basic solutions:

For every iteration clear the entire state and re-register everything
Determine out what functions a script registers and remove them
Have every gameobject running it's own Lua state

Is there a good way to do this, keeping runtime performance in mind?

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:
XNA Multiple Key Input I'm using the KeyboardState state way (if there are any others) of handling key presses for a PC game. It has been working fine for single key presses but now I am trying to handle multiple key presses at once.

I have it grab the newState at the top and then save it to the oldState at the bottom. I've tried it this way:

if (newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D2) && newState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt))
{
    if (equipment_accessory2 != null)
        UseItem(equipment_accessory2, "Accessory 2");
}

And I've also tried:

Microsoft.Xna.Framework.Input.Keys[] currentPressedKeys = newState.GetPressedKeys();
bool altPressed = false, twoPressed = false;
for (int i = 0; i < currentPressedKeys.Length; i++)
{
    if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.LeftAlt)
                altPressed = true;
    else if (currentPressedKeys[i] == Microsoft.Xna.Framework.Input.Keys.D2)
                twoPressed = true;
}

...

if (altPressed)
{
    if (equipment_accessory2 != null && twoPressed)
        UseItem(equipment_accessory2, "Accessory 2");
}

Both ways work to a certain degree. The end result is that you're able to press alt and then a key between 1 and 5 to quick use a consumable. Normally you have skills in those slots so holding down alt makes the skills you have bound disappear and instead shows your quick use items.

The problem I'm having is that no matter what I have tried, the only way it works is that you have to hold 2 then hold alt. If you hold alt first and press/hold 2 it does nothing and doesn't work. I have spent 4 or 5 hours trying to figure out why it only works when you hold down 2 and then press alt. The problem with having it only work this way is if they have a skill bound to 2 then they're going to use the skill so the system is supposed to be to hold down left alt to swap the skill bar to the quick use bar.

I can't figure out why both ways I've tried doing multi key input aren't working when I press alt first.

EDIT: ok it must be something with my keyboard because alt+1 works but 2, 3, 4, and 5 don't work.
EDIT2: restarted and 2-5 work now too, was something with my keyboard apparently.

sentences:
Any reliable polygon normal calculation code? Do you have any reliable 3d polygonal face normal calculation code?

Any language will do, I'll port it to make it work. Even if you find some code in a 3d game engine and post it here I'll be more than grateful.

Edit:

I'm using this but it fails when faces are 90 degrees upright or similar.

        // the normal point
        var x:Number = 0;
        var y:Number = 0;
        var z:Number = 0;

        // if is a triangle with 3 points
        if (points.length == 3) {

            // read vertices of triangle
            var Ax:Number, Bx:Number, Cx:Number;
            var Ay:Number, By:Number, Cy:Number;
            var Az:Number, Bz:Number, Cz:Number;
            Ax = points[0].x;   Bx = points[1].x;   Cx = points[2].x;
            Ay = points[0].y;   By = points[1].y;   Cy = points[2].y;
            Az = points[0].z;   Bz = points[1].z;   Cz = points[2].z;

            // calculate normal of a triangle
            x = (By - Ay) * (Cz - Az) - (Bz - Az) * (Cy - Ay);
            y = (Bz - Az) * (Cx - Ax) - (Bx - Ax) * (Cz - Az);
            z = (Bx - Ax) * (Cy - Ay) - (By - Ay) * (Cx - Ax);

        // if is a polygon with 4+ points
        }else if (points.length > 3){

            // calculate normal of a polygon using all points
            var n:int = points.length;
            x = 0;
            y = 0;
            z = 0

            // ensure all points above 0
            var minx:Number = 0, miny:Number = 0, minz:Number = 0;
            for (var p:int = 0, pl:int = points.length; p < pl; p++) {
                var po:_Point3D = points[p] = points[p].clone();
                if (po.x < minx) {  minx = po.x;     }
                if (po.y < miny) {  miny = po.y;     }
                if (po.z < minz) {  minz = po.z;     }
            }
            if (minx > 0 || miny > 0 || minz > 0){
                for (p = 0; p < pl; p++) {
                    po = points[p];
                    po.x -= minx;
                    po.y -= miny;
                    po.z -= minz;
                }
            }

            var cur:int = 1, prev:int = 0, next:int = 2;
            for (var i:int = 1; i <= n; i++) {

                // using Newell method
                x += points[cur].y * (points[next].z - points[prev].z);
                y += points[cur].z * (points[next].x - points[prev].x);
                z += points[cur].x * (points[next].y - points[prev].y);
                cur = (cur+1) % n;
                next = (next+1) % n;
                prev = (prev+1) % n;
            }
        }

        // length of the normal
        var length:Number = Math.sqrt(x * x + y * y + z * z);

        // if area is 0
        if (length == 0) {
            return null;

        }else{
            // turn large values into a unit vector
            x = x / length;
            y = y / length;
            z = z / length;
        }

Edit:

I can somehow display 3d arrows for each calculated normal and go so far as to document test cases where it worked and failed. But I was looking for a simpler solution, simply by using code that someone else has created and found to be working. Is OpenGL all you have? Doesn't anyone have any triangle/polygonal normal calculation code at all?

To Jari:

I'm using this code to calculate normals, as built from OpenGL's pseudo code. Is there something I've done wrong? and what would happen if the points are not perfectly inplane? would it fail and return a random normal or just change the normal slightly?

            n = points.length;
            x = y = z = 0;
            for (i = 0; i < n; i++) {
                j = (i + 1) % n;
                x += (points[i].y - points[j].y) * (points[i].z + points[j].z);
                y += (points[i].z - points[j].z) * (points[i].x + points[j].x);
                z += (points[i].x - points[j].x) * (points[i].y + points[j].y);
            }

sentences:
How to generate houses procedurally in a voxel world? I am developing a mod for the game Minecraft, a block-based voxel game. As part of the mod, I want to create a procedural house generator that will be generated based on specific needs/desires, such as a desire for a bed, a desire to have certain blocks as part of the 'furniture'/walling. It also needs to be able to be extended over time.

What kind of algorithms would be suitable to generate unique-ish houses of this sort? I was thinking some kind of genetic algorithm perhaps, or a collection of built in house modules. I would like to avoid manual user input / manual input of a large collection of widgets as much as possible, or at least allow the layout of a room to be dynamically generated or themed.

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

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

Here's what I have in my Malfunction project:

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

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

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

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

... and this java file ...

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

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

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

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

    }

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

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

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

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

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

}

... and this java file ...

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

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

public abstract class MalfunctionScreen implements Screen {
    Game game;

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

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

    @Override
    public void show () {
    }

    @Override
    public void hide () {
    }

    @Override
    public void pause () {
    }

    @Override
    public void resume () {
    }

    @Override
    public void dispose () {
    }
}

Update: I also have this java code ...

package com.redcricket.malfunction.desktop;

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

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

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

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

Thanks!

sentences:
How to reference a map position in code? I'm coding a digital version of the Macao board game which has a flat map similar to below. Players have a "ship" which starts in the blue box and can follow the dashed lines in any direction/orientation.  The larger rectangles represent city locations.

I'm stuck in the following issues.

How do I record the position of each ship?  I'm thinking co-ordinates like X,Y but that doesn't tell me the segment its on
How do I construct the route paths as objects?   Do I put them in an array?
Finally; in order to measure distance between 1 rectangle and another, it will need to count how many segments there are to ascertain the shortest distance.  I believe this can be resolved via a simple path algorithm.

I've not created a map like this before in a project but would welcome any help on how to move this forward.

sentences:
Depth interpolation for z-buffer, with scanline I have to write my own software 3d rasterizer, and so far I am able to project my 3d model made of triangles into 2d space:

I rotate, translate and project my points to get a 2d space representation of each triangle.
Then, I take the 3 triangle points and I implement the scanline algorithm (using linear interpolation) to find all points[x][y] along the edges(left and right) of the triangles, so that I can scan the triangle horizontally, row by row, and fill it with pixels.

This works. Except I have to also implement z-buffering. This means that knowing the rotated&translated z coordinates of the 3 vertices of the triangle, I must interpolate the z coordinate for all other points I find with my scanline algorithm.

The concept seems clear enough, I first find Za and Zb with these calculations:

var Z_Slope = (bottom_point_z - top_point_z) / (bottom_point_y - top_point_y);
var Za = top_point_z + ((current_point_y - top_point_y) * Z_Slope);

Then for each Zp I do the same interpolation horizontally:

var Z_Slope = (right_z - left_z) / (right_x - left_x);
var Zp = left_z + ((current_point_x - left_x) * Z_Slope);

And if current z is closer to the viewer than the previous z at that index THEN write the color to the color buffer AND write the new z to the z buffer. (my coordinate system is x: left -> right; y: top -> bottom; z: your face -> computer screen;)

The problem is, it goes haywire.
The project is here and if you select the "Z-Buffered" radio button, you'll see the results... (note that I use the painter's algorithm (-only- to draw the wireframe) in "Z-Buffered" mode for debugging purposes)

PS: I've read here that you must turn the z's into their reciprocals (meaning z = 1/z) before you interpolate. I tried that, and it appears that there's no change.
What am I missing? (could anyone clarify, precisely where you must turn z into 1/z and where(if) to turn it back?)

[EDIT] Here's some data on what maximum and minimum z values I get:

    max z: 1;                  min z: -1;                 //<-- obvious, original z of the vertices of the triangles
    max z: 7.197753398761272;  min z: 3.791703256899924;   //<-- z of the points that were drawn to screen (you know, after rotation, translation), by the scanline with zbuffer, gotten with interpolation but not 1/z.
    max z: 0.2649908532179404; min z: 0.13849507306889008;//<-- same as above except I interpolated 1/z instead of z.
//yes, I am aware that changing z to 1/z means flipping the comparison in the zBuffer check. otherwise nothing gets drawn.

Before I go into painstaking debugging, can someone confirm that my concept so far is correct?

[EDIT2]

I have solved the z-buffering. As it turns out, the drawing order wasn't messed up at all. The z coordinates were being calculated correctly.

The problem was, in an attempt to increase my frame rate, I was drawing 4px/4px boxes, every 4th pixel, instead of actual pixels on screen. So I was drawing 16px per pixel, but checking the z buffer for only one of them. I'm such a boob.

TL/DR: The question still stands: How/why/when do you have to use the reciprocal of Z (as in 1/z) instead of Z? Because right now, everything works either way. (there's no noticeable difference).

sentences:
Jump function moves object horizontal after dash function I have a dash function in my game as well as a jump function. Both of them works completely fine all by themselves. The jump works find and the dash works fine, however, I want to be able to jump cancel from my dash. During my dash, when I try to hit the jump button, the charater object moves horizontally instead of vertically. It almost acts as a second dash.

What I want to happen is the character to be able to jump vertically out of my characters dash. Can someone guide me in the right direction to my desired results?

if (keyboard_check(ord("D")) && !place_meeting(x + 2, y, obj_hitbox_wall)) {
    x += 2;
    image_xscale =+1;
    directionFacing = "Right";
}
if (keyboard_check(ord("A")) && !place_meeting(x - 2, y, obj_hitbox_wall)) {
    x -= 2;
    image_xscale =-1;
    directionFacing = "Left";
}
///// WALL HIT DETECTION START /////
if (!place_meeting(x,y+2,obj_hitbox_wall)){
    gravity = .25;
    grounded = false;
} else {
    vspeed = 0;
    gravity = 0;
    grounded = true;
    jumpDash = false;
}
///// WALL HIT DETECTION STOP /////

///// DOUBLE JUMP PROPERTIES START /////
if (grounded == false && jumped == true) {
    if (keyboard_check_pressed(vk_space)) {
        vspeed = 0;
        vspeed -= 5;
        jumped = false;
    }
}

if (grounded == true) {
    if (keyboard_check_pressed(vk_space)) {
        vspeed -=5;
        jumped = true;
    }
}
///// DOUBLE JUMP PROPERTIES END /////

///// DASH PROPERTIES START /////
if (dashed == false && keyboard_check_pressed(vk_shift) && jumpDash == false) {
    if (directionFacing = "Right") {
        vspeed = 0;
        gravity = 0;
        speed += 8;
        dashed = true;
    }

    if (directionFacing = "Left") {
        vspeed = 0;
        gravity = 0;
        if (grounded == true) {
            speed -= 8;
        } else {
            speed+=8;
        }
        dashed = true;
    }

}

if (dashed == true && directionFacing = "Right") {
     speed -= .4;
     direction = 0;
    if (speed <= 0) {
        dashed = false;
        gravity = .25;
        speed = 0;
    }
}

if (dashed == true && directionFacing = "Left") {
    if (grounded == true){
        speed += .4;
        direction = 0;
    } else {
        speed -= .4;
        direction = 180;
    }
    if (grounded == true && speed >= 0) {
        dashed = false;
        gravity = .25;
        speed = 0
    } else if (grounded == false && speed <= 0) {
        dashed = false;
        gravity = .25;
        speed = 0
    }
}
///// DASH PROPERTIES END /////

///// JUMP DASH PROPERTIES START /////
if (grounded == false && dashed == true) {
    jumpDash = true;
}
///// JUMP DASH PROPERTIES END /////

sentences:
Are there any good techniques for reducing or smoothing stutter after a longer frame? I've been using SDL2 with OpenGL to play around with some very basic game engine development. I'm running everything on a newer laptop with Linux and Intel integrated graphics.

Regardless of whether I have VSync on or off, occasionally a call to SDL_GL_SwapWindow (glxSwapBuffers under the hood) will take ~22-33ms which causes a noticeable stutter in any moving sprites. These long frames happen even if the game loop contains nothing but a call to glClear followed by SDL_GL_SwapWindow, so I'm assuming this is just due to everything running on a relatively underpowered system (and I don't see the long frames or stutter on my desktop with dedicated graphics).

I would have given up here and left it at the laptop not being cut out for OpenGL, but when I look at some indie games running on the same laptop, I'm unable to notice any of these stutter effects leading me to believe there may be a way to eliminate them (or that I'm doing something wrong). A few of the indie games were built with Monogame and at least one is also using SDL2 and OpenGL. I used apitrace to look at the OpenGL calls being made by these games and nothing looks very different from what I'm doing.

I then spun up a very basic Monogame project on my own machine, but still experienced the long frames and sprite stutter. I've tried different variations of fixed and variable game loops / timesteps as well as deltatime averaging to try to smooth over longer frames, but I still have a noticeable stutter.

Is there anything else I can do to eliminate the stutter or the long frames?

sentences:
[SyncVar]s in Unity with client authority I'm making an networked RTS in Unity, and I have a problem with syncing a boolean on a non-player object. I create the object (which is a boat) using SpawnWithClientAuthority() on the server, with the boat's owner as the player argument.

From my knowledge of SpawnWithClientAuthority(), it would seem that I could then change the boat's SyncVars from the client and they would be reflected on other clients, but this doesn't seem to be the case. I do have Local Player Authority checked on the boat's NetworkIdentity. What's even more interesting is that the change works if it occurs on the Host's client, whereas it doesn't if it's on the remote client.

sentences: Triangle Texture Packing Problem I'm trying to create a texture atlas where each triangle face is laid separately from each other (i.e. it is not typical mesh parameterization). In order to do this, I would have to pack the triangles into a 2D texture image. Can someone suggest a good algorithm to do this efficiently, both timely and spatially?

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

sentences:
Performance of instantiating many prefabs as children of one prefab in unity Is there any performance difference between [instantiate multiple prefabs] and [put all prefabs under a single parent prefab and then instantiate that parent prefab] in scene.
Hope you understand what i want to say.

sentences:
Overriding the sprites in a Animation clip Right now we are in the process of adding seasonal content to our game. I would like to know of a way to override animation clips. Specifically I want to change the sprites being show at each key-frame. Looking from the text of a animation clip I found the following :

 m_PPtrCurves:
  - curve:
    - time: 0
      value: {fileID: 21300000, guid: 1fa82f3b0bb4e1f49ab9a9ffd4e891b1, type: 3}
    - time: 0.6
      value: {fileID: 21300000, guid: ae9111d826eb24442b21523b30b748bd, type: 3}
    - time: 0.6666667
      value: {fileID: 21300000, guid: 88840e4f59c4a6040922d9b6eed3dec3, type: 3}
    - time: 1.2333333
      value: {fileID: 21300000, guid: 88840e4f59c4a6040922d9b6eed3dec3, type: 3}
    - time: 2.0001667
      value: {fileID: 21300000, guid: ae9111d826eb24442b21523b30b748bd, type: 3}
    - time: 2.05
      value: {fileID: 21300000, guid: 1fa82f3b0bb4e1f49ab9a9ffd4e891b1, type: 3}
    - time: 3.1166666
      value: {fileID: 21300000, guid: 502fc97a961e4424ea008c0e546c83ef, type: 3}
    - time: 3.45
      value: {fileID: 21300000, guid: 1fa82f3b0bb4e1f49ab9a9ffd4e891b1, type: 3}
    attribute: m_Sprite

This corresponds to the key frames and amount of sprites in the animation clip but I have no idea from where to get the data for the new sprites. I'm guessing the guid is a hashed path to the png files. can someone  explain where to find this data so I can write myself a neat little parser to do the job?

sentences:
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: How can I avoid redundancies when I have multiple distinct Roblox tools with clientside code? In Roblox, I have two distinct tools with identical clientside code. The serverside code determines their difference to behave differently. However, with identical clientside code, whenever I change one, I have to change the other, and it's redundant in the game and also tedious. How can I avoid redundancies when I have two nearly identical but distinct tools with identical clientside code? Basically, I have one serverside script to handle the remote events, in ServerScriptService, and two tools, and it happens that they both invoke the same serverscript and are otherwise identical. How can I avoid redundancies?

sentences:
How can I create a spacial grid? I just created a tile map for my game, and its a side profile game. The game looks sort of like Terraria, where there is blocks you can place and break. I want the player to be able to collide with the blocks, and I don't know how to achieve something like this.

The game is in Javascript but I can understand other languages so feel free to give examples in the language of your choice.

sentences:
Improve mouse movement in first person game In my current FPS game, I have the mouse setup in a way, that it always forces the position of the mouse to be centered at the screen. This gets the job done, but also gets very annoying, since the mouse is "fixed" at the center of the screen.

Here is what I am doing:

get mouse current position
find offset from center of the screen
set mouse current position to center of the screen
apply difference to m_pTransformation (transformation matrix of the player)

Is there a better way to deal with this ?

sentences:
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:
Accessing Canvas and Button components in a scene I have a scene with the following hierarchy:

This is game scene and the game manager is a singleton with the following variable fields:

// canvas
public Canvas PauseCanvas;
public Canvas MainMenuCanvas;

Before implementing singleton, I assigned them from the inspector. Now that the game manager is singleton, I need to assign them through script on level load. I can see one solution to this situation:

Getting all canvas components through GetComponents<Canvas>() and then iterating and checking their name fields to assign them accordingly or maybe using LINQ.

What I want to ask is: Is there a name-based search method just like finding game objects with name GameObject.Find("Name") that is applicable for Components?

sentences:
Unity game debugging on Xcode This question has two parts:

1. How to get meaningful information out of Xcode crash logs? The game runs fine on the editor but when running on an iOS device it crashes and then gives information like this:

How can I dig out which script actually causes this?

2. Which Xcode debugging tools are available for Unity games? There are plenty of them mentioned here. Especially the frame capture and Instruments profiling seem very handy.

sentences: MonoGame audio format MP4 AAC is a well supported playback format according to the docs, but the MonoGame content project only seems to compile MP3/WAV/WMA formats. I tried to put raw aac files in my android game but the content manager wouldnt load them, only raw wav files work, but they are large in size. I would like to know how to load aac or ogg audio files.

sentences:
Zooming into Mouse Position I'm trying to implement my camera class for a simulation. But I cant figure out how to zoom into my world based on the mouse position. I mean the object under the mouse cursor should remain at the same screen position. My zooming looks like this:

VOID ZoomIn(D3DXMATRIX& WorldMatrix, FLOAT const& MouseX, FLOAT const& MouseY) {
    this->Position.z = this->Position.z * 0.9f;
    D3DXMatrixLookAtLH(&this->ViewMatrix, &this->Position, &this->Target, &this->UpDirection);
}

I passed the world matrix to the function because I had the idea to move my drawing origin according to the mouse position. But I cant find out how to calculate the offset in to move my drawing origin. Anyone got an idea how to calculate this?

Thanks in advance.

sentences:
Offline XNA Deployment to XBOX. Can it be done? Well,

The question is pretty explicit on its own. I want to know if I can deploy a game from my PC directly to a XBox. I'm not a professional developer of games, I do it on my free time because it amuses me, but nothing else. Im planning on buying an XBox but only if I can connect directly to my Visual Studio and test the games. I don't want to connect to XNA creators club or anything like it, is this possible?

I have XNA 4.0 with VS Ultimate 2k10

Best regards and many thanks in advance,
David

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:
Swapping limbs between meshes I'm trying to achieve what was done in the game impossible creatures. I will have a skeleton to which I will apply different meshes to i.e. torso mesh, leg mesh, etc. I would also like these meshes to be skinned together at the joints so that it looks like an animal and not like a robot.

Any ideas as to how I go about achieving this?

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: Unity crashes if there are more than 4 terrains please can you help me with the issue that I face, that is, I decided to create open-world game by creating several terrains and connect them together in Unity and firstly respective size of the terrains was 500X500 then I decided to add more terrains to make game world bigger and once I added the 5th terrain in the scene, Unity simply crashed. Later, I thought what if I increase the sizes of terrains rather than create more new terrains then the sizes of originally created terrains were changed from 500X500 to 800X800 and again Unity crashed. Please guys help me out with that and how to overcome that and I am just trying to create game without using any ready plugins and, say, try to create the game on my own. Thank you for your attention))).

sentences:
Movement algorithm for Pocket Civ game I am developing a Pocket Civ game engine. (You can check the process at www.pocketciv.com). Basically there is maximum of 8 Areas (round nodes in the pic) that have Tribes (number inside the node). So area 3 has three tribes and area 5 has two tribes.

There is basic movement rules see page 7 and then the movement rules change after new advances are acquired. There is only one movement phase and you can move the tribes in any order you want.

Basic: A single tribe can cross a border once (by land)
Advancement: You can move a stack of tribes across the sea at the cost of 1 tribe (so every tribe in the stack then crosses a border)
Advancement: A single tribe can cross a border two times
Advancement: A single tribe can cross any number of borders (crossing the sea still costs one tribe)
Advancement: When you move the stack across the sea, it doesn't cost anything

Essentially, if you have the last two advancements you can move any tribes anywhere you like.

The naive way to implement this would be to track what tribes are moved where when user moves them. But this is hard for the user (for example if you move one tribe 3->5 and one tribe 5->3 you have not moved anything. My approach is to let the user move tribes around and always check if the given situation is valid. For example valid end situations from above starting point are (shown as list [area1, area2, area3, area4, area5]:

[0, 0, 3, 0, 2] (no movement at all, also the starting point)
[0, 0, 3, 1, 1] (5 -> 4)
[0, 0, 0, 5, 0] (5 -> 4, 3 -> 4)
[0, 0, 5, 0, 0] (5 -> 3)
[0, 0, 2, 2, 1] (5 -> 4, 3 -> 4)
... etc

I have implemented some kind of way to check if the proposed situation is valid. It gets hard when we take the sea movement cost into account. We would need to know what is the cheapest way to make the movement and recognize when tribes moved over the sea. For this I would need all the permutations about what tribes moved where.

For example if we have starting position: [0, 0, 3, 2, 0]

[3, 0, 2, 0, 0] (3 -s> 1, 4 -> 3) would cost 1 tribe at minimum
[2, 2, 1, 0, 0] (3 -s> 1, 3 -s> 2) would cost 2 tribes at minimum

Can anyone help me phrase this problem or say what would be the correct algorithm to find that the proposed situation is valid and what is the minimum cost. Is this a graph problem? Can this be solved with matrices? I have studied Prolog a little but haven't managed to get anything usable out of it. I can tell my implementation later but I would like a "clean-table" view of this problem.

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:
Using AdMob with Games that use Open GLES Can anyone help me integrating Admob to my game. I've used the badlogic framework by MarioZencher ... and My game is like the SuperJumper. I am unable to use AdMob after a lot of my attempts. I am new to android dev...please help me..I went thru a number of tutorials but not getting adds displayed ...

I did the following...

get the libraries and placed them properly
My main.xml looks like this

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

My Activity class onCreate method:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

RelativeLayout layout = new RelativeLayout(this);
adView = new AdView(this, AdSize.BANNER, "a1518637fe542a2");
AdRequest request = new AdRequest();
request.addTestDevice(AdRequest.TEST_EMULATOR);
request.addTestDevice("D77E32324019F80A2CECEAAAAAAAAA");
adView.loadAd(request);
      layout.addView(glView);
      RelativeLayout.LayoutParams adParams =
              new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                              RelativeLayout.LayoutParams.WRAP_CONTENT);
      adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      adParams.addRule(RelativeLayout.CENTER_IN_PARENT);
      layout.addView(adView, adParams);
      setContentView(layout);

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
glView = new GLSurfaceView(this);
glView.setRenderer(this);
//setContentView(glView);

glGraphics = new GLGraphics(glView);
fileIO = new AndroidFileIO(getAssets());
audio = new AndroidAudio(this);
input = new AndroidInput(this, glView, 1, 1);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");

}
My Manifest file looks like this ....

    <activity android:name="com.google.ads.AdActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|smallestScreenSize"/>

</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="7" />

When I first decided to use the XML for admob purpose ..it showed no changes..it even didn't log the device id in Logcat...

Later when I wrote code in the Main Activity class.. and run ...
Application crashed ... with 7 errors evry time ...

The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.

The android:configChanges value of the com.google.ads.AdActivity must include uiMode.

The android:configChanges value of the com.google.ads.AdActivity must include screenSize.

The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.

You must have AdActivity declared in AndroidManifest.xml with configChanges.

You must have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.

Please help me by telling what wrong is there with the code?
Can I write code only in xml files without changing the Activity class ...
I will be very grateful to anyone providing support.

sentences:
Constrained/penalized distance function Assume a character is located on a n by n grid and has to reach a certain entry on that grid. Its current position is (x1,y1). Also on the same grid is an enemy with coordinates (x2,y2). Each step algorithm randomly generates new candidate locations for the hero (if there are k candidates then there is a kx2 matrix of new potential locations.

What I need is some distance objective function to compare the candidates. I'm currently using d1 - c * d2, where d1 is distance to the objective (measure in terms of number of pixels for each axis), d2 is distance to the enemy and c is some coefficient (this is very much like a set-up for Lagrangian). It's not working very well though. I'd be quite keen to learn how what constrained distance function are used for similar cases.

Any suggestions are very much appreciated.

sentences:
Positioning of the game object after scaling the game background i'm creating a game using Corona SDK i have a map and with ball and some other object moving on this map
and i'm using the ultimate config.lua file for scaling background based on device screen resolution
my problem is that i want to arrange some object on this map but for device resolution i have created specific assets for ex android device with aspect ratio lower than 1.72 so in this assets the map is stretched horizontally or it's became wider than other assets
so in this case when i want to arrange an object on top of this map the result is
that my object didn't set in the right place and that because the map is became shorter than is other design for more explaining when i set myobject.y=100 on a device with aspect ration more than 1.72 it set on the right place but when i do the same thing on device with aspect ratio less than 1.72 my object didn't set on the map
i tried to convert my pixels to inches using device DPI but it's still the same

sorry for my poor english
and thanks for help

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:
How to detect if players alter game files and stop them from entering the game server as the question says.

how can i check if a player modifies a file such as maps or spells in my rpg games that will be located as "/cache/spells", "/cache/maps" or "/cache/entities" and you get the point.

all the files are going to be written in .xml if that matters and the game will be an online game made in java. not a browser game btw

sentences:
How to properly generate walls simulating perspective around stone in a cave-like level made of squares? Long story short. My levels tiles currently look like this:

And i want them to look like this:

My levels are designed as 400x400 squares of proceduraly generated 0's and 1's, 0 representing dirt(walkable by player), 1 represeting stone(impenetrable).
Game itself looks a lot like this.
At first, my method was to run another loop - after generating the world that replaced stone tiles, depending on directions of empty tiles were, with wall. The method doesn't work so bad up to the point where there are 1 wide walls sticking out, which are impossible for it to convert, check picture:

As you can see, in my method, the wall is an another texture, taking one tile itself.
I can't replace air with walls, as that could possibly obstruct a passage. It basically fails every time there are 3 or more dirt tiles directly next to it.
This is the place at which i wondered if i chose the right method or if i should change the whole design for the walls, if so - to what? Should i create some textures for the 1-wides alone? Or maybe i shouldn't generate 1-wides at all? How do games generally deal with this?
I've looked for the answer to my problem, and haven't found it. Probably because it's hard for me to word it(sorry for messy post).

sentences:
How to simulate an elastic force, using Hinge Joint ? I've a bucket connected to a rope.

I would like that when a ball fall in my bucket , my bucket "bounce"down and up .. like it is connected to an elastic rope.

How can i do that ?

Thanks

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:
How to run JarSplice from the command line? I've tried java -jar jarsplice.jar --help and "" /? which just launches the UI. I'd like my game to automatically be packaged into a single jar when it's built so it would be very useful to be able to call it from the command line.

e.g-

java -jar jarsplice.jar -jars "..." -natives "..." -output "..." -exe -sh -mac

sentences:
How to create a new civilization mod for Age of Empires 1 Definitive Edition? I want to make a mod for Age of Empires 1 Definitive Edition, in which I split an existing civilization (Phoenicians) into two civilizations:

Eastern Phoenicians: Primarily representing Canaanites
Western Phoenicians: Primarily representing Carthaginians

I want to do so to fix an historical mistake in the development of AOE1 in which the Phoenician tech tree includes war elephants:
As far as I know --- none of the Eastern Phoenicians regularly used war Elephants in their armies:

Eastern Phoenicians from north to south and west to east:

Kingdom of Ugarit | Mittani polities
Kingdom of Tyre   | Kingdom of Aram-Damascus
Kingdom of Israel | Kingdom of Ammon
Kingdom of Judah  | Kingdom of Moab
Kingdom of Edom   | Nabataean polities

My problem

As a webmaster coding primarily in Bash-HTML-CSS-JavaScript-Wiki-Markdown stack who never wrote a GUI program with languages common for the task (such as XML, C++, C# and others) I have no idea where to start.

My question

How to create a new civilization mod for Age of Empires 1 Definitive Edition?

sentences:
How to implement custom texture formats in Android? What I know:
Android can load PNG, BMP, WEBP,... via BitmapFactory.

What I want to achive:
Load my own 2D file format (e.g. 1-bit texture with a 1-bit alpha channel) and output a RGBA8888 texture.

Question:
Is there any interface to achieve this?(or any other way)

The resulting image is used as a texture for a 3D model.

Why would you do that?
Saving phone memory and download bandwidth while expanding the texture at runtime to RAM seems reasonable for very simple textures.

sentences:
Get world position from depth buffer I have a buffer I am rendering gl_FragDepth (remapped to range 0-1) to a color buffer (instead of color) in OpenGL

I would like to, in a second pass, read this depth and use the x and y coordinates of the current fragment to re-calculate the world coordinates.

I'm rendering my scene to an FBO, then I screenquad this FBO's contents to the screen and during that render i'd like to find the worldspace coordinates I rendered with initially.

sentences: How can I tell how much of a "scratch card" has been revealed? I have developed scratch card effect.I am now working on reward system, so my question is how will I go on and implement logic which will let me know that the object behind scratch card is now visible??

sentences: How to make one 3D object face another? I'm writing a simple 3D engine myself and I cannot figure out how to make one object face another. The problem begins with identifying which direction the target object is in relation to the second. Actually rotating an object is not a problem, but essentially identifying the direction a particular object is facing (let's say, by identifying the global direction a key facet is facing) is a problem.

sentences:
How to find optimal perpendicular axis of rotation vector to draw arrows? I am drawing lines on the screen. Each line has a point (x,y,z) and a direction (u,v,w). I want to draw arrow heads on these lines, like two lines that start from (x,y,z) and leave at a 15 degree angle.

I know how to draw these arrow head lines. I do this by rotating (u,v,w) by 15 degrees on some axis of rotation which is perpendicular to (u,v,w). The problem is the axis of rotation I am using is not making all my graphs look good.

Basically I'm given a unit vector (u,v,w). If |w|=1, then u and v are 0 and I just use (1,0,0) which is a unit vector and perpendicular to (u,v,w).

If that is not the case, then I use (v, -u, 0) which is not a unit vector but is perpendicular. Then I normalize it. The norm won't be 0, since |w| < 1 which means u^2 + v^2 != 0.

This gives ok results. But some tests, the arrow head lines look a bit messed up, or not even looking like a 15 degree angle from the main line.

Does anyone know a good way to find a good perpendicular unit vector to (u,v,w) so the results will always look good?

Thanks

sentences:
Using one GLSL shader program for textured and untextured rendering? Rather than have two separate shaders in my OpenGL code (one for when a texture is bound, one for when none is bound) I usually go for one shader program which handles both.  This is my usual fragment shader:

#version 330

uniform bool textured;
uniform sampler2D sampler;

in vec4 fColor;
in vec2 tCoord;

out vec4 final_color;

void main()
{
    vec4 texel = vec4(1.0, 1.0, 1.0, 1.0);
    if (textured)
        texel = texture(sampler, tCoord);
    final_color = fColor * texel;
}

In a modern OpenGL profile, this compiled but did not output anything but black pixels (alternatively in LWJGL legacy profile, it outputted regular colors if textured == false and textured if textured == true).  I don't see any reason that this wouldn't work, but what is a method which would work for both textured and untextured fragments?

EDIT:

My Shader Class
My Main CPP File

sentences:
Can I 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: Isometric map black screen I am trying to create an isometric map and I am very new to it. Please see the attached example map. While rendering it I've noticed that when my actor reaches the edges of the map the player can see the black screen after it which is not very nice. I wonder what are the best practices of dealing with it ? Do I need to show the black screen where the map ends, if not then what's the best way to avoid/hide it?

sentences:
In Box2D, how do I create an infinitely oscillating spring? How do I create an ideal spring that can oscillate indefinitely using Box2D?

A b2DistanceJoint works almost perfectly, but it eventually slows to a stop, even with damping set to 0. I think it is because b2DistanceJoint is not meant for creating springs, but for preserving the distance between two bodies by correction the violated distance with a spring like behaviour. Hence, it should have a damping to eventually bring back the bodies to initial state and stop at some point.

sentences:
How to achieve anisotropic filtering I am loading a texture and using glGenerateMipmap() on it to achieve some level of mipmaping.

I get different result on nVidia gt 555m, and on Intel HD 3000.

The texture rendered by nVidia is not with Anisotropic filtering, and that rendered by intel HD 3k is.
How to manually adjust this feature for different GPU?

Also the tiling of the texture is much more apparent on nVidia!!

In the description of glGenerateMipmap() it is specified that the way glGenerateMipmap works is different for different implementations of OpenGL.

Is this something to do with glHint() GL_FASTEST , GL_NICEST , and GL_DONT_CARE?
Or am I better of mipmaping the texture myself?

sentences:
How do I Fallback to Older DirectX Versions? I had a feeling that it would be easier to tackle this problem before I got too deep into development (unless, of course if that's a bad idea/the hard way, please inform me...). I'm creating my game to be run ideally on DirectX 11, however, I want to offer it on DirectX 10, and I'm unsure if it is worth offering it for DirectX 9 for XP users. I'm not too sure how this fallback even works, as I can't find many articles on the internet. If someone could give me an in-depth article, that would be great.

I've read a little about how since DirectX11 is completely absent on XP, it is hard to even check for support. Someone mentioned having multiple applications for each version, is this a good idea?

Thanks to anyone who can point me in the right direction here.

sentences: How necessary are shader coders? I know that gameplay mechanics programmers, either directly working with source or with scripting are needed, however there are so many shaders written already that I would imagine you could find anything to meet the visual effects you are looking for, is this a fair assumption?

sentences:
Benefits of implementing systems like classes instead of just functions In an Entity System I am making, there is a central class called World, which stores all component instances. It's a dictionary-of-arrays, and entity ids are indexes for the arrays.

To access a component of an entity with id = 3 you would do this: world.storage["ComponentType"][3].

So, each loop of the game, these arrays would be fed to their respected systems (  movement(world.storage["Position"], world.storage["Velocity"]) ).

Now, I don't see why systems couldn't be implemented just as functions, as I showed. What optimizations can be made by using classes with data and methods (caching)?

Also, these systems would need to iterate over all the entities that exist, doesn't this make entity frameworks much slower than regular inheritance based engines? Why do some people "register" systems to the World class?

sentences:
Do I need to call Release() on D3D objects when I use them in another function? For example, I have an IDirect3DSurface9 * Surface and IDirect3DSurface9 *BackBuffer.

If I were to use them directly in the render_frame function, I would need to release them on the closeD3D function. However, if I use them in a function in same file or in another .h and .cpp file, when I call Release in closeD3D it gives me an error.

So, do I not need to release them if I'm using them in a function, or am I doing something wrong?

sentences:
My game is mostly complete, how do I find a publisher? I've been working for quite a while on a game.

I'm mostly done with it.

Simply finishing the project, adding banners and just publishing it on google play / appstore probably won't bring in any money, at least without firstly investing some in promotion...

How do I go about finding companies that might be interested in either promoting or maybe even fully buying out such a product?

sentences:
Entity Component System - How to implement an object's Transform? In designing an entity-component system for my engine, I've come across a little snag in the way of storing and retrieving a particular type of component.

First, let me set clear up a bit of terminology I'm going to use in this question:

I call "Component" a data structure that stores relevant data for a particular system.
I call "System" an aggregation of methods and data structures that makes use of Components to update game state/interface with the user.
An "Entity" is basically just an ID used to retrieve specific components and modify their data in game logic.

Each system owns an (ID-mapped) array of its type of Component (E.g Physics->PhysicsComponent, AI->AIComponent, Rendering->RenderingComponent), so that it can iterate efficiently over data.

Not all components are specifically owned by a system, however. For example, a Transform component stores an object's position, rotation and scale. It's one of the most important parts of an entity (Unity makes it mandatory, even), since it is used by a lot of systems, e.g. Physics, AI, Rendering etc.

This is pretty much the problem I'm facing. Since Transform is used by a lot of other systems, how should I go about retrieving one to use for each Component? One possible solution I see is to make each Component store its own Entity ID. It would be easy to retrieve any component like this, but it wouldn't be that efficient, and it also would go against the concept of a Component as an isolated and independent bundle of data, that isn't aware of any other.

Is there a proper way to solve this problem? Should Transform even be a component?

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:
How to use modern OpenGL for 2D games? I've found a plethora of "modern" OpenGL (3.0+) tutorials for 3D, but I have found next to nothing when looking for information on how to use it for 2D game development. How can I get started using OpenGL for 2D gamedev?

Specifically, I'm interested in getting answers to the following topics:

How should I set up my various matrices for orthographic projection?
Are shaders as heavily used in 2D applications as in 3D ones? If so, what is their purpose in the 2D setting?
How should I handle the massive number of textures obviously required for a 2D game?

I apologize for the relatively broad question, but I've spent a long time searching and I've found very little useful information that applies to modern OpenGL.

sentences:
Reloading Resources on Resume I'm having a problem with my game. If I press the "Home button" the game is paused... everythings fine, but if I then go back to the game all the resources are reloaded before I can continue the game. And it takes quite a bit. Is this normal, or is there a way to avoid the reloading?

I have write following code in onResume and onPause method. It loads same texture again and again on resume of game.

    @Override
    protected void onPause() {

            super.onPause();
            if (Utility.flagSound && mScene != null) {

                    if (mScene.getUserData().equals(Constants.GAME_SCENE))
                            Utility.isPlayLevelMusic = false;
                    else
                            Utility.isPlayLevelMusic = true;

                    audioManager.gameBgMusic.pause();
                    audioManager.levelBgMusic.pause();
            }

            if (this.mEngine != null && this.mEngine.isRunning()) {
                    this.mEngine.stop();
            }

    }

    @Override
    protected void onResume() {

            super.onResume();
            if (audioManager != null && Utility.flagSound && dataManager != null) {
                    if (Utility.flagSound) {
                            if (Utility.isPlayLevelMusic)
                                    audioManager.levelBgMusic.play();
                            else
                                    audioManager.gameBgMusic.play();
                    }
            }

            if (this.mEngine != null && !this.mEngine.isRunning()) {
                    this.mEngine.start();
            }

    }

I would be glad if anybody could help...

sentences: Why don't top selling mobile games have localization? For example: Plants vs Zombies 2, Angry Birds, Bad Piggies, Candy Crush Saga, Temple Run 2 and so on. These games are available in English only. These companies have huge resources; why don't they localize their games?

sentences:
Cannot use my objects method when accessing from Stage LibGDX I have a class Card with the method setOwner. I have set up my touch input to use a hitActor to identify touches by getting the Actor's name like so :

public boolean touchDown(int screenX, int screenY, int pointer, int button) {
   Vector2 hitCoord = stage.screenToStageCoordinates(new Vector2((float) screenX, (float) screenY));
   Actor hitActor = stage.hit(hitCoord.x, hitCoord.y, false);
    if (hitActor != null) {
            stage.getRoot().findActor(hitActor.getName()).setOwner();// here it doesnt identify the setOwner() method;
    }
    return false;
}

The problem is that it doesn't identify the method setOwner().
My Card actors are in a ListArray deck so I type casted them like so :

  for (Card c : deck) {
        c = (Card) stage.getRoot().findActor(c.getName() + c.getSuit());
    }

But still it doesn't identify the methods declared in the Card class. My goal is to call the methodsetOwner on the Actor that got touched.

sentences:
How to make a model impressive I am importing a model from 3DS Max 2011 which has been rendered by 3rd party renderer Vray. I believe that fbx does not support Vray information.

So, my questions are:
. What others ways are there to make the model impressive?
. What are my other options?

Also please note that I am very new to the world of XNA, so please elaborate the suggestion.

sentences:
In Unity (2017) is there a way to set the buttons used by Input.GetAxis() programatically? The buttons used for keyboard axis inputs can be set manually via Negative and Positive Button fields for the axis at Edit > Project Settings > Input Manager. However I'd like to make this a user configurable option which I think means needing to set the button values from a script.

I've been looking for a method along the lines of:

Input.SetAxis("Vertical").positveButton

But so far I'm striking out. Is there a way to do this?

sentences:
Weird GLM perspective problems with my 2D Game I am trying to create the graphics system of a 2D game using OpenGL 3.3.
To help me in this task I am using the GLM math libraries.
However I am having some trouble. When my objects (for now they are just squares) have  a different scale, they "slide" through each other. I am posting some examples below.
In this picture both objects are at the center and camera is centered at the center
In this other picture the code has only moved the camera, but for some reason the big square moved down faster than the smaller one

Here are the matrices I am using to transform my camera
  // Projection matrix : 120° Field of View, display range : 0.1 unit <-> 10000000 units
  glm::mat4 Projection = glm::perspective(3.141516f/1.5f, (float)_WindowWidth / (float)_WindowHeight, 0.1f, 10000.0f);

  //glm::mat4 Projection = glm::ortho(0.0f, 16.0f, 12.0f, 0.0f,  0.1f, 100000000.0f);
  // Camera matrix
  glm::mat4 View       = glm::lookAt(
    glm::vec3(CameraPos.x, CameraPos.y ,2.0f), // Camera Position
    glm::vec3(CameraPos.x, CameraPos.y ,1.0f), // Where the camera looks
    glm::vec3(0,1,0)  // This is another way to say camera is not rotated
  );

And here are my matrices for my model transform
  glm::mat4 ViewProj = View * Projection;

  // Object to world matrix
  glm::mat4 Model      = glm::translate(glm::mat4(), glm::vec3(ElementToDraw.Position.x, ElementToDraw.Position.y, 1.0f)) *
      glm::rotate(glm::mat4(), ElementToDraw.Rotation, glm::vec3(0.0f, 0.0f, 1.0f)) *
      glm::scale(glm::mat4(), glm::vec3(ElementToDraw.Scale.x, ElementToDraw.Scale.y, 1.0f));

  glm::mat4 MVP = Model * ViewProj;

I really don't know why this happens. Am I using some matrix wrong?
Another thing, this only happens on the axis of the different scale. If both objects have the same scale they don't "slide"
Thank you in advance :)
EDIT:
I tried using glm::ortho with the following parameters:
 glm::mat4 Projection = glm::ortho(0.0f, 4.0f, 3.0f, 0.0f,  0.1f, 1000.0f);

EDIT 2:
I am passing the MVP using shaders
But the sliding continued and the objects werent centered at the center of the window

sentences:
Dealing with alpha for 2D per pixel lighting Right now I've got a simple light shader. Every bitmap I draw goes through it to make up the scene. I only draw quads.

   texture tex;
   sampler2D s = sampler_state {
      texture = <tex>;
   };

bool use_tex;

float x = 0.1;
float y = 0.3;

   float4 ps_main(VS_OUTPUT Input) : COLOR0
   {
float4 p = Input.vPosition / Input.vPosition.w;
      float4 color = 0;
      float a = color.a;
      if(!use_tex)
        {
           color = Input.Color;
        }
        else
        {
           color = Input.Color * tex2D(s, Input.TexCoord.xy);
        }
      p += 1.0;
      p /= 2;
      p.y = 1.0 - p.y;

      float3 lightAttenuation = float3(0.05,4.0, 0.0);
     // float4 color = Input.Color * tex2D(s, Input.TexCoord.xy);
      float2 aux = float2(x,y) - p.xy;
      float dist = length(aux);
      float attenuation=1.0/(lightAttenuation.x+lightAttenuation.y*dist

+lightAttenuation.z*dist*dist);

      float3 lightAttenuation2 = float3(0.05,3.0, 0.0);
      float2 aux2 = float2(0.5,0.4) - p.xy;
      float dist2 = length(aux2);
      float attenuation2=1.0/(lightAttenuation2.x

+lightAttenuation2.y*dist2+lightAttenuation2.z*dist2*dist2);

      color = (float4(attenuation,attenuation,attenuation,1.0) * color * float4(1.0,0.8,0.8,1.0)

* 0.8)  + (float4(attenuation2,attenuation2,attenuation2,1.0) * color * float4(1.0,0.8,1.0,1.0)

* 0.2);

      return color;
   }

The shader calculates based on the current pixel's screen position.

The problem is when the pixel's alpha is != 1.0

It this case it would need to be multiplied by what is already in the backbuffer at that pixel location  in order to get the correct final pixel.

What can I do to fix the alpha issue and deal with the alpha case?

Thanks

PS2.0 hlsl.

Edit

Here are 2 images, the bright one is when the whole scene is rendered to texture then the shader is applied. The second is when I apply the shader on each fragment as the scene is rendered. This is an area where there is a dark shadow  on the ground. The shadow is a semi transparent bitmap. Thus it makes the lighting effect weaker and it makes it look weird.

What I want is a way for it to look like the first one, but still letting me do per fragment shading.  What I was saying was that I thought of maybe looking at what is already in the backbuffer, then multiplying it by the current pixel, then taking that result, applying the shader to it, then obviously you set the alpha to 1.0.

Im not sure if or how that could work. Im wondering either how to do that, or a better way to get the same result.

Here is my shader source:

   texture tex;
   sampler2D s = sampler_state {
      texture = <tex>;
   };

bool use_tex;

float x = 0.1;
float y = 0.3;

   float4 ps_main(VS_OUTPUT Input) : COLOR0
   {
float4 p = Input.vPosition / Input.vPosition.w;
      float4 color = 0;

      if(!use_tex)
        {
           color = Input.Color;
        }
        else
        {
           color = Input.Color * tex2D(s, Input.TexCoord.xy);
        }
     float a = color.a;
      p += 1.0;
      p /= 2;
      p.y = 1.0 - p.y;

      float3 lightAttenuation = float3(0.05,4.0, 0.0);
     // float4 color = Input.Color * tex2D(s, Input.TexCoord.xy);
      float2 aux = float2(x,y) - p.xy;
      float dist = length(aux);
      float attenuation=1.0/(lightAttenuation.x+lightAttenuation.y*dist+lightAttenuation.z*dist*dist);

      float3 lightAttenuation2 = float3(0.0,2.1, 1.0);
      float2 aux2 = float2(-1.5 + x,0.4 + y) - p.xy;
      float dist2 = length(aux2);
      float attenuation2=1.0/(lightAttenuation2.x+lightAttenuation2.y*dist2+lightAttenuation2.z*dist2*dist2);

      float4 c = (float4(attenuation,attenuation,attenuation,1.0) * color * float4(1.0,0.9,0.9,1.0) * 0.2) + (float4(attenuation2,attenuation2,attenuation2,1.0) * color * float4(1.0,0.8,1.0,1.0) * 0.2);

      color = c;

      color.a = a;

      return color;
   }

sentences:
Position of an object relative to another in a 2D plane I have two objects, A and B, each of them has a set of coordinates (x,y). How do I understand where is A in relation to B's position?

If I where to just check each coordinates I could do it like this:

B(x:5,y:5), A(x:4,y:5);
x = 5-4 = 1;
y = 5-5 = 0;
A it's on the left

B(x:5,y:5), A(x:6,y:5);
x = 5-6 = -1;
y = 5-5 = 0;
A it's on the right

B(x:5,y:5), A(x:5,y:6);
x = 5-5 = 0;
y = 5-6 = -1;
A it's on top of B

B(x:5,y:5), A(x:6,y:5);
x = 5-5 = 0;
y = 5-4 = 1;
A it's under B

But I was wondering, since I'm using a standard Vector2 data structure (from LibGDX), with the ability to normalize, compute distances, etc.. If I could do it using those methods instead of subtracting the coordinates each time.

If it can help, I need to know the position of A relative to B because A is supposed to push B, so if A it's on B's left, B needs to move right, etc...

sentences:
How do I prevent raycast car wheels sliding sideways? I've been writing a non-realistic car physics engine as a learning exercise, using this article as a reference.

I have a car that correctly collides with a terrain and applies the correct suspension forces for each wheel. My next problem is to prevent lateral movement of the wheels. For example, if I drop my car on a slope, it will slide sideways down the slope and then never stop sliding sideways (as there is no friction of any kind).

The linked article says that a "side force" must be applied, combined with the forward force, but it glosses over how that side force is calculated.

Given the collision info for each wheel (intersection normal, etc.) and the information about the car's rigid body, how can I calculate the appropriate side force to apply to the rigid body to prevent sideways motion?

sentences:
Maximizing efficiency on space distribution Imagine you have a room X metres long. You have different parts P of diverse lenghts L and importances I. However, the quantity Q of each part is limited and different. You want to fit in as many of these parts as possible while also prioritizing those with higher importances. ¿How do you do it?

I've been trying to find a better way to resolve this than testing all combinations, but without success. ¿Any suggestions? (And by the way, if this kind of problem has a name, please post it as a comment or a reply)

  Example:

  Lenth of room: 5m
  Number of parts: 4
  Part data:

    Part 1: 0.75m, 1 Units, 2 Importance
    Part 2: 1m, 3 Unit, 0.75  Importance
    Part 3: 0.47m, 4 Units, 1  Importance
    Part 4: 1.33m, 2 Units, 3 Importance

  Now as X, P, L, Q:
  X = 5;
  P.Lenght = 4;

  P0.L = 0.75;
  P0.Q = 1;
  P0.I = 2;

  P1.L = 1;
  P1.Q = 3;
  P1.I = 0.75;

  P2.L = 0.47;
  P2.Q = 4;
  P2.I = 1;

  P3.L = 1.33;
  P3.Q = 2;
  P3.I = 3;

sentences:
Box2D - Proper way to simulate player's body and feet I'm new to LibGDX and Box2D, and I'm trying to create my player's body but got some issues.

I've created the ground as a ChainShape, and my player as a Rectangle. I want to attach a fixture for its feet, so I tried adding an EdgeShape but - correct me if I'm wrong- it seems that an EdgeShape cannot collide with a ChainShape.

Is there a proper way to create the player's feet? Should I change my ground from ChainShape to Rectangles or should I use some other shape for the feet?

Edit:
Following DMGregory's advice, I've made some progress.
Since my print statements won't be of much help, I'll post this link with a very detailed explanation:
https://stackoverflow.com/questions/7459208/distinguish-between-collision-surface-orientations-in-box2d

And some background reading here:
https://www.iforce2d.net/b2dtut/collision-anatomy

sentences:
What is the simplest way to calculate energy earned based on time? A player has 0 energy, and gains 5 every 15 minutes, but has a maximum of 100 energy.

How would I be able to both store this in a database, and then recall the data later, to figure out how much energy the player now has?

The only way that I can think of is to save both the last updated time as well as the energy level at the last update, but that feels like it is not the best way.

Are there alternatives to this that are more efficient or 'better' and feel less kludge-y?

sentences:
Is Minecraft's source code available? I recall Mojang stating they would release the source code of Minecraft sooner or later, but searching both on google and on Minecraft sites I wasn't about to find it.

So... is it available somewhere? With what license?

PS: not interested in sources decompiled from the binaries, only in genuinely officially released sources.

sentences:
How can I create a heightmap for ocean surface simulation? I am working on a game that is based on boats fighiting each other. The game is finished but due to some license incopatibilities, I have to change how I simulate the surface of the sea.
What I used until now was a mesh with all the vertices of the sea, and I was setting each vertex's height using FFT (with a library that is the one I can't use). Now I don't have time to port it to another FFT library, so do you know any sine / cosine based formula or any other "easy" method that I can use to compute the height of each vertex which also keeps consistency between frames?
Having the game finished I need to keep some features of the previous implementation like it has to be CPU computed because the sea surface is affecting the boat's rotation.

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:
Constant rotation of a revolute joint in box2d I would like to have a line with one end attached to a location and have it rotate constantly (with the same speed) with a maximum of 45 to -45 degrees (i.e. I would like to have it swing like a rope back and forth 90 degrees).

Is this possible or should I use non box2d objects to do this (cheat box2d engine)?

sentences:
Why do i get this error in VS2017 but game compiles and works as expected? I have this error, yet the game works and that variable ActorThatOpens get assigned correctly.

In my header the includes are:

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"
#include "OpenDoor.generated.h"

As far as I can tell from the docs Components/ActorComponent.h contains the function  GetWorld().

I have to go work now, but been scratching my head over this for an hour or so, and will continue to when i get home later. If anyone can see what I am doing wrong and can help I will be so grateful.

(As you can probably tell I am completely new to C++) THANKS!

sentences:
Game Maker Studio 2, Shaders not working as intended in webbrowsers on mac The shader output of my html5 game in Game Maker Studio 2 looks wrong on  webbrowsers on MacOS. Sometimes the shaders lack completely and at other times the shader colors look completely different. How can I make the shaders work like they are intended to for safari webbrowsers?

See images below:

Mac webbrowser lacking shaders on squares

Other browsers not lacking shaders on squares

Mac webbrowser  different color hexagon

Other browsers intended colors

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:
Simulating wind (vertex bending) Right now I'm using the Crytek vegetation bending technique, vertex colors control how much force is applied to the branches, leafs and trunks. I have it working and it looks nice but I'm just using random wind so it's all over the place.

Here is the code I use for the wind on the CPU, this gets passed of the vertex shader where the bending happens:

    // Change wind every second, and smoothly interpolate to the new strength/direction.
    Dim timeEllapsed As Single = CType(gametime.ElapsedGameTime.TotalSeconds, Single)
    _Time += timeEllapsed
    timeSinceLastThing -= timeEllapsed
    If timeSinceLastThing < 0F Then
        lastWindSpeed = newWindSpeed
        Dim x As Single = CType(random.NextDouble(), Single)
        x = CType(Math.Pow(x, 3), Single)
        Dim y As Single = CType(random.NextDouble(), Single)
        y = CType(Math.Pow(y, 3), Single)
        newWindSpeed = New Vector2(x * 2.0F - 1.0F, y * 2.0F - 1.0F)
        newWindSpeed *= 0.9F
        timeSinceLastThing += 1.0F
    End If
    currentWindSpeed = Vector2.SmoothStep(newWindSpeed, lastWindSpeed, timeSinceLastThing)

It's nice and flowy so that's not an issue, it just doesn't really gust and stuff the same way wind does. I'm just wondering if anyone knows of a better way of making nice swaying wind? Or will I just have to tweak it till I find what I'm after?

sentences:
Implementing game state without switch statements everywhere? Executive summary

Are there any good tutorials on Game State FSMs, particularly OOP/OOD-based and not switch-statement-based?

Summary

Is there a practical process for creating a game state engine other than using a switch statement, preferably with examples? Wikipedia's event-driven FSM article only shows a switch statement and the article on FSMs is strictly theory-based with no practical examples.

Background

Currently all my games use a very simplistic game state "engine" that uses switch statements everywhere. It's very messy, violates DRY horribly, and does not scale very well.

Each state is treated as a level and must be checked at all three points throughout the game loop, i.e. Input, Processing, and Render. If a level or screen is added it must be added to all the switch statements.

Practical example of recreation of pac-man for educational purposes (seriously, this was a school project a few years ago):

enum STATE {
    LOADING,
    TITLE,
    LEVEL_ONE,
    LEVEL_TWO,
    // ...
    WIN,
    GAME_OVER,
    CREDITS,
}GAME_STATE;

void Input() {
    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...
            InputCommon();
            break;
        case WIN:
        case GAME_OVER:
            if(keyboard->KeyDown(KEY_ENTER))
                GAME_STATE = CREDITS;
            break;
        case CREDITS:
            if(keyboard->isKeyPressed())
                quit = true;
            break;
    }
}

void Processing(int dead) {

    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...
            ProcessLevel();
            if(GAME_STATE == LEVEL_SEVEN) {
                // ...
            }
            break;
        case WIN:
            break;
        case GAME_OVER:
            break;
        case CREDITS:
            break;
    }
}

void Render() {
    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(0));
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...

            // ...
            break;
        case WIN:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(3));
            break;
        case GAME_OVER:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(1));
            break;
        case CREDITS:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(2));
            break;
    }

    //End render process, display to screen.
    _gw->EndRender();

}

sentences:
Open Source Analysis There are a lot of code in open source projects, looking at all of the code is time consuming and can be confusing to a novice like me.  Are there any sections of open-source projects that should be focused on?

What should I focus on when I look at code?

I'm asking this in general because if I ask this specifically, the question will only apply in one or two projects rather than an entire group of projects ranging in different types of games and difficulty.

sentences:
Reducing noise from joystick at small deflections I have placed in my level a cube, which is my player, and a camera, which will follow the  player.

I'm defining a direction A from camera to player and another B perpendicular to this one. So I get two perpendicular directions no matter where the camera is located, A and B.

So far so good. I'm multiplying the direction A by the value of the vertical axis of a PS4 joystick. And the B direction by the horizontal input.

Then I make a vector sum: C = (A * verticalInput) + (B * horizontalInput)

C faces the direction in which the player should face, regardless of the camera position, so I can move the camera anywhere and the joystick input always corresponds to the camera's view.

The issue is that when the input magnitude is very very small, the C vector oscillates rapidly in a small angle interval. The result is that the player "vibrates" when looking at that direction.

This effect disappears when the inputs are greater than 0.5, but I cannot use a value that large for a dead zone because I want my player to walk very slowly because he is a ninja! (And is about to make a stealth-kill or very slow movement to avoid noise).

In other words, how do I reduce the jitter from noisy joystick input?

sentences:
What type of server should I use? I am planning on making a game in c#. It will be a turn based, space exploration game. I want the turns of the different players to be able to happen at the same time though. I have been researching for what type of server to use for hours and I cannot find one that works the way I want it to.

I have heard of listening servers, dedicated servers, and peer to peer.
-the peer to peer I have heard are almost gone, and obsolete for the most part
-dedicated servers are expensive, in terms of resources (lots of data)
-and there are listening servers which seem to be the best option.

Also is there a way for the server to run under the same exe as the client? like how minecraft does it? where each game is internally run in a server though 2 windows do not appear?

EDIT:

I know that I need to create my own server, and I am pretty sure I can do it in c# ( i made a small client and server that doesn't do much but it works) but I want to know what structure of server I should create

sentences:
Directional and orientation problem I have drawn 5 tentacles which are shown in red. I have drew those tentacles on a 2D Circle, and positioned them on 5 vertices of the that circle. BTW, The circle is never be drawn, I have used it to simplify the problem. Now I wanted to attached that circle with tentacles underneath the jellyfish. There is a problem with the current code but I don't know what is it.

You can see that the circle is parallel to the base of the jelly fish. I want it to be shifted so that it be inside the jelly fish. but I don't know how. I tried to multiply the direction vector to extend it but that didn't work.

// One tentacle is constructed from nodes
// Get the direction of the first tentacle's node 0 to node 39 of that tentacle;
   Vec3f dir = m_tentacle[0]->geNodesPos()[0] -  m_tentacle[0]->geNodesPos()[39];

    // Draw the circle with tentacles on it

    Vec3f pos = m_SpherePos;

    drawCircle(pos,dir,30,m_tentacle.size());

    for (int i=0; i<m_tentacle.size(); i++)
    {
        m_tentacle[i]->Draw();

    }

 // Draw the jelly fish, and orient it on the 2D Circle
    gl::pushMatrices();
    Quatf q;
    // assign quaternion to rotate the jelly fish around the tentacles
    q.set(Vec3f(0,-1,0),Vec3f(dir.x,dir.y,dir.z));
    // tanslate it to the position of the whole creature per every frame
    gl::translate(m_SpherePos.x,m_SpherePos.y,m_SpherePos.z);
    gl::rotate(q);

    // draw the jelly fish at center 0,0,0
    drawHemiSphere(Vec3f(0,0,0),m_iRadius,90);

    gl::popMatrices();

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:
What are the basics of 3D triangle/quad sorting? I am really curious how any 3D engine or even the GPU sorts triangles and quads. Are they basically taking a "center" point of a particular triangle/quad/poly and then calculate a distance from a camera point?

How is the depth of a polygon calculated if not using a point distance algorithm? Keep in mind I am a complete noob regarding 3D.

sentences:
Problem With Smooth Animation In C++/SDL/OpenGL I been working in the animation of a 2D platformer game in C++/SDL/OpenGL, and my team and I reach the point where we need to establish that every animation of the player (Walking, Running, etc..) needs a different framerate for our concept, but I use as a guideline the Game  Programming All In One as a example for the smooth animation, and in the book recommend have variables that limits the movement and the changes of frames.

To clarify what I mean I have in my Sprite class these parameters:

std::vector< Vector2f > delayMovementSprite;
std::vector< int > frameDelayPerAnimation;
GLfloat countX, countY;

Where the vector delayMovementSprite contains all the values for the differents animations and countX increment in every frame until it's equal or greater than the value that correspond in the vector delayMovementSprite.

Something like this:

void Sprite::movePosXWithSpeed()
{
  playerMoveInX = false || playerMoveInX;

  countX++;
  if ( countX > delayMovementSprite.at(getCurrentState()).x )
  {
    countX = 0;
    if ( handlerAnimation->getAnimationDirection() == SpriteData::RIGHT )
    {
      if ( position.x + getSpeedX() + width < 6368.f )
      {
        position.x += getSpeedX();
        playerMoveInX = true;
        return;
      }
    }

    else if ( position.x + getSpeedX() + width  > 0 )
    {
      position.x += getSpeedX();
      playerMoveInX = true;
      return;
    }
    playerMoveInX = false;
  }
}

And for the frames I have a class Animation which handles the following information:

Uint32 frameRate, oldTime;
int frameDelay;
int frameCount;

And in the function that animates I do the following, much like the MoveX in Sprite:

int Animation::animate()
{
  if( oldTime + frameRate > SDL_GetTicks() )
  {
    return -1;
  }

  oldTime += frameRate;
  frameCount++;

  if ( frameCount > frameDelay )
  {
    animationAlreadyEnd = false;
    frameCount = 0;
    currentFrame += incrementFrame;

    if( currentFrame > maxFrames)
    {
      animationAlreadyEnd = true;
      currentFrame = returnFrame;
    }
  }

  return currentFrame;
}

I got working all that and everything executes apparently fine, but in some points of the game the animation doesn't look really smooth when in other points it is.

I leave the video of the "gameplay" so everyone could see what I mean.

http://www.youtube.com/watch?v=uoxKEYzwkcQ

I currently using during the execution of the game a general Timer in 60 FPS.

If anyone needs more information, don't hesitate in ask.

Thanks a lot for the help.

sentences:
How to code a game that can interact with custom controllers? I want to have my work featured in alt.ctrl.gdc someday.

The process of building a bizarre custom controller is a question for a different stackexchange site, but

Can you tell me a way how to take data from a custom controller with potentially a lot of different bizarre data pouring in and then have that data control a game?

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:
Why does releasing a pressed "f" key not prevent the coroutine from spinning? I am learning Unity and the following is my simplification of the code presented on Coroutines.

My expectation is that the Fade() just spins in a very very short period of time because the GetKeyDown("f") is true only at the transition from "unpressed" to "pressed" states.

However in the following code, the Fade() spins from f=0 to f=999 continuously (non stop in one go) rather than for example, from f=0 to f=100 at the first key press and from f=101
to f=159 at the second key press, etc.

IEnumerator Fade()
{
    for (int f = 0; f < 1000; f++)
    {
        Debug.Log($"{f}");
        yield return null;
    }
}

void Update()
{
    if (Input.GetKeyDown("f"))
    {
        StartCoroutine("Fade");
    }
}

Question

What causes this unexpected result and how to solve it?

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:
How do I find an optimal FPS for best user experience while preserving battery life? I'm developing an Android game. The "graphics" I'm using need little CPU/GPU, so they run with high FPS. Because saving energy is important on Android devices, I want to limit frame-rate (if deltaTime < limitDeltaTime -> Thread.sleep(...) ).

How high should the frame-rate be to get an optimal balance between saving resources and a "fluid" gameplay experience. At which point is the user experience optimal or no longer improving?

sentences:
Tips on thinking of a good game mechanic? I am trying to make a turned based rpg and I really want to know how can i make original game mechanics like Undertale with it's sparing system.I am not really that creative to think of a good game mechanic,I just need tips on how to improve my creativity for game dev because it is really hard for me to think of something original.
Thanks!

sentences:
How to make natural looking voxel I'm developing a voxel game, but I think I use the wrong technique.
I currently use flat tiles, to make blocks, and I think theres a better and more efficient way.

I have seen a voxel game, which have naturally looking terrain. By that I mean non blocky.
The game have 4*4*4 blocks per cubic meter, and blocks like dirt, sand and stone, have round edges, and kind of melt together (Like in ordinary games). Heres a screenshot

How is this achieved?

sentences: Slick2D: Initializing graphics object before game loop I'm using the Slick2D Java game library and I want to set the scale of the graphics object that gets passed to the render method in my game loop.  I'd like to do this outside the render method, so that I would only have to call the setScale() method once.  I am implementing my game as StateBasedGame, so I'd to like to initialize my graphics object in my StateBasedGame class.  Where would be the appropriate place to do this?

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:
C# Unity - Getting which function affects a GameObject I have this little code that moves a GameObject over time:
 public void Move(Transform from, Transform to, float overTime)
     {
         StartCoroutine(_Move(from, to, overTime));
     }
     IEnumerator _Move(Transform from, Transform to, float overTime)
     {
         Vector2 original = from.position;
         float timer = 0.0f;
         while (timer < overTime)
         {
             float step = Vector2.Distance(original, to.position) * (Time.deltaTime / overTime);
             from.position = Vector2.MoveTowards(from.position, to.position, step);
             timer += Time.deltaTime;
             yield return null;
         }
     }

Which is easy as it is, I plan to use it for UI animations. However, things get interesting when I wish to use this for a bit more complex animations, or I want it to stop upon restart.
More complex animations:
I click a button which then moves to the side and bounches back. For this I need to know when the exact same method finished moving the button so I can restart it to bounce back.
Stop upon restart:
Say I hover my mouse over a button which moves then. However, if it's still moving, I want its current animation to stop, and a new one to start. For both of these I need to know which function affects which GameObject so I can manage that. Question is, how? Shall I use one script on each of the animated components which affects only that one? Or if I could use only one script on the whole Canvas, then how?

sentences:
What are the recommended approaches for an event system in Java? What are the recommended approaches for an event system of a turn-based RPG's battle engine?

The system I'm currently working on has a runEvent method that sorts the actions queue based on their priorities. This method should also call the object's (item, player, condition) method according to an eventid, which currently is a String ("TurnStart", "TurnEnd", etc). The different objects may or may not have the same parameters for the same eventid.

In JavaScript, it would be something like the following:

retval = action['on' + eventid].apply(this, args);

I've read about using Java's Reflection to call a method through a String stored in a variable, but some people advise against it because of its security flaws.

I also thought about having a switch (eventid) inside a handler method that would call the appropriate method, but I think that would become impractical, given the substantial amount of different parameters combinations.

So, what is the recommended approach for this kind of situation in Java?

Note: It doesn't need to be based on String passing.

sentences:
How can you meaningfully market test microtransactions? For a number of reasons I have chosen to use Microtransactions to monetize my current project. However, like all make or break features I am concerned about how they are received in-game.

Microtransactions seem to present a unique problem in my mind though. I believe that just giving people currency will skew my results, and it wouldn't actually represent how people feel about how things are priced (in the same way that I am more apt to waste money when I didn't have to earn it).

With that in mind, how can I effectively, and meaningfully market test the implementation of Microtransactions in my game?

sentences:
How to properly implement alpha blending in a complex 3D scene? I know this question might sound a bit easy to answer but It's driving me crazy. There are too many possible situations that a good alpha blending mechanism should handle, and for each Algorithm I can think of there is something missing.

These are the methods I've though about so far:

First of I though about object sorting by depth, this one simply fails because Objects are not simple shapes, they might have curves and might loop inside each other. So I can't always tell which one is closer to camera.
Then I thought about sorting triangles but this one also might fail, thought I'm not sure how to implement it there is a rare case that might again cause a problem, in which two triangle pass through each other. Again no one can tell which one is nearer.
The next thing was using depth buffer, at least the main reason we have depth buffer is because of the problems with sorting that I mentioned but now we get another problem. Since objects might be transparent, in a single pixel there might be more than one object visible. So for which object should I store pixel depth?
I then thought maybe I can only store the most front object depth, and using that determine how should I blend next draw calls at that pixel. But again there was a problem, think about two semi transparent planes with a solid plane in middle of them. I was going to render the solid plane at the end, one can see the most distant plane. Note that I was going to merge every two planes until there is only one color left for that pixel. Obviously I can use sorting methods too because of the same reasons I've explained above.
Finally the only thing I imagine being able to work is to render all objects into different render targets and then sort those layers and display the final output. But this time I don't know how can I implement this algorithm.

sentences:
Tiny Wings - Placing items I'm currently developing a Flash game like 'Tiny Wings'. I have a lot of work done, but i'm currently working on placing the items ( coins and obstacles ) on the terrain.

My player it is moving on a auto-generated terrain (based on Emanuele Feronato's tutorials) so every time the player's x position is greater than (screenWidth + x) another hill is generated and so on.

I'm currently having problems placing the items in a correct angle and put 5 or more items together on a hill.

Could you please help me with this?

Thanks,
Regards.

PS: This is the URL to the Emanuele Feronato post and the code to make the hills
http://www.emanueleferonato.com/2011/10/04/create-a-terrain-like-the-one-in-tiny-wings-with-flash-and-box2d-%E2%80%93-adding-more-bumps/

sentences:
How to change variable position within shader - Unity I recently learned how to write shader in Unity and I'm trying to move the texture within one of my variable.

this is the texture I used on the model.

I separated the texture into two shapes, which is texRound and texStar based on position. What I'm trying to do is to move the star texture stored in texStar variable without affecting the position of texRound.

What comes to my mind right now is to use something like this code below, but it doesn't work as the texStar variable only save the color value without the position.

(texStar.x + posModifier).a = texUV.r;

What should I do to access the position of the texStar variable?
Thank you so much in advance.

Here's my full code:

Shader "Custom/ASK RGB" {
    Properties {
        _UV ("UV", 2D) = "white" {}

        // variable I intend to use as modifier value to change the y position of the star texture
        _modifier ("Modifier" , float) = 0
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _UV;

        struct Input {
            float2 uv2_UV : texCOORD1;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            // variable used to store the UV texRoundture mentioned
            half4 texUV = tex2D (_UV, IN.uv2_UV.xy);

            // variables used to store the round texture and the star texture
            half4 texRound;
            half4 texStar;

            if (IN.uv2_UV.x > 0.7)
            {
                if (IN.uv2_UV.y > 0.5)
                {
                    texRound.a = texUV.r;
                    texStar.a = 0;
                }

                else
                {
                    texRound.a = 0;
                    texStar.a = texUV.r;
                }
            }
            else
            {
                texRound.a = 0;
                texStar.a = 0;
            }

            texRound.rgb = texUV.rgb;
            texStar.rgb = texUV.rgb;

            o.Albedo =  texRound.rgb * texRound.a + texStar.rgb * texStar.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
A name that describes this type of turn-based battle system I am thinking of a turn-based battle system that follows this workflow:

While True
  Get next character
  Determine character's action
  Execute action
  Check Battle Status
end

This is a straightforward battle system: there's a queue of battle characters, and on each iteration, it grabs the character at the front of the queue and has it perform an action. Once the action is performed, it gets pushed to the back of the queue.

Everyone gets an equal opportunity to perform an action and it simply rotates through all the participants.

When the loop breaks, end-battle processing occurs (eg: victory, defeat, escape, etc)

Is there a name for this particular type of turn-based battle system?

sentences:
How can I implement Objective-C libraries in Unity? I've been a "hardcore" developer for sometime now, as I've always worked with pure code reactive rendering, and contributed to Cocos2d library some time ago , (It is the one I used for my games) . But I've come to realize that most of the work I'm doing by setting up my game environment , user interface and everything else is becoming a bit repetitive, and complicated, as position must be tested each build , debugging sometimes involves exploring the deep down framework and I've decided to try out a full game development environment.

Some friends have recommended me Unity for mobile development (If you could give me any better advice I'd be grateful) but my main concern is my custom libraries I built on Objective C for multiplayer real time connectivity, it's probably thousands of lines and I wouldn't like to write them all over again.

Is there any way I could invoke my objective-c library in Unity ?

I know it's probably a vague question but can't seem to find where to start! Any guidance will be highly appreciated!

sentences:
Tracking small moving targets in Vuforia I am trying to track up to two small moving objects the size of a small toy car (about 7x4x4 cm / 3x2x2”)  from a 75cm / 2ft distance. I’m aware that the distance/size ratio is about 20, which is off by factor compared to the by Vuforia recommended ratio.

I've tried frame markers and while frame markers are super fast close up, they don't work well at a distance. I'm hesitant to use expensive object recognition on moving targets. I’ve tried black and white QR codes and AR markers as image targets but Vuforia seems to have trouble recognizing them, even though the QR code has a five star rating.

I’m considering two more options:

1) an optimized 4x4cm color image target

2) add LEDs to the objects and track the LEDs, for example like this: https://www.youtube.com/watch?v=IoL0bIGk_uE

My questions:

1) Are there specific tips for creating small image targets (I have read the generic image target optimizations tips assume not all those tips apply to small targets)

2) Is there an easy way to track LEDs in Vuforia?

sentences:
How can I reduce the amount of GLSL code written? I am writing a game engine for Linux. It has a sufficiently large number of effects that can be turned on / off. Effects are defined before compiling with #ifdef. But the problem is that I literally have to “wrap” each variable in #ifdef. Another problem is that when adding new effects, I have to rewrite the conditions, since one variable can refer to several effects at once. For example:

#if defined ALGINE_LIGHTING_MODE_ENABLED || defined ALGINE_SHADOW_MAPPING_MODE_ENABLED
uniform vec3 viewPos;                       // Camera position
#endif

#ifdef ALGINE_DOF_MODE_ENABLED
uniform float focalDepth;
uniform float focalRange;
#endif

How could I reduce the amount of re-write needed when adding new effects?

sentences:
Problem with progress bar visibility I have a code with several elements. One of these elements I would like you to initiate hidden.

So I did, set for the progress bar to start hidden. It started to go wrong when and I was calling its visibility (bind) the same stopped starting hidden.

I did a test with this problematic progress bar and another one created on time:

The progress bar that has the visibility setting function appears even if I set it to start hidden:

As I said, I believe that this strange behavior is due solely and exclusively to the fact that there is such a function:

Even though I have created a boolean variable that imposes a condition, the bar insists on appearing:

The variable quoted initiates by default as false:

I thought the blame could be on the return knot, but as you can see in the fourth image, even putting "hidden", the progress bar appears anyway.

sentences:
Scripting language with class instance support I have come across the need to use a scripting engine for my C++ game, but after experimenting with many languages since the last few days, nothing has truly stood out as the obvious choice for a language and/or binding library.

I would like have the ability to

call methods of a specific Game instance from within the scripting language,
call arbitrary functions in the scripts from C++, and
test for function existence in the scripts using strings.

Lua looks nice, but I'm unsure of its ability to do 1 and 3. Python and Boost::Python are great, but the same applies. Regardless, here's an example of an ideal implementation.

C++

class Game
{
    ...
    void printNumber(int arg);
};

int main( )
{
    Game *game = new Game();

    // Make method available to script
    functionRegister("printNumber", game->printNumber);

    // Test and call function in script
    if ( functionExists("greet") )
        functionCall("greet", "Hello world");
}

Script pseudocode

function greet( greeting )
    print( greeting )
    game.printNumber( 42 )
end

The output may be

Hello world
42

Is there a language and library that will pull this off?

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:
One Step-Ahead A-Star I am attempting to create a server-centric RTS (as opposed to usual parallel synchronised simulation route of most RTS games today) - however I am still leveraging the discreet N-turns-ahead paradigm discussed by one of the AOE developers on Gamasutra.
I have [possibly questionably?] decided that the path finding should only ever find the next cell the entity needs to move to, and was wondering if anyone has any clever ideas on how to optimize the algorithm for this specific scenario - or any other ideas on how to keep the pathfinding as lean as possible on the server.
I have investigated a few possible algorithms but could only come up with one appropriation: Tiered A-Star - Relatively large T1 tiles, work out (and cache) each cell as you enter it. Other than that: doing the full A-Star pass and caching the entire path, which might use too much memory if a large amount of units are present.
I know about the existence of naive progressive pathfinding algorithms (if you hit a block, turn in the direction closer to your target etc.) but they suffer from infinite feedback loops - and very poor pathing even if visited blocks are memorised. Not an option.
Many thanks.

sentences:
UE4: Subclass problem: cannot access private member declared in parent class? I get the following error:

  [...]\ClassB.cpp:7: erreur : C2248: 'UClassA::UClassA' : cannot access private member declared in class 'UClassA'
  [...]\ClassA.h:12: see declaration of 'AClassA::AClassA'
  [...]\ClassA.h:9: see declaration of 'AClassA'

when I create a subsubclass.

The problem occurs with the following code:

ClassA.h

#pragma once

#include "GameFramework/Actor.h"
#include "ClassA.generated.h"

UCLASS()
class PROBUILDER_API AClassA : public AActor
{
    GENERATED_BODY()
    AClassA( const FObjectInitializer& ObjectInitializer );

};

ClassA.cpp

#include "ProBuilder.h"
#include "ClassA.h"

AClassA::AClassA(const FObjectInitializer &ObjectInitializer):Super(ObjectInitializer)
{

}

ClassB.h

#pragma once

#include "ClassA.h"
#include "ClassB.generated.h"

UCLASS()
class PROBUILDER_API AClassB : public AClassA
{
    GENERATED_BODY()
    AClassB( const FObjectInitializer& ObjectInitializer );

};

ClassB.cpp

#include "ProBuilder.h"
#include "ClassB.h"

AClassB::AClassB(const FObjectInitializer &ObjectInitializer):Super(ObjectInitializer)
{

}

(I tried with a subclass of AActor and UMeshComponent and got the same errors)

sentences:
Problem animating in Unity/Orthello 2D. Can't move gameObject I have a enemy npc that moves left and right in a corridor.
It's animated with 2 sprites using Orthello 2D Framework.

If I untick the animation's play on start and looping, the npc moves correctly.
If I turn it on, the npc tries to move but is pulled back to his starting position again and again because of the animation loop.
If I turn looping off during runtime, the npc moves correctly again.

What did I do wrong?

Here's the npc code if needed.

using UnityEngine;
using System.Collections;

public class Enemies : MonoBehaviour
{
    private Vector2 movement;
    public float moveSpeed = 200;
    public bool started = true;
    public bool blockedRight = false;
    public bool blockedLeft = false;
    public GameObject BorderL;
    public GameObject BorderR;

    void Update ()
    {
        if (gameObject.transform.position.x < BorderL.transform.position.x)
        {
            started = false;
            blockedRight = false;
            blockedLeft = true;
        }
        if (gameObject.transform.position.x > BorderR.transform.position.x)
        {
            started = false;
            blockedLeft = false;
            blockedRight = true;
        }

        if(started)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedRight && !started && blockedLeft)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedLeft && !started && blockedRight)
        {
            movement = new Vector2(-1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
    }
}

sentences:
Camera and enemy behaviour in AS3 platformer beginner in AS3 here. I am working on a platformer game based on the code of a provided example exercise. I have the following problem:

I have an enemy who shoots bullets. The enemy is the parent, and the bullet are the child. When I move to the next scene (level), the bullets are still there, but invisible, even using the removeEventListener to shut down the bullet hit check.

Here is the code of the child "disparoEnemigo_mov":

addEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
function fl_MoveEnemyShot(event: Event) {
try {
    if (enemy_shot.y < 300) {
        if (enemy_shot.hitTestObject(Object(this.parent).mario)) {

            variablesGlobales.variables().vidas -= 1;
            Object(root).texto.text =
variablesGlobales.variables().vidas.toString();
            trace("vidas: " + variablesGlobales.variables().vidas);
            if (variablesGlobales.variables().vidas < 1) {
                MovieClip(this.parent).gotoAndStop(2);
            }
            this.parent.removeChild(this);
            removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        } else {
            enemy_shot.y += 3;
        }
    } else {
        trace("LLEGADA");
        removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        this.parent.removeChild(this);
    }
} catch (error: Error) {
    removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
}
}

import flash.events.Event;
import flash.media.SoundMixer;

addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

function fl_EnterFrameHandler(event: Event): void {
try{
if (this.hitTestObject(Object(this.parent).mario)) {

    SoundMixer.stopAll();
    var sound:gameOver = new gameOver();
    sound.play();
    Object(this.parent).mario.y=1000;
    Object(this.parent).mario.x-=15;
    trace("Mario dies");
    var cartel:StageLose = new StageLose();
    stage.addChild(cartel);
    cartel.x = -85;
    Object(this.parent).mario.y = 1000;
    }
}catch(error: Error){
removeEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler);
}
}

And this is the code of the parent, "enemigo_mov":

var leftPressed: Boolean = true;
var rightPressed: Boolean = false;
stage.addEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
function fl_MoveEnemy(event: Event) {
try{
if (leftPressed) {
    enemy1.x -= 0;
    if (enemy1.x < -120) {
        leftPressed = false;
        rightPressed = true;
    }
} else if (rightPressed) {
    enemy1.x += 1;
    if (enemy1.x > 120) {
        rightPressed = false;
        leftPressed = true;
    }
}
var number: Number = Math.random();
if (number < 0.05){// &&
variablesGlobales.variables().coleccionEnemigos.indexOf(this) != -1) {
    trace("creation");
    var disparo: disparoEnemigo_mov = new disparoEnemigo_mov();
    this.parent.addChild(disparo);
    disparo.x=enemy1.x +115;
    disparo.y=enemy1.y +115;

    //disparo.z=50;
    trace(disparo.x + " " + disparo.y);
    }

}catch(error:Error){
removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
}
}

In both codes, "mario" is the player character.

What I need to do is to stop the bullet creation of ""disparoEnemigo_mov" when we move to the next scene. Shouldn't the "removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy)" line stop the bullets to check if there is any collision with the player?

Any help or resource will be helpful. Thank you so much!

sentences:
Unity Blurry on new Windows 4k Computer I just got a Razer 14 Inch 4k with a GTX 1060 and am having some blurry rendering in unity. Also the cursor is tiny... Here is a screen shot:

As you can see, the rendering is really blurry. I came from a mac and did not expect unity to look worse after switching to a computer with a great screen res and graphics card...

Please help!

EDIT:

I am still getting jagged shadows but now I seem to be able to fix it with changing shadow distance in Quality Project Settings:

But then the shadow disappears really quick if i have low shadow distance...

sentences:
Flexible alternatives to many many small polymorphic classes (for use as properties or messages or events) C++ There are two classes in my game that are really useful, but slowly becoming a pain. Message and Property (property is essentially a component).

They both derive from a base class and contain a static id so that systems can only pay attention to the ones they want to. It's working out very well... except...

I'm constantly making new message types and property types as I extend my game. Each time I need to write 2 files (hpp and cpp) and a ton of boilerplate to get essentially an classID and one or two standard data types or a pointer.

It's starting to make playing around and testing out new ideas a real chore. I wish when I want to create a new message or property type, I want to be able to just type something like

ShootableProperty:  int gunType, float shotspeed;

ItemCollectedMessage:  int itemType;

instead of creating a header and cpp file, writing a constructor, including the parent class, etc etc.

It's around 20 - 40 lines (including include guards, and everything) just to do what logically is 1 or 2 lines in my mind.

Is there some programming pattern to get around this?

What about with scripting (which I know nothing of)... is there a way to define a bunch of classes that are almost the same?

Here is exactly what one class looks like:

// Velocity.h

#ifndef VELOCITY_H_
#define VELOCITY_H_

#include "Properties.h"

#include <SFML/System/Vector2.hpp>

namespace LaB
{
namespace P
{

class Velocity: public LaB::Property
{
public:
    static const PropertyID id;

    Velocity(float vx = 0.0, float vy = 0.0)
    : velocity(vx,vy) {}
    Velocity(sf::Vector2f v) : velocity(v) {};

    sf::Vector2f velocity;
};

} /* namespace P */
} /* namespace LaB */
#endif /* LaB::P_VELOCITY_H_ */

// Velocity.cpp

#include "Properties/Velocity.h"

namespace LaB
{
namespace P
{

const PropertyID Velocity::id = Property::registerID();

} /* namespace P */
} /* namespace LaB */

All of that just for a 2D Vector and an ID saying to expect a 2D vector.  (Granted, some properties have more complicated elements, but it's the same idea)

sentences:
Game engine tool generating game entities I'm writing a game engine with an editor that allows you to create individual components like sprites, fonts, and particles. Then you're able to combine these individual components into what I call an "Entity", to create something more complex and whole.

Currently you can only construct an Entity through code. You derive a new class off of an Entity interface and its derived members are the components you wish it to have (sprites, texts, etc). You can then implement whatever new logic this Entity is supposed to do.

I want to be able to create these entities in my editor, so you're able to simply read a file at run time that loads in all the required components and initializes them to specified values.

I can auto generate the c++ derived Entity class file, then deal with either auto importing it into the code project (or relying on the user to do so). I can directly generate the specified initialization code in the constructor. Makes for easiest access to components when implementing custom logic, and can ensure components' memory is contiguous for better cache.
Or simply have the Entity base class read the file and stores all its required components in a std::vector. Initializing the components will require a robust, hefty function for parsing the file and applying the specified values. Accessing the components when implementing your logic will also be a pain, either remembering their indices, or using string names in a map (bleh).

I like the first auto generating solution better, but I'm afraid of the maintenance and upkeeping it may require. Also I can't just keep overwriting their class source file so I'll need them to separate their custom logic in another source file. Would want a clean way to do that, and possibly a clean way to auto import the source code into the project (The tool knows the source directory, and I guess I could put the whole declaration/definition in a header file).

Any insight on which implementation? Have you ever auto generated C++ code before and regretted it? Or is there an entirely better way?

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:
Collision with Two Angled Platforms I've encountered a problem in my attempt to implement Collision Handling for a game I'm creating, involving a collision with two angled platforms.

I'm using GJK-EPA for detecting/handling collisions so I can pull the penetration vector and depth from each collision, and using this I have been calculating the angle of the surface the player collides with.

What I don't understand, is how I should resolve a collision when the character is moving from one slope to a steeper slope, one slope to a shallower slope and flat-surface -> slope and vice versa.

I attempted comparing penetration depths but due to the nature of GJK, I can only do this with some additional vector maths which then refuses to work for steep->shallow slopes. Additionally: It sometimes seems to 'spasm' on direct contact with vertices.

Basically, can anyone tell me a good/common way of handling angles of objects that are touching TWO platforms, using GJK-EPA?

Thank you!

(To note: I'm relatively new to game development, and I'm trying to get some smooth slope physics working, just so you know the 'situation').

sentences:
What is the proper way to handle data between scenes? I am developing my first 2D game in Unity and I have come across what seems an important question.

How do I handle data between scenes?

There seems to be different answers to this:

Someone mention using PlayerPrefs, while other people told me this should be used to store other things like screen brightness and so on.
Someone told me that the best way was to make sure to write everything into a savegame everytime that I changed scenes, and to make sure that when the new scene loads, get the info from the savegame again. This seemed to me wasteful in performance. Was I wrong?
The other solution, which is the one I have implemented so far is to have a global game object that isn't destroyed between scenes, handling all the data between scenes. So when the game starts, I load a Start Scene where this object is loaded. After this ends, it loads the first real game scene, usually a main menu.

This is my implementation:

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

public class GameController : MonoBehaviour {

    // Make global
    public static GameController Instance {
        get;
        set;
    }

    void Awake () {
        DontDestroyOnLoad (transform.gameObject);
        Instance = this;
    }

    void Start() {
        //Load first game scene (probably main menu)
        Application.LoadLevel(2);
    }

    // Data persisted between scenes
    public int exp = 0;
    public int armor = 0;
    public int weapon = 0;
    //...
}

This object can be handled on my other classes like this:

private GameController gameController = GameController.Instance;

While this has worked so far, it presents me with one big problem: If I want to load directly a scene, let's say for instance the final level of the game, I can't load it directly, since that scene does not contain this global game object.

Am I handling this problem the wrong way? Are there better practices for this kind of challenge? I would love to hear your opinions, thoughts and suggestions on this issue.

Thanks

sentences:
HIGH energy consumption in Empty Scene Unity iOS I am struggling from quite long about this issue where I am having High Energy Impact in Unity 2019.2.16f1 on iOS platform and it doesn't matter which device I am using. It occurs on iPhone6 to iPhoneX also I tried in an empty scene and checked stats through xCode and still bar is in Very High. Can someone explain to me what is going on? because of this device gets heat up quickly.

Below are stats with empty scene.

I have tried following still Very High:

Framerate to 30
SetResolution to 720 x 1080
Compressing Textures
Multi-threaded Rendering enabled and disabled
Auto Graphics API turned on and off in player setting

Though I am making game and I don't want to set resolution too low or to compress textures, I want as much attractive graphics as unity can offer.

Also is this estimation of GPU Utilization calculated on based on total capacity of GPU vs how much the app is taking at the moment? I am totally blocked here and I need to improve energy impact of my app.

sentences:
MMO Server with C# asynchronous sockets performance I have developed a 2D RPG MMO client / server. The server is developed in C# with asynchronous sockets. It is a pretty simplet implementation. The server gets the client's input / coordinates and broadcasts it to the other players. It is a very alpha stadium so that I only want to test performance to know if this way to go is good.

Now I am living in Germany, I have a static public IP (accessible via the internet) and deployed my game server on a Raspberry Pi 3 (it runs in the command line with C# / Mono). The only database access (write / read) is currently made, when a client connects or disconnects (store / load coordinates).

I made a speed test right now and have the following result:
Download Speed: 100840 kbit/s
Upload Speed: 8973 kbit/s
The Raspberry Pi is connected on a router (Fritz Box) via LAN and the port is set to  bridge mode (because of the public static IP).

Everything runs fine, but I tested it with ony two clients and when one client begins to move, the second client "sees" it maybe 1 second later. The movement is "lag free". But of course, it takes a lot of time until the signal arrives to the other clients.

My question now is, will I have the same issues later, when I rent a server? I really hope that this is what I should expect, when I run my server in my home network. Maybe this question is pretty difficult to answer, because I give you no source code of the server here, but as I said, when the clients get the signal, it is "lag free". The only thing I have is kind of a "delay".

Thanks in advice.

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:
Starting Java 2D Platformer using LWJGL Getting started on a 2d platforming project in java. I've decided on using LWJGL and OpenGL, but I don't quite know where to start. What is typically the first thing one would work on with a platforming game?

I've never done any game development before, but I'm hoping this will be good practice and hopefully fun to implement and eventually play.

Thanks

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:
Instantiated Prefab Facing Wrong Way Here's a Youtube video of my problem in action ((in the video I am clicking in various directions, yet the fireball is always created facing down in some direction.))

I've been having a lot of trouble wrapping my brain around Quaternion rotations in Unity2D.

What I'm trying to do is so simple, yet it keeps beating me. I simply want to instantiate a prefab of fireball when I click the button. The problem is that I want the fireball to be facing in the direction of the mouse before firing along. I haven't gotten to the fire and velocity part because I can't get it face the right direction when it's created.

In my playercontrollerscript attached to the player Object I have this (In C#)

        if (Input.GetMouseButtonDown (0) && anim.GetBool ("canAtk")) { //Basic attack controls

        curTarget = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if(classState == "Cutter"){
            anim.SetTrigger ("attacking");
            anim.SetBool ("canAtk", false);
            StartCoroutine (AttackTiming ());
            anim.SetFloat ("animCombo", playerCombo);
        }
        else if(classState == "Flame"){
            Debug.Log (curTarget);
            var worldTarget = Input.mousePosition;
            Quaternion rot = Quaternion.LookRotation(transform.position - curTarget, Vector3.right);
            Rigidbody2D fballClone = (Rigidbody2D) Instantiate(fireBallz, transform.position, rot);

(You can safely ignore the cutter class part. The problem is when I'm in Flame class. I also have a script attached to the prefab object, but at this moment all it does is control Euler angles so it doesn't rotate along the weirdness axis.

Anyways, each time I hit the button it creates a fireball, but it's like they are 90 degrees behind where they should be. I say "like" because that's not always the case. If I click under my character, then the fireball is pointing up. If I click sort of "Down/right" it points "up/right".

This would be easier if I could visually wrap my head around how the rotations work. Any advice would be appreciated. If you need any more information or screenshots let me know as well. Thanks again.

Update: so previously I had left a line setting curTarget.z to 1 because it was returning -10 for the camera Z and I thought that was related to the problem. Oddly, when I removed that line it halfway fixed the problem. Now, if I click in the down/right or down/left or down it will create the fireball facing correct direction, but if it's "up" any, then it will pretty much face the opposite direction. Also, directly left or directly right causes the fireball to face down.

New Update: (Sort of just updating as I try to work it out.) I turned on Debug.Log(rot) just so I could see the rotation values when I create the fireball.

If I click bottom right I get (0.0, -0.6, -0.4, 0.7) the fireball is facing the correct position as it does always as long as I'm clicking in the "downish" area. When I click top right I get (-0.6, 0.0, 0.7, -0.3) and the fireball is facing Bottom-Left. So I click in the bottom-left direction and I get (0.6, 0.1, 0.7, -0.4) and it's facing bottom-left. My brain is so fried I'm not piecing it together correctly. Something I'm missing.

sentences:
What is the graphical effect occurring to non-mipmapped distant textures called? We all know about mip-mapping. It reduces texture quality when a texture is further away.

Without mip-mapping, a texture appears to "flicker", like the top of the mountain here:

Is there any specific name for it?

I want to write a sentence like "I applied mip-mapping to solve the ___ effect", or "This is known as ___, and occurs when mip-mapping is not used".

sentences:
UE4 tips how to handle Minigolf Multiplayer Heyo!

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

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

sentences:
Server-side real time position calculation based on destination position - C# What I want to achieve is to calculate the real object position based on its speed and a destination position.
In my server, I have a MapInstance that have a list of MapLayer that have MapRegions.

To resume we have:

1 MapInstance

N MapLayers
X MapRegions

Each MapInstance will update in an asynchronous task all his map layers and the common object such as NPCs and the MapLayer will update his regions of entities (monsters/items).

On the client side, when I click somewhere on the map, it sends a packet to the server with the destination position.
Then, on the server-side I receive the position and set the entity.Movable.DestinationPosition property.

As I said earlier, each map instance are updated in an asynchronous task and updates the map layers and common entities.
My problem is, my realtime position calculation formula is wrong somewhere, and I can't find where.

To understand the problem, there is some inputs:

Entity speed: 0.08 (8%)
Position and DestinationPosition are Vector3 (class) instance, where X, Y and Z are properties.

This is my code:

public void StartUpdateTask(int delay)
{
    Task.Run(async () =>
    {
        const double FrameRatePerSeconds = 0.66666f;
        double previousTime = Environment.TickCount;

        while (true)
        {
            if (this._cancellationToken.IsCancellationRequested)
                break;

            double currentTime = Environment.TickCount;
            double deltaTime = currentTime - previousTime;
            previousTime = currentTime;

            this.GameTime = (deltaTime * FrameRatePerSeconds) / 1000f;

            lock (SyncRoot)
            {
                foreach (var entity in this.Entities)
                    Walk(entity);

                foreach (var mapLayer in this._layers)
                     mapLayer.Update();
            }

            await Task.Delay(delay, this._cancellationToken).ConfigureAwait(false);
        }
    }, this._cancellationToken);
}

mapLayer.Update() method:

public override void Update()
{
    this.GameTime = this.Parent.GameTime;

    foreach (var entity in this.Entities)
        Walk(entity);

    foreach (var region in this._regions)
    {
        if (region.IsActive && region is IMapRespawnRegion respawnRegion)
        {
            foreach (var entity in respawnRegion.Entities)
            {
                Walk(entity);
            }
        }
    }
}

And the calculation formula:

private void Walk(IMovableEntity entity)
{
    if (entity.MovableComponent.DestinationPosition.IsZero())
        return;

    if (entity.MovableComponent.DestinationPosition.IsInCircle(entity.Object.Position, 0.1f))
    {
        entity.MovableComponent.HasArrived = true;
        entity.MovableComponent.DestinationPosition.Reset();
    }
    else
    {
        entity.MovableComponent.HasArrived = false;
        double entitySpeed = entity.MovableComponent.Speed * entity.MovableComponent.SpeedFactor;
        double speed = ((entitySpeed * 100f) * entity.Context.GameTime);
        float distanceX = entity.MovableComponent.DestinationPosition.X - entity.Object.Position.X;
        float distanceZ = entity.MovableComponent.DestinationPosition.Z - entity.Object.Position.Z;
        double distance = Math.Sqrt(distanceX * distanceX + distanceZ * distanceZ);

        // Normalize
        double deltaX = distanceX / distance;
        double deltaZ = distanceZ / distance;
        double offsetX = deltaX * speed;
        double offsetZ = deltaZ * speed;

        if (Math.Abs(offsetX) > Math.Abs(distanceX))
            offsetX = distanceX;
        if (Math.Abs(offsetZ) > Math.Abs(distanceZ))
            offsetZ = distanceZ;

        entity.Object.Position.X += (float)offsetX;
        entity.Object.Position.Z += (float)offsetZ;
    }
}

With this current formula, my players and monsters arrive to destination between 1-2 seconds sooner on the server side compared to the client-side...
Do you have any idea what I'm doing wrong ? Appriciate if someone could guide me and explain me how to solve my problem. :-)

Thank you

sentences:
Cross platforms decoding To advance those coding language and enhance the combination of gameplay device.

Here are a file extension with ".d"

Any compilers would I find for checking if it's able to run?

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:
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:
Is the way I remove objects causing a memory leak? The game I'm working on consumes memory, and the memory used in megabytes increases around 2MB every 4 seconds.

It starts at 5MB and grows to hundreds of megabytes in minutes.

I was careful, and have little to no new variable declarations in the main game loop (and the existing ones are integers and floats, not SDL_Surface's and images).

However, I keep creating new instances of classes, such as bullets and enemies, but I'm also careful with those:

/* Is a bullet out of the screen? Remove it from the list! */
for (i = 0; i < bullets.size(); i++) {
  if (!bullets[i].is_on_screen(screen))
    bullets.erase(bullets.begin() + i);
}

I remove them from the respective vectors when they are no longer needed, and with enemies too:

/* Is the enemy death? Put it out of the array! */
for (i = 0; i < enemies.size(); i++) {
  if (enemies[i].health <= 0) enemies.erase(enemies.begin() + i);
}

Also, I create new Enemy(ies) with an image, but I only load the image on the beginning of the game, and then pass a pointer of it to the newly created class, so that it can draw it. I'm not creating hundreds of new images of enemies and bullets, am I?

When I erase the instances from the vectors, am I not fully deleting them from RAM?

sentences:
Android: Angry Birds Scaling Anyone have any idea how the scaling is accomplished in angry birds?  I want to make sure my images/background always scale to match the screensize and this game seems to have a similar effect.  I have been playing with the manifest settings lot on setting preferred screen sizes but I have yet to duplicate exactly what I want.

Are there any effective ways to make sure your game will always display X Y space, scaling down as needed depending on the pixel size?

I want to make sure everything is always displayed on the screen for all devices and not cut things off on small devices or add black space on large devices.

I am calculating my drawing space by getting the size of the view and using this as bounds for my sprites but it doesn't seem to be working too well.

sentences:
Using seeds for rng. A reliable way of saving bandwidth? Imagine a server-client game application.

While running, the server is constantly generating numbers for various random events and sending them over the network to inform the clients of the result.

I realized it would save alot of bandwidth if I made my rng deterministic and would only transmit a seed value at the start of the game and the number of random calls that have been made on that random instance in the past so that my clients can reproduce a similar random instance and the next generated value will be the same for all clients. Is that a reliable option in terms of security and synchronization and apart from predictability?

sentences:
OpenGl: Error, The loaded object takes the same colors and style of the Texture? I'm new to OpenGl Faced this problem:

Draw function:

void Renderer::Draw()
{

    glUseProgram(programID);
    shader.UseProgram();

    mat4 view = mat4(mat3(myCamera->GetViewMatrix()));
    glm::mat4 VP = myCamera->GetProjectionMatrix()*myCamera->GetViewMatrix();
    shader.BindVPMatrix(&VP[0][0]);

    glm::mat4 VP2 = myCamera->GetProjectionMatrix() * myCamera->GetViewMatrix() * floorM;
    model13D->Render(&shader, scale(100.0f, 100.0f, 100.0f)); // scaling the skybox

    t2->Bind();
    model3D->Render(&shader, scale(2.0f, 2.0f, 2.0f)); //scaling aircraft

    glUniformMatrix4fv(VPID, 1, GL_FALSE, &VP2[0][0]);

    mySquare->Draw();

}

The code of loaded:

    shader.LoadProgram();
    model3D = new Model3D();
    model3D->LoadFromFile("data/models/obj/Galaxy/galaxy.obj", true);
    model3D->Initialize();
    myCamera->SetPerspectiveProjection(90.0f, 4.0f / 3.0f, 0.1f, 10000000.0f);

    model13D = new Model3D();
    model13D->LoadFromFile("data/models/obj/skybox/Skybox.obj", true);
    model13D->Initialize();
    // Projection matrix :
    //shader.LoadProgram();

    // View matrix :
    myCamera->Reset(
        +0.0f, +0.0f, 5.0f,// Camera Position
        +0.0f, +0.0f, +0.0f,// Look at Point
        +0.0f, +1.0f, +0.0f // Up Vector
        );
    //////////////////////////////////////////////////////////////////////////
    std::string Images_names[6];

    Images_names[0] = "right.png";
    Images_names[1] = "left.png";
    Images_names[2] = "top.png";
    Images_names[3] = "bottom.png";
    Images_names[4] = "back.png";
    Images_names[5] = "front.png";
    t = new Texture(Images_names, 0);
    t2 = new Texture("arrakisday_dn.tga", 1);

sentences: Generate planet like heightmaps I would like to procedurally generate planets, but I don't know how to wrap a heightmap around a sphere. I already know how to generate plane heightmaps, but not how to generate spherical ones. Can someone push me in the right direction?

sentences:
Moving two objects proportionally I'm trying to move two objects away from each other at a proportional distance, but on different scales. I'm not quite sure how to do this. Object A can go from position 0.1 to 1. Object B has no limits. If object B is decreasing, then Object A should be decreasing at rate R. Likewise, if Object B is increasing, then Object A increases at rate R. How can I tie these two Object positions together so that in an update loop, they automatically update their positions?

I tried using:

ObjA.Pos.X +=  0.001f * ObjB.VelocityY; //0.001f is the rate

This works but there's an error each time it runs. ObjA starts off at its max position 1 but then the next time it will stop at 0.97, 0.94, 0.91 etc.. This is due to the 0.001f rate I put in. Is there a way to control the rate, yet not end up with the rounding error?

EDIT - To clarify the scenario:
The user can provide a force to  Object B in a vertical motion (2D game). Gravity will bring the object back down once the user lets go of the up/down button. As the object moves up or down, I want object A to move left and right on the X axis. Maximum distance to the right can be '1', and to the left can be '0.1'. Therefore, if the user keeps holding up forever,object A will still only be at 0.1.

  Object A at max 1 = Object B at position 4.5 (this is the starting
  position)

  Object A at min 0.1 = object B at position +/- 9.9

Obejct B does take the game time into account.

sentences:
How can i play animationclip from array of AnimationClip? The original goal is to switch and play each time animation from the Animator.
But not sure if it's possible so i'm trying to play it as animation clips.

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

public class SwitchAnimations : MonoBehaviour
{
    private Animator animator;
    private int index = 0;

    static UnityEditor.Animations.AnimatorController controller;

    // Use this for initialization
    void Start ()
    {
        animator = GetComponent<Animator>();

        GetStateNames(animator);

    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            if (++index == controller.animationClips.Length)
                index = 0;
            Animation clip = controller.animationClips[index];

        }
    }

    private static UnityEditor.Animations.AnimatorState[] GetStateNames(Animator animator)
    {
        controller = animator ? animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController : null;
        return controller == null ? null : controller.layers.SelectMany(l => l.stateMachine.states).Select(s => s.state).ToArray();
    }
}

What i want is to switch between the animation and each time i switch by pressing A it will play the current animation clip.

I'm getting error on the line:

controller.animationClips[index];

Cannot implicitly convert type 'UnityEngine.AnimationClip' to 'UnityEngine.Animation'

Update this is how i'm playing the Animator States:

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

public class SwitchAnimations : MonoBehaviour
{
    private Animator animator;
    private List<AnimationClip> myAnimationComponent = new List<AnimationClip>();
    private int index = 0;
    private static UnityEditor.Animations.AnimatorController controller;
    private UnityEditor.Animations.AnimatorState[] an;

    // Use this for initialization
    void Start()
    {
        animator = GetComponent<Animator>();
        myAnimationComponent = new List<AnimationClip>();

        an = GetStateNames(animator);

        for (int i = 0; i < controller.animationClips.Length; i++)
        {
            myAnimationComponent.Add(controller.animationClips[i]);
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            animator.Play(an[index].name);
            if (++index == an.Length)
                index = 0;
        }
    }

    private static UnityEditor.Animations.AnimatorState[] GetStateNames(Animator animator)
    {
        controller = animator ? animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController : null;
        return controller == null ? null : controller.layers.SelectMany(l => l.stateMachine.states).Select(s => s.state).ToArray();
    }
}

sentences:
Math behind XNA's spriteBatch.draw() color parameter? I'm trying to make a shader that changes the color of a sprite the way the XNA spriteBatch.draw() color parameter changes color. I don't know exactly what it is called (the closest word I can think of is 'tinting' but that's not right I don't think) and it's kind of hard to explain the way it looks.

Say you set the parameter to 'Red' -- white pixels in the original texture would  become completely red, while black pixels would remain black. Grey pixels would look dark red, blue pixels might look purple, green pixels might look brownish.

If you set the parameter to 'Black' the texture would become completely black.

Does anyone know the math behind this, or what this technique is called? It's probably very simple and I'm just not seeing it.

Thanks!

sentences: How can I tune material values with the slider in the Unity inspector more finely? I'm adjusting a material's texture tiling and offset values in the editor but its increments are too large and it's jumping over the value I need. Is there a way to slow it down or adjust the amount it increments by (without using a custom script)?

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:
How to update different constant buffers for different vertices in vertex buffer? Lets say I have vertices and indices for Box and Sphere and I put them into one vertex buffer.
But if I want to use different constant buffers for each of the figures, how would I do that?

As I understand I need to somehow say in VertexShader "Do those calculations for those vertices, and these calculations for these". But to my understanding, shaders don't work that way? Also I can't have two input layouts for each figure (it doesn't even make sense).
I've heard you are not suppose to do it that way these days, better to have different buffers for each figure, but still I want to try it.

sentences:
Voxel engine artifacts There are white little dots between blocks at random places, mainly at very near blocks. They disappear when I move the mouse and change the view direction.

I use Vertex Arrays with glVertexAttributePointer to send the data directly to the shader. The shader only adds some fake light based on the face direction and draws the pixels.

What could be the reason for the small white artifacts?

Chunk render code:

public void renderChunk() {
    glPushMatrix();

    glTranslatef(pos.x*world.chunkSize.x, 0.0f, pos.z*world.chunkSize.z);

    glBindBuffer(GL_ARRAY_BUFFER, vao_id);

    glVertexAttribPointer(world.game.positionAtt, 3, GL_FLOAT, false, 32, 0);
    glVertexAttribPointer(world.game.normalAtt, 3, GL_FLOAT, false, 32, 12);
    glVertexAttribPointer(world.game.texCoordAtt, 2, GL_FLOAT, false, 32, 24);

    glDrawArrays(GL_TRIANGLES, 0, arraySize / 8);

    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glPopMatrix();
}

Vertex Shader:

attribute vec3 in_position;
attribute vec3 in_normal;
attribute vec3 in_texcoord;
varying vec2 texture_coordinate;
varying vec3 normal;

void main()
{
    gl_Position = gl_ModelViewProjectionMatrix * vec4(in_position, 1.0);
    normal = in_normal;
    texture_coordinate = in_texcoord;
}

Fragment Shader:

varying vec2 texture_coordinate;
varying vec3 normal;
uniform sampler2D texture;

void main()
{
    float add;

    if (normal.x == 1.0 || normal.z == 1.0) {
        add = 0.65;
    } else if (normal.y != 1.0) {
        add = 0.8;
    } else {
     add = 1.0;
     }
         gl_FragColor = texture2D(texture, texture_coordinate) * add;
     }

Enlarge the image by click it to notice the artifacts.

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:
Blending between many materials I am storing one material ID per vertex in my meshes. In the shader for the mesh, I have a texture array full of textures that the material ID can refer to. The fragment color is chosen using triplanar texturing. Unlike vertex colors, these material IDs cannot be blended.

For example, if a dirt texture had a material ID of 5, and a grass texture had a material ID of 1, fragments in between one vertex with material ID 5 and one with material ID 1 would potentially have a material ID between 2 and 4, which is not ideal. Another flaw with this method is the fact that there would be a hard transition in between materials, as the mix or lerp function in the shader is not used.

Is there a way to blend the textures of two neighboring vertices in the fragment shader? I can add additional per-vertex data if needed.

sentences:
C# Monogame Enemy shooting at random intervals I am currently coding a simple Monogame Space Shooter.

I have almost finished my enemy shooting behaviour,
but I spent a long time on fixing it and got to the point
where I wanted somebody to help me out.

Okay so basiclly I have my 9 enemies (instances of Enemy class) in my
Level class, and in level update I do stuff like checking if enemy has been hit by player, if they are Dead so I can remove them from the list etc.

I made a simple Timer class that has only 1 function, uses

var timer += GameTime.ElpasedGameTime.TotalMiliseconds

and simply checks if timer is bigger or equal than function input parameter(or argument?), and func is a bool so it then returns T or F.

Now inside my Enemy.cs claas I have this function:

public bool IsShooting()
        {
            if (enemyTimer.Wait(randomFloat))
            {
                shot = true;
                return true;
            }
            else
            {
                shot = false;
                return false;
            }
        }

enemyTimer = new Timer() & randomFloat = field(variable at the top of the class)
in my Enemy class.

And now last but not least(actually the problem here) is this, so now in my Level class I got this little update function:

public void Update(Weapon weapon)
        {
            if (enemies.Count == 0)
                isFinished = true;

            if(!isFinished)
            {
                for (int i = 0; i < enemies.Count; ++i)
                {
                    if (enemies[i].shot)
                    {
                        seconds = rand.Next(1, 10);
                        randMiliseconds = 1000f * seconds;
                    }

                    enemies[i].randomFloat = randMiliseconds;
                    enemies[i].Update();

                    if (enemies[i].isDead == true) // If enemy is dead, remove it from level
                    {
                        enemies.RemoveAt(i);
                        --i;
                    }

                    foreach (Bullet bullet in weapon.bullets)
                    {
                        if ( !(i < 0) && weapon.ShotEnemy(bullet, enemies[i])) // If not enemies count == 0 and if
                        {                                                      // enemy has been shot decrease its health
                            enemies[i].Health -= weapon.Damage;                          // and set bullet visibility to false;
                            bullet.isVisible = false;
                        }
                    }

                }

            }

        }

This for loop goes through all the enemies, first if block is used for checking that
if the enemy has shot the bullet, then set random value again to something different, if shot has not yet been fired then use the old value and wether it has been changed or not it sets randomFloat field in Enemy class to that value.

Now this is how it works: First all of 9 enemies shoot 1 bullet at the same time (Just about when I open the window, cause I putted randomFloat = 1000f; in my Enemy CTOR), and then randomFloat value is set in Level class to something different, I have message output and FOR EVERY DAMN ENEMY randomFloat is the same.... now that is a problem, I want the rand value to be different for all of them, and it should, right?
Becouse those 9 enemies are all different instances of that class and if in each for(;;) loop cycle in my Level.Update() if it gets positive value that enemies[index] has fired a shot it should change it to some number that is very unlikly to be the same for all 9 enemies (seconds = rand.Next(1,20); randomFloat = 1000 * seconds; ). So basiclly randomFloat get random, but it is the same every time for all enemies, and they all shot and will shot at the same random Time

Expected result: Every enemy shooting at different random time

sentences:
OnMouseUp not working in unity A common problem in Unity - my OnMouseUpAsButton() is not being called, and I do not understand why. I have attached box collider 2d (though its size is set up during runtime, but by the time I click on it it has proper size and covers the whole button). My object is an UI element, created from prefab during runtime. Here you can see its inspector info:

Code:

using UnityEngine;
using System.Collections;

public class button_controller : MonoBehaviour {
void OnMouseUpAsButton()
{
    Debug.Log("Clicked event button");
    switch(click_action){
        case action.NONE:
            action_none();
            break;
    }
}

I tried going through other threads where people had similar problems but nothing seems to work. Any ideas what might be happening?

EDIT: I found out that if I add a new button , directly from the inspector to the canvas, whose collider is within the canvas all other buttons start working. Interestingly I cannot put this new button anywhere, it has to be at least a bit within the canvas

sentences:
How to make counter unity? How do I count how many diamonds my player has collected in my 3d world
What I need to do is to make a script which will update my text ui when the player collides with a diamond but I do not know how as I auto generate the diamonds
How could I go about writing a script that will update the text score
What I tried so far, but I'm not sure where to place it. (taken from comment)
void OnTriggerEnter(Collider other) {
   if (other.CompareTag("Diamind")) {
      Debug.Log("Picking up...");
      GetComponent<Counter>().ScoreAmount += 1;
   }
}

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 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:
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:
Error calling a Action Map I tried calling the event Set Destination, simply to make an impression on the game screen:

I did not succeed. I modified the 3 options displayed on the right (consume input / execute when paused / override parent binding), but nothing has changed the result.

Neither change the button that calls the event (from the right to the left or even the middle button).

I created a new input (example):

And I was able to make the impression normally:

Why can not I call the Set Destination?

I need to know a way to send a warning/signal (get reference) when this event is performed.

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:
'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:
Checking collision in an array - is there a better way? MSDN suggested this, but I'm worried about it slowing down the game when there are a lot of objects to check:

for (int i = 0; i < enemy.Length; i++)
{
   if (enemy[i].isActive)
   {
      BoundingSphere enemySphere =
         new BoundingSphere(enemy[i].position,
         enemy[i].Model.Meshes[0].BoundingSphere.Radius *
         enemy[i].modelBoundingConstant);
      for (int j = 0; j < bulletList.Length; j++)
      {
          if (bulletList[j].isActive)
          {
             BoundingSphere bulletSphere = new BoundingSphere(
                bulletList[j].position,
                bulletModel.Meshes[0].BoundingSphere.Radius);
             if (enemySphere.Intersects(bulletSphere))
             {
                enemy[i].health -= 10;
                bulletList[j].isActive = false;

                break; //no need to check other bullets
             }
          }
       }
   }
}

Nested looping like this just doesn't seem like the most efficient way to check if a bullet connects with an enemy. Is there a better way?

sentences:
How to smooth low-res sampling of noise for voxel terrain I am attempting to create a new terrain generator as part of a minecraft mod, which works very well if it samples at the full terrain resolution (16x256x16 voxels per terrain chunk). This is extremely laggy, so i attempted using a lower-resolution sample, x4x64x4, with an extra one sample on each positive axis to interpolate with (5x65x5, representing 20x260x20 space).

It all works fine until i try to smooth out the resulting 4x4x4 cubes of terrain. I have tried interpolating the noise value (0.0 to 2.0) of each block with the value next to it along each positive axis, each value weighted by how close the block is to it.

The result has some smoothing, but some of it seems to be rotated 90 degrees, and some areas are unsmoothed. I know this is possible, minecraft does it internally (the code is illegibly obfuscated and messy, about half a page, 20 variables and 6 loops).

Does anyone have any ideas about a reliable method for smoothing, only knowing the contents of the chunk and one sample to the north/east/top?

my current noise array generator:

protected double[] getNoise(float x, float z)
{
 // get a rough noisemap every 4 blocks, 1 more past the edge to round with
 double[] n = new double[1625]; // x65x5x5 3D space in order y,x,z  represents one chunk at 1/4 precision (1024 blocks plus 601 blocks padding along the positive-axis sides for rounding. Minecraft uses 825 doubles internally, 5x33x5)

 for(int lx = 0; lx < 5; ++lx)
   for(int lz = 0; lz < 5; ++lz)
   {
     // some extra noise that controls terrain thickness along Y
     double m = 32+(1f+SimplexNoiseGenerator.getNoise( (x+(lx*4))/256, (z+(lz*4))/256) )*32;

     for(int ly = 0; ly < 65; ++ly)
     {
       n[ (ly*25) + (lx*5) + lz ]= ( 1f+SimplexNoiseGenerator.getNoise( (float)(x+(lx*4))/512f, ((float)ly*4)/m, (float)(z+(lz*4))/512f ) ) * (1.5f-(Math.abs(32f-ly)/32f) ) ;
     }
   }
   return n;
}

Someone posted this on stack overflow, it is exactly the same problem and seems to be unresolved. https://stackoverflow.com/questions/35852194/smooth-lower-resolution-voxel-noise

sentences: Is there any way to get the HWND from a window in LWJGL? I've started some experimentation in Java and LWJGL (via Slick), and it seems very solid. However, I have some legacy code that requires a HWND integer as a parameter. I'm not sure how I'd be able to get this, or if LWJGL would be able to report this for me. Any help?

sentences:
Computing Normals for a displaced material Disclosure: cross-posted on Unreal Answers, thought was sufficiently general for GameDev.SE

I am currently rendering a displacement texture and, separately, a normal texture for my ocean. Is there a clever way where I can actually just compute the normal in the final material. I.E. the un-displaced normal is (0, 0, 1) then by using perhaps ddx/ddy work out the real normal? It seems like this question is trying a similar thing. I don't really understand the ddx/ddy nodes/functions but they seem at least related.

Using the ddx, ddy nodes what I tried was computing for each given point:

dx = ddx(WorldPosition.x)
dy = ddy(WorldPosition.y)
dz/dx = ddx(height) / dx
dz/dy = ddy(height) / dy

Then I used these values to rotate my base normal of (0, 0, 1) to the final normal. It kinda looks like I'm on the right track but I not 100% calculation at a couple of points. Further, it isn't quite right as the normal appears to change as I move the camera around (using the world normal buffer visualisation).

Calculation:

let Tan(theta) = dz / dx
let Tan(phi) = dz / dy

Then plugging these values into the rotation matrix R_theta, R_phi:

\$R_\theta=\begin{pmatrix}
1 & 0 & 0 \\
0 & cos(\theta) & -sin(\theta) \\
0 & sin(\theta) & cos(\theta) \\
\end{pmatrix}
R_\phi=\begin{pmatrix}
cos(\phi) & 0 & sin(\phi) \\
0 & 1 & 0 \\
-sin(\phi) & 0 & cos(\phi) \\
\end{pmatrix}\$

I compute theta and phi by applying atan to dz/dx and dz/dy respectively.
Finally multiplying R_thea * R_phi * n to get:

sin(phi)
-sin(theta)cos(phi)
cos(theta)cos(phi)

Is what I am trying to do possible and what am I doing wrong? Specifically:

Am I using the ddx, ddy nodes correctly to compute the change in height over x and y
How come the normal appears to change as I move the camera
Does the fact there is horizontal displacement in my ocean matter

sentences:
Have button style not change when down I'd like the button style to only change when it is checked and not change when it is pressed down, and/or have only the font color change. I'm using the built in Skin function with a .json file, however, that only allows for the up, down, and checked states, along with font color. Is this possibly? If yes, how? If not, then I'll just extend the Button class to add that functionality.

EDIT
I have currently just decided to go with a neutral "down" state, but I would still like to know if what I asked is possible.

sentences:
Error : No default constructor exists for "Sprite" What i want to do is make the Player class inherit the Sprite class.

So I inherited it like this :

class Player: public Sprite {};

But when I go to my Player.cpp I get the following error :

  Error : No default constructor exists for "Sprite".

But it does have a constructor (well, 2 of them...) :

Sprite(int index, sf::Vector2f position);
Sprite(int index, sf::Vector2f position, float rotation);

Also, not sure if this is the right place to post this. But since it contains SFML library code I will post it here.

sentences:
GLSL - Signed Distance Field vs normal Loop I am fairly new in GLSL and only recently discover Signed Distance Field. I am trying to figure out how SDF can perform so well when you use mod() function to repeat but badly when you use for loop function.
I got a feeling that in for loop function, the ray marching is repeat as many times as the loop itself, but when using mod(), it only perform once. Can somebody explain in more detail how this works?

UPDATE1:

This is the mod() function:

float map( vec3 p )
{
    p.x=mod(p.x+3.0,6.0)-3.0;
    p.y=mod(p.y+3.0,6.0)-3.0;
    p.z=mod(p.z+3.0,6.0)-3.0;
    return box( p, vec3(1.,1.,1.) );
}

and Here is the for() loop function:

float map( vec3 p )
{
    p.yz = rotate(p.yz, mouse.y*10.);

    float b = box( p, vec3(1.,1.,1.) );
    float aa = b;

    for(int i=0; i<5; i++)
    {
    float off = float(i);
    vec3 q = p+off*.5;
    q.xz = rotate(q.xz, -mouse.x*off*12.);
    float c = box( q, vec3(off,1.,1.) );
    aa = fOpUnionRound(aa,c,.5);
    }
    return aa;
}

sentences:
Creating Slide-In Text I want to make my text slide like so:

This is from the game "Crossy Road". The movement is normally smoother that in the .GIF

Here are some more frames from the GIF to make you understand what I mean:

I'm sorry for the bad formatting, I need at least 10 reputation to post more than 2 links.

The text and the orange background seem to "expand" while moving smoothly to the right.

sentences:
gpu_rotate a texture2d or rendertexture How does one gpu rotate a Texture2D or RenderTexture using Unity c#? Or, is that possible?

I think it might be something like this...
I'm also trying to understand how gpu_scale seems to work here?

    // Internal unility that renders the source texture into the RTT - the scaling method itself.
    static void _gpu_scale(Texture2D src, int width, int height, FilterMode fmode = FilterMode.Trilinear)
    {
        //We need the source texture in VRAM because we render with it
        src.filterMode = fmode;
        src.Apply(true);

        //Using RTT for best quality and performance. Thanks, Unity 5
        RenderTexture rtt = new RenderTexture(width, height, 32);

        //Set the RTT in order to render to it
        Graphics.SetRenderTarget(rtt);

        //Setup 2D matrix in range 0..1, so nobody needs to care about sized
        GL.LoadPixelMatrix(0, 1, 1, 0);

        //Then clear & draw the texture to fill the entire RTT.
        GL.Clear(true, true, new Color(0, 0, 0, 0));
        Graphics.DrawTexture(new Rect(0, 0, 1, 1), src);
    }

Edit:

The input image is rotated 90 degrees ccw to fit in the left part (replacing the beige with pink dots) of this texture (no alpha is needed). If you want some numbers, it's a rect from 0,0 to new Vector2(794, 1024):

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:
Continuous weighted random distribution, biased toward one end I am currently contributing to a particle system for our game and developing some emitter shapes.

My uniform random distribution along a line or along a rectangular area works fine - no problem.

But now I would like to have something like a 1 dimensional gradient in this distribution.
This would mean for example lower values are more common than higher values.

I don't know what would be appropriate mathematical terms for this problem, so my search skills are rather useless with this one. I need something that is computationally simple, as the particle system needs to be efficient.

sentences:
Water wave simulation I'm having a strange behavior simulating water waves. It works perfectly with directional waves, but point waves don't work like expected. If i do not normalize the directional vector(WoldPosition - waveCenter), it works like this:

Which would be nice if i would want to display 10 point waves, but i just added one point wave(the center one). And if i do normalize the directional vector, it looks like this:

Which is not even close of what a point wave should look like.

Do you have any idea of what could be the problem?

This is the formula used to calculate the heights of the waves:

amplitude * sin(dot(direction,vec2(x,z))*w + deltaTime*phase);

Vertex shader:

#version 330

layout (location = 0) in vec3 Position;
layout (location = 1) in vec2 TexCoord;
layout (location = 2) in vec3 Normal;

uniform mat4 gWVP;
uniform mat4 gWorld;
uniform float gMatSpecularIntensity;
uniform float gSpecularPower;
uniform vec3 eyePoint;
uniform float deltaTime;

out vec2 TexCoord0;
out vec3 Normal0;
out vec3 WorldPos0;
out vec2 Specular0;
out vec4 wvp;
out float relativeFactor;

const float w = 1.2f;
const float amplitude = 0.1f;
const float phase = 2.2f;

vec3  wavePosition = vec3(20,0,20);

float CalculateHeight(float x, float z, vec2 direction)
{
    return amplitude * sin(dot(direction,vec2(x,z))*w + deltaTime*phase);
}

vec3 CalculeNormal(float x, float z, vec2 direction)
{
    float heightR = CalculateHeight(x-1,z,direction);
    float heightL = CalculateHeight(x+1,z,direction);
    float heightU = CalculateHeight(x,z+1,direction);
    float heightD = CalculateHeight(x,z-1,direction);
    return normalize(vec3((heightR - heightL),1, (heightU - heightD)));
}

void main()
{
    wvp            = gWVP * vec4(Position, 1.0);
    gl_Position    = wvp;
    TexCoord0      = TexCoord;
    WorldPos0      = (gWorld * vec4(Position, 1.0)).xyz;

    vec2 direction = (wavePosition-WorldPos0).xz;

    gl_Position.y  += CalculateHeight(WorldPos0.x,WorldPos0.z,direction);
    Specular0      = vec2(gSpecularPower,gMatSpecularIntensity);
    relativeFactor = dot(normalize(eyePoint - WorldPos0),vec3(0,1,0));

    Normal0        = CalculeNormal(WorldPos0.x,WorldPos0.z,direction);
    relativeFactor = clamp(relativeFactor, 0.0, 1.0);
}

Variables:

direction: Vector which defines the direction of the wave. It is
perpendicular to the wave front.
x: Position x in world coordinates.
z: Position z in world coordinates.
amplitude: The amplitude of the wave
phase: The phase of the wave
deltaTime: The total time passed in ms.
gWVP: Camera perspective matrix * Camera view matrix * Water transformation matrix (position matrix * rotation matrix(no rotation) * scale matrix)
gWorld: Water transformation matrix (position matrix * rotation matrix(no rotation) * scale matrix)

The fragment shader and the other variables do not influence in the displayed wave, it just combine the reflextion + refraction image + apply the fresnel efect.

For more info about the wave function: http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html

sentences:
unity job system for 2d or more dimmension arrays? I need to send a 2d array to a job system but execute function of IJobParallelFor just accepts one dimension. This is the example:

public  struct CalculateJob : IJobParallelFor
    {
        public NativeArray<Vector3> vertices;

       public int rows;
       public int x, y;

        public void Execute(int i)
        {

        }
    }

sentences:
Unity Problem with colliding instances of same object I want to check if object's instance is overlapping with another instance (any spawned object with another spawned object, not necessary the same object). I'm doing this by detecting collisions between bodies. But I have a problem. Spawned object (instances) are detecting collision with everything but other spawned objects. I've checked collision layers etc. All of spawned objects have rigidbodies and mesh colliders. Also when I attach my script to another body and I touch that body with an instanced object it detects collision. So problem is visible only in collision between spawned objects. And one more information I have script, rigid body and collider attached to child of main object.

    using UnityEngine;
using System.Collections;

public class CantPlace : MonoBehaviour {

    public bool collided = false;
    // Use this for initialization
    void Start () {

    }

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

    void OnTriggerEnter(Collider collider) {
                //if (true) {
                        //foreach (Transform child in this.transform) {
                        //              if (child.name == "Cylinder") {

                                //collided = true;
                                Color c;
                                c = this.renderer.material.color;
                                c.g = 0f;
                                c.b = 1f;
                                c.r = 0f;
                                this.renderer.material.color = c;
                                Debug.Log (collider.name);
                        //}
            //  }
                //}

        //foreach (ContactPoint contact in collision.contacts) {
    //      Debug.DrawRay(contact.point, contact.normal, Color.red,15f);
    //  }

    }
}

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:
Lunar lander: How to calc acceleration in each step I'm trying to make a lunar lander simulator. I'm going to use a simple Euler integration. AFAIK all I've to calculate is the acceleration in each step, and then I should be able to update velocity and position.

I'm following this page:
http://www.braeunig.us/apollo/LM-descent.htm

There's a paragraph I don't really understand:

  Although most operations are self-explanatory, a brief description of
  acceleration is warranted. Acceleration is broken down into vertical
  and horizontal components, where the vertical component is normal to
  the Moon's surface. The instantaneous vertical and horizontal
  accelerations of a moving body in reference to this surface are
  Av=Vh^2/r and Ah=–VhVv/r. To this we add the accelerations resulting
  from gravity and thrust. Gravity, of course, acts vertically downward.
  The vertical and horizontal components of thrust are a function of the
  pitch angle.

The author is making a much more realistic simulation here and because of that he is not assuming the Moon is flat. He comes up with two initial values for each acceleration component:

    Av=Vh^2/r

    Ah=–VhVv/r

1- Seems that Av is the centripetal acceleration, but where does the Ah come from?

2- Are those initial values really needed? In my game the Moon is going to be flat. I thought taking into account thrust/mass and gravity would suffice.

Thanks in advance.

sentences:
Unity procedural TileMap generation without creating gameobject per tile I've been searching internet to find an efficient way to create a procedural tilemap without creating a GameObject per tile.
All the TileMap tutorials I've found are creating tiles by creating hundreds of GameObjects. Thus the hierarchy in Unity is expanding unexpectedly.

I'm pretty sure this is not the "right" way to do it. Especially after seeing the new Unity 2D tools that supports tilemaps. Unity made it so, you can create tiles in "one" gameobject, not for each tile.

So, how do I do it in the right and effiecent way?

sentences:
When I use rigidbody.move rotation, my player sinks I am trying to implement a simple movement on an object and when I use movePosition from rigid body, the player starts to sink:

How can I resolve this issue?
Below is my code.
void Update()
{
    Movement();
    MouseLook();
}

void MouseLook()
{
    //get X movement of mouse and save as float y
    //get Y movement of mouse and save as float x
    float _xMove = Input.GetAxis("Mouse Y") * mouseSensetivity * Time.deltaTime;
    float _yMove = Input.GetAxis("Mouse X") * mouseSensetivity * Time.deltaTime;

    //make vector of that movements
    Vector3 xLook = new Vector3(_xMove, 0f, 0f);
    Vector3 yLook = new Vector3(0f, _yMove, 0f);

    //apply Y vector to body and rotate it entirely
    _rigidBody.MoveRotation(_rigidBody.rotation * Quaternion.Euler(yLook));
    //apply X vector on camera to rotate it.
    _camera.transform.Rotate(-xLook);
}
void Movement()
{
    //Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    //_charController.Move(move * Time.deltaTime * WalkSpeed);

    //register x axis movement
    //register y axis movement
    float _xWalk = Input.GetAxisRaw("Horizontal");
    float _zWalk = Input.GetAxisRaw("Vertical");

    //Make vectors
    Vector3 _WalkSum = (transform.right * _xWalk + transform.forward * _zWalk).normalized;

    //feed this to Move position of rigid body
    if (_WalkSum != Vector3.zero)
    {
        //_rigidBody.velocity=transform.forward+_WalkSum;
        //_rigidBody.AddForce(_WalkSum*WalkSpeed);
        //_rigidBody.MovePosition(_WalkSum);
        _charController.Move(_WalkSum * WalkSpeed * Time.deltaTime);
    }
}

sentences:
Excluding Background from Color Picking I've implemented picking based on color coding, but I don't want the background color to be pickable. Is there any way in openGL (2.x) to exclude the background color? For some reason, doing glClear(GL_COLOR_BUFFER_BIT) just before rendering in "color picking" mode, excludes the background in windows but not in Linux.

I'm using glut btw.

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: Does the license of games made with Game Maker need to include the Game Maker part? In the default license generated by Game Maker for your games, some of YoYo Games stuff is mentioned. Are those necessary to be shipped with an application made with GM? Is it legally ok if I remove those and create my own license agreement, not mentioning Game Maker or YoYo Games in it?

sentences:
Which techniques to study? Just to give you some background info, I'm studying a programming major at a tertiary level and am in my third year, so I'm not a newbie off the street. However, I am still quite new to game programming as a subset of programming. One of my personal projects for next semester is to design and create a 2D platformer game with emphasis on procedural generation and "neato" effects (think metroidvania). I've written up a list of some techniques to help me improve my personal skills (using XNA for the time being). The list is as follows:

QuadTrees:
Build a basic program in XNA that moves basic 2D sprites (circles and squares) around a set path and speed and changes their colour when they collide.
Add functionality to add and delete objects of different sizes (select a direction and speed when adding and just drag and drop them in).
Particles:
Build a basic program in XNA in which you can select different colours and create particle effects of those colours on screen by clicking and dragging the mouse around (simple particles emerging from where the mouse is clicked).
Add functionality where you can change the amount of particles to be drawn and the speed at which they travel and when they expire. Possibly implement gravity and wind after part 3 is complete.
Physics:
Build a basic program in XNA where you have a ball in a set 2D environment, a wind slider, and a gravity slider (can go to negative for reverse gravity). You can click to drag the ball around and release to throw it and, depending on what you do, the ball interacts with the environment.
Implement other shapes afterwards.
Random 2D terrain generation:
Build a basic program in XNA that randomly generates terrain (including hills, caves, etc) created from 2D tiles.
Add functionality that draws the tiles from a tileset and places different tiles depending on where they lie on the y-axis (dirt on top, then rock, then lava, etc).
Randomised objects:
Build a basic program in XNA that, when a button is clicked, displays a randomised item sprite based on parameters (type, colour, etc) with the images pulled from tilesets.
Add the ability to save the item as an object, which stores it in a side-pane where it can be selected for viewing.
Movement:
Build a basic program in XNA where you can move an object around in an environment (tile-based) with a camera that pans with it. No gravity.
Implement gravity and wind, allow the character to jump and fall with some basic platforms.

So my question is this: Are there any other commonly used techniques that I should research, and can I get some suggestions as to the effectiveness of the techniques I've chosen to work on (e.g., don't do QuadTree stuff because [insert reason here], or, do [insert technique here] before you start working on particles because [insert reason here])?

I hope this is clear enough and please let me know if I can further clarify anything!

sentences:
What is the Default Pawn class and what is used for in Unreal Engine? I'm newbie in Unreal Engine and also in games development.

I have developed my own version of Pong game (sources here) and I'm confuse with the behaviour of DefaultPawnClass: Its creating another Paddle in game (I posted a question about it here).

I have to questions:

What is Default Pawn class?
And, what is it used for?

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:
Broad topics needed for teaching game development I am going to be doing a presentation on game development to an iPhone user group in the near(ish) future. My audience are iPhone developers, but not necessarily very experienced ones, and this is meant to be an introduction.

My question is, what broad topics are needed to understand game development? I acknowledge that this is fairly subjective, but I really am hoping for a comprehensive list of high-level topics that apply to a broad enough swath of games that anyone interested in the topic SHOULD know about them. I would be ecstatic with some pointers to any resources that attempt to make a list such as this this. (I have looked, but my google-fu is failing me tonight.)

Here's what I have so far:

The Game Loop

a sub-note about event driven games

2D Animation

sprites/texture maps

3D Animation

importance of frameworks
modeling software

Particles and particle effects
hit detection
AI

Obviously I will not be covering all these topics with any depth, more like simply defining them so that after my talk, the audience will (hopefully) be able to wrap their heads around how any given game might be developed.

What am I missing?

sentences:
MMORPG - Auction House and Bank Primary Keys On to the next... So I've been sitting with the idea of how to better future proof my database tables when it comes to things like auction houses, inventories and banks.

Q: Is it really necessary to have a primary key value in an auction-house / bank tables? I've already got a link going to the characters ID as well as the item ID.

The reason I'm asking this is because if I use a primary key value of type int or long, what will happen if there are too many entries for type int or long to handle? I'm planning on removing the DB entry as soon as the item is sold, but wouldn't "auto increment" just carry on from the last ID value used?

In short, what would be the down side to not using primary keys in those tables?

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: LibGDX change screen after 2 seconds Ive tried using a timer in the render method but that just crashes my game, so how do I change screens after a certain amount of time after rendering.

sentences:
Idle/Clicker games, supporting numbers many factors bigger than trillions in C# using Unity Apologies for sloppy work and probably a poor grasp of fundamentals.

I have a (likely primitive) way to convert the ever increasing number values of my enemy hp into a string format to display in game. (K for thousands, M for millions, B for billions etc)

 if (target_healthmax >= 1000)
     {
         if (target_healthmax >= 1000000000)
         {
             enemy_hp_text.text = "Health: " + (target_healthcur * 0.000000001f).ToString("#.00") + "/" + (target_healthmax * 0.000000001f).ToString("#.00") + "B";
         }
         else
         {

             if (target_healthmax >= 1000000)
             {
                 enemy_hp_text.text = "Health: " + (target_healthcur * 0.000001f).ToString("#.00") + "/" + (target_healthmax * 0.000001f).ToString("#.00") + "M";
             }
             else
             {
                 enemy_hp_text.text = "Health: " + (target_healthcur * 0.001f).ToString("#.00") + "/" + (target_healthmax * 0.001f).ToString("#.00") + "K";
             }
         }
     }
     else
     {
         enemy_hp_text.text = "Health: " + target_healthcur + "/" + target_healthmax;
     }

but I stopped here after I noticed that although I could convert long numbers I would eventually hit a number too large to handle such as "-2.147484e+09" in my editor, and it would stop working.

I am using floats currently, is there a different type of variable that handles this easily? if not, what is an efficient way of solving this?

Would it be efficient to convert every new factor of 100 to a new variable and only handle the highest valued variable?
eg

if num >= 1000, k += 1, num = 0;

 if k>= 1000, m += 1, k = 0;
 ...

(Please feel free to let me know anything about my post I may need to amend, I am new here)

sentences:
Build pipleine between 2 points take rotation into account Given a start point and start rotation and end point and end rotation, how can i find a path from start to end, that takes rotation into account and moves only on the axis. I currently have a code that can handle straight line and a L turn. I want it to be able to handle also S or U turn (like on this image), but i cant figure out how to do it. Below is my current code for handling the pipleine building.
How do different games handle that? Like satisfactory fluid pipes on vertical mode.
 Vector3 endPos = endPosition;
        Vector3 startPos = startPosition;
        Vector3 dir = startRotation * Vector3.forward;
        Vector3 diff = endPos - startPos;

        Conveior prev = startTarget;
        int dist1 = Mathf.RoundToInt(Vector3.Scale(diff, dir).magnitude);

        BuildStraight(dist1, ref startPos, dir, startRotation, ref prev);
        Vector3 endDir = endRotation * Vector3.forward;
        GameObject temp;
        if (dir != endDir)
        {
            temp = GameObject.Instantiate(turnRight, startPos, Quaternion.AngleAxis(Vector3.Angle(prev.transform.right, endDir), dir) * startRotation);
        }
        else
        {
            temp = GameObject.Instantiate(straight, startPos, startRotation);
        }
        temp.GetComponent<RaycastController>().dontIgnoreRaycast();
        temp.transform.Find("DirectionGuides").gameObject.SetActive(false);
        Conveior t = temp.GetComponent<Conveior>();
        if (prev != null)
        {
            prev.SetNext(t);
        }
        prev = t;

        diff = endPos - startPos;
        int dist2 = Mathf.RoundToInt(Vector3.Scale(diff, endDir).magnitude);
        startPos += endDir;

        BuildStraight(dist2, ref startPos, endDir, endRotation, ref prev);
        if (endTarget)
        {
            prev.SetNext(endTarget);
        }

    private void BuildStraight(int distance, ref Vector3 startPos, Vector3 dir, Quaternion rotation, ref Conveior prev)
{
    for (int i = 0; i < distance; i++, startPos += dir)
    {
        GameObject go = GameObject.Instantiate(straight, startPos, rotation);
        go.GetComponent<RaycastController>().dontIgnoreRaycast();
        go.transform.Find("DirectionGuides").gameObject.SetActive(false);
        Conveior c = go.GetComponent<Conveior>();
        if (prev != null)
        {
            prev.SetNext(c);
        }
        prev = c;
    }
}

sentences:
Level design community help? I'm developing a 2D physics platformer game, with commercial purposes. Almost everything is finished:

An original game concept
The whole 2D self-written game engine
A level interpreter to read xml levels
A level editor with an advanced GUI to generate levels in xml
An advanced level object system
Profile manager (load & save game progress)
etc ...

But, my problems are of course inspiration for levels...

Is it possible to publish my game concept and ask community for level designs? And still keep my game concept save from being copied by others. Do I have copyrights on a game concept for a game which isn't officially released?

And if I should ask community, should I do an action like, for everyone who submits an approved level design (not the xml, but only a sketch), they receive one cent per sold copy of the game?

What do you think? Tips, pitfalls?

Thank you in advance!

For the interested people, here is a screenshot from the level-editor:

Fullscreen image

sentences:
How can I export the opacity of a mesh per keyframe? I'd like to export opacity of mesh materials on a per-keyframe basis from 3DS Max using a script. How can I accomplish this?

(This is basically extension to my previous question.)

sentences:
Hardware acceleration for the Flash Player What do we know about hardware acceleration for drawing operations in Flash? I know that since 10.1 it's there for video playback (and mobile graphics) but that doesn't really help with rendering desktop game graphics.

So, is there any information about it, or maybe talk or rumours going around? Do you think it's something we'll get at all within a reasonable period?

I personally really keep hitting the ceiling with Flash' software renderer. A game scene that, were it hardware accelerated, my PC from 2003 could render while sleeping, runs at a low 20 fps on my quad core laptop. It's a shame because the Flash VM is otherwise rather fast.

Or maybe I am wrong and Flash is already using the GPU, and my games are slow for other reasons?

sentences: Does game development have its own types of modeling? In general computer science there are modeling "languages" (read: standardized diagramming techniques) such as UML 1,2, in databases there are things like ERD3, in business there are other types such as BPMN4,5. Is there anything like these that are Game Design specific?

sentences:
Need help accessing booleans from other script Unity3D I'm making an endless runner game where platforms move towards the player so it makes it seem like the player is running across them. I'm trying to make it so that when the player dies, the platforms stop moving. What I have isn't working, when the player dies, the platforms just keep moving as if nothing has happened. Here is the script I have that is attached to the player:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;

 public class CoinColliderScript : MonoBehaviour
 {
     void OnTriggerEnter(Collider target)
     {
         if (target.tag == "Enemy")
         {
         StartCoroutine(Died());
         }
     }

     IEnumerator Died()
     {
         PlatformMover.dead = true;
         gameObject.GetComponentInParent<Animator>().Play("Male Died");
         yield return new WaitForSeconds(0.5f);
         SceneManager.LoadScene("MainMenu");
     }
 }

Here is the script I have that is attached to the platforms:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlatformMover : MonoBehaviour
{
    private Vector3 newPlatPos;

    public float platMoveSpeed;

    public static bool dead;

    public void Start()
    {
        dead = false;
    }

    void Update()
    {
        if (dead)
        {
            newPlatPos = new Vector3(transform.position.x, transform.position.y, transform.position.z);
        } else if (!dead)
        {
            newPlatPos = new Vector3(transform.position.x, transform.position.y, transform.position.z - platMoveSpeed);
        }
        transform.position = newPlatPos;
    }
}

New Code:
Attached to platforms:
public class PlatformMover : MonoBehaviour
{
    private Vector3 newPlatPos;

    public float platMoveSpeed;

    void Update()
    {
        if (!CoinColliderScript.Dead)
        {
            newPlatPos = new Vector3(transform.position.x, transform.position.y, transform.position.z - platMoveSpeed * Time.deltaTime);
        }
        transform.position = newPlatPos;
    }
}

Attach to player:
public class CoinColliderScript : MonoBehaviour
{
    private static bool dead = false;
    public static bool Dead
    {
        get => dead;
        set
        {
            dead = value;
            print("'Dead' changed to " + value);
        }
    }

    void OnTriggerEnter(Collider target)
    {
        if (target.tag == "Enemy")
        {
            StartCoroutine(Died());

        }
    }

    IEnumerator Died()
    {
        dead = true;
        gameObject.GetComponentInParent<Animator>().Play("Male Died");
        yield return new WaitForSeconds(0.5f);
        SceneManager.LoadScene("MainMenu");
    }
}

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:
Unity Animator State Freezing I am really new with Unity, I am making a game, but I am having some problems with the animators, my problem is that I am trying to add some animations to my menu, and also add new characters to my game, but none of my new animations are working. This question is the same like these ones :

http://answers.unity3d.com/questions/717046/animator-state-freezing-blue-bar-progress-bar-not.html

http://answers.unity3d.com/questions/778616/animator-state-freezing.html

The animator freezes when I run the game.

What is really interesting is that the first animation that I created in the game works correctly. I have tried several things, but nothing works. I really need help with this.

I'm using several plug ins on this development: facebook, ngui and admod

This is the list of things that I tried:

Create a new level, without any ngui component. I added a new animator to an empty game object and I created a sprite animation.
I tried to move the whole project to a new one, the result was the same problem.
I added a the animator to the object programmatically using a script. It correctly added the animator, but the result was the same.
I tried to change properties of the project, but It seems to not work at all.
I started a new project and followed the same steps to add the same animation, in the project everything works, but I want to avoid to created the whole project again It will take me a lot of time since I have to recreated everything to ensure this problem will not happened again.

As an addition I want to mention that in the beginning everything works correctly but suddenly the animations stopped working. As I say there is only one animator that is working, and this one was the first one that I created.

sentences:
How to draw to a surface, then draw that surface to the screen i have a 2D MonoGame Game (using DirectX), that was originally an XNA game. It involves prerendered shadows (they are Texture2Ds drawn with SpriteBatch.draw). Right now the shadows are being drawn with an alpha value, so overlapping shadows appear darker. This is NOT what i want. Overlapping shadows should be the same shade of black.

So what i want to do is draw all these shadows to a surface, such that the shadows are completely black (alpha == 255), and the surface background is completely transparent (alpha == 0), and then take that surface and draw it to the screen using Color.White*0.25f to give alpha to the shadows at the end.

I'm not sure how to switch rendering targets, or whatever the terminology is, and go about this. Can someone help?

what ive tried so far:

GraphicsDevice.SetRenderTarget(RENTAR); // RENTAR is the name of my RenderTarget2D
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; // not really sure what this does but it was in examples
GraphicsDevice.Clear(Color.White*0.0f); // i clear it with a totally transparent white background, in other words, white with alpha == 0

// now draw shadows normally, but instead of Color.White*0.25f, i use Color.White so that the black shadows are drawn completely black, with no alpha

GraphicsDevice.SetRenderTarget(null); // switch render target back to the screen
SpriteBatch.Draw(RENTAR, new Rectangle(0, 0, 800, 600), Color.White*0.25f); // see i added the "*0.25f" to try to draw this texture with alpha, but it comes out totally blank

So all of this works except that the shadows end up being completely black. I want them completely black in the RenderTarget, so that they dont overlap with any darker shades, and then i want to draw the final RenderTarget on the screen with an alpha of 0.25f, hence "Color.White*0.25f" in the final spritebatch draw. But its as if that 0.25f doesn't exit.

sentences: Is it possible to render part of the screen in different pixel density using openGL? Say I have an openGL screen and I want to render part of the screen in different pixel density than the whole screen pixel density. Is it possible and if possible how?

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:
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:
Set parent by property In the editor's hierarchy, if I drag and drop one object onto another, the second becomes the parent of the first, and moving the parent will cause the child to move. I see I can set this relationship in code by setting the transform.parent property. So I wrote a component to help with doing that from code:

public class ParentTo: MonoBehaviour
{
    public GameObject _parent;

    public GameObject Parent {
        get { return _parent; }
        set {
            this.transform.parent = value.transform;
            this._parent = value;
            Debug.Log("Set parent");
        }
    }
}

So to test it, I have 2 cubes in the scene. On cube 2 I put the ParentTo script, leaving it with no parent set, then start the game and use the editor to drop Cube 1 on that field in the inspector. According to the inspector, it seems to have been set right, but the debug statement doesn't appear in the console and moving Cube 1 doesn't move Cube 2. What am I doing wrong?

sentences:
Java game design question (graphical objects) I'm beginner in game development, in Java and here on this site too and I have a game design question. Please comment my idea:

I have a main loop which call update and draw method. I want to use an ArrayList which stores graphical objects, they have coordinate and image or text to draw and my game objects extends this class. In update, I can choose which objects should be put in the array and in draw method I'll display the elements of array on the screen. I'm using a buffer and draw first there.  Here is a simple (not full) code, only the logic:

public class GamePanel extends JPanel implements KeyListener
{
   ArrayList<graphicalObjects> graphArray = new ArrayList<graphicalObjects>();

   public void update()
   {
      //change the game scene, update the graphArray, process input etc.
   }

   public void draw()
   {
      //draws every element of graphArray to a JPanel
   }

   public static main(String[] args)
   {
      while(true)
      {
          update();
          draw();
      }
   }
}

My questions:

Should have I use interface or abstract class for graphicalObjects? graphicalObjects class and the ArrayList really needs or there is some better solution?
How to draw objects? They draw themself with their own method or in the draw method I have to draw manually based on graphicalObjects variables (x,y coordinates, image etc.)?
If this conception is wrong, please suggest another one!

sentences:
Extract formula from vector drawing I am creating a game with HTML5 canvas for browser. I want to create animations with many shapes, which would be drawed with canvas, not from spritesheets.

The problem i face now is - to create formulas for so many shapes. I need them resizeable, also different width/height ratio. I was drawing chess pawn, but took 1 week to complete it right using arc's.

This is that pawn formula:

function pawn_shape(ctx, xx, yy, fill, stroke, grid_size) {
  var g = grid_size / 100;
  g *= 0.8;
  ctx.lineWidth = grid_size / 10;
  xx += g * 12;
  yy += g * 10;
  ctx.fillStyle = fill;
  ctx.strokeStyle = stroke;
  ctx.lineJoin = "miter";

  ctx.beginPath();

  var x = xx + 50 * g;
  var y = yy + 25 * g;
  var radius = 10 * g;
  var startAngle = 0.8 * Math.PI;
  var endAngle = 2.2 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 55 * g;
  y = yy + 48 * g;
  radius = 15 * g;
  startAngle = 1.6 * Math.PI;
  endAngle = 2.4 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 50 * g;
  y = yy + 97 * g;
  radius = 35 * g;
  startAngle = 1.7 * Math.PI;
  endAngle = 1.955 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 30 * g;
  y = yy + 92 * g;

  ctx.lineTo(x, y);

  x = xx + 50 * g;
  y = yy + 98 * g;
  radius = 35 * g;
  startAngle = 3.055 * Math.PI;
  endAngle = 3.3 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 45 * g;
  y = yy + 48 * g;
  radius = 15 * g;
  startAngle = 2.6 * Math.PI;
  endAngle = 3.4 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);
  ctx.stroke();
  ctx.fill();
  ctx.closePath();
}

This is only 1 pawn. I need many more figures as configurable formulas.
What would be the ways to get faster such formulas?

So far I am thinking about a new open source project, where people could draw shapes and these would be converted into such formulas. Or maybe even extract formulas from simple images, like programs do image to vector.

Another idea was to find out how does normal vectors work - what formulas they have. Maybe i could reuse and modify that? No idea, hoping to find answer here..

sentences:
Where should I put my drawing code Possible Duplicate:
  Should actors in a game be responsible for drawing themselves?

How can I refractor the following, to move my drawing functions from the h-file into a GraphicsManager class?

I have the following scenario:

//drawingFunctions.h
void drawTexturedQuad( Texture texture, Vector2 pos, Vector2 dim) {
    // bind texture...
    glBegin(...);    // draw
    //...
    glEnd(...);
}

#include "drawingFunctions.h"
class Player {
    void drawPlayer(){ drawTexturedQuad( texture, pos, dim) }
};
class Enemy {
    void drawEnemy(){ drawTexturedQuad( texture, pos, dim) }
};
class Item {
    void drawItem(){ drawTexturedQuad( texture, pos, dim) }
};
// and so on for the other  components, you get the idea...

I figured I could make all these classes extend another class, say drawableGameComponent. Would that be a good idea? What are other suggestions?

sentences:
updating 2d array to contain chunk of larger 2d array - for 2d tile map What i need help with is how can i get a chunk of a large 2d char array and update it so i am only drawing enough tiles to cover the screen?

Currently, i load all the chars from a text file and store them in an array. I then create a smaller array:char[][] toDraw = new char[height][width] which gets the first height*width area of chars from the larger array like this:

  public void filterMap() {
    for(int i = 0; i < height; i++) {
        for(int j = 0; j < width; j++) {
            toDraw[i][j] = MapLoader.mapData[i][j];
        }
    }
}

I then draw the map using this drawMap method:

public void drawMap(Canvas canvas) {
    for(int i = 0; i < height; i++) {
        for(int j = 0; j < width; j++) {
            if(getBitmap(toDraw[i][j]) != null) {
            canvas.drawBitmap(getBitmap(toDraw[i][j]), x + (j*tileSize), y + (i*tileSize), null);
            }
        }
    }
}

note the int x and y are what i increment to move the map, getBitmap(char c) returns a Bitmap from a char, MapLoader.mapData is the 2d array that the text file loads into.

I have tried a few ways of using an offset in the toDraw arrays index to scroll the data relevant to the x,y location but they have been buggy/failed.

So, does anybody have a link to how things like this can be done (I have tried but have found none that help) or could someone with experience in 2d games please tell/show me how this should be done.

Currently my code will get a area from the larger array and draw it to the screen, the only problem is updating the data in the toDraw array. thanks.

The game is made for android but is not included in tags because i dont feel it is relevant to the problem

sentences:
How to load a spherical planet and its regions? I'm designing a game partially composed of planets exploration. I want to use pseudo-random generation for them, regenerating from a defined seed when I have to load them rather than store every detail, which would be too heavy. So I will just store in a file the random seed and modifications done by the player if any.
The player must be able to see the planet from orbit (with very low level of details, then go down to the ground, increasing slowly the level of details of the region where he/she is landing, and unloading the ones on the other sides of the planet, which go outside the player's field of view.
If I had to do it on a plane ground, I would do it easily with a square chunk system. But the problem here is that planets are - almost - spheres.
So what would be the best way to load ground details (relief and grounded objects) around a precise point ?
I already though on two solutions, but both have a weak point:
1. Cutting the sphere in square chunks.

Once the player is close enough of the ground, I just have to improve details of closest squares from his/her position.
If it is not enough, I still can cut each square in sub-squares to load when the players is on or really close of the ground.
But as you can see on the picture, there is a problem if the player try to land on a pole: squares become very slim rectangles, or even triangles for the last line, and additionally to the fact that they would be many to load, generation would appear distorted.
2. Starting from an icosahedron.

Here, I could just increase triangle tessellation around player's position when he/she is getting close.
But I don't know how to locate triangles close than player's position. I heard Cartesian coordinates could be usefull in that case, but I don't know how to use them.

I'm using C++/OpenGL for it, so the main thing to generate and load here are vertices representing the surface relief and color/texture.

sentences:
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:
How to get rid of an image upon collision detection in SDL? I am fairly new to SDL in C, but I have written a simple game whereby a character has to reach the end of a level and avoid bad stars on the way. If he hits a star, he dies. There are also good stars he can collect and get points.

I have set up my point system so now when he hits a good star, he should get a point. However, when he hits a star, he actually gets lots of points, as long as he is touching the star, which I don't want. I think that what's happening is because the stars are moving and he rubs up against the stars; each pixel he moves counts as a new collision so he gets a point per collision. Ideally, he should only get one point per star.

So I have two problems: 1) I need to figure out how to make it so that he can only get one point when he hits a star. 2) Since he is supposed to be 'collecting' the stars, I want to make the star disappear when he collects it.

So it's similar to most of these types of games, whereby, the player collects something, it disappears and they get a point.

EDIT:

This is struct I've made:

typedef struct {
    int x, y, w, h, baseX, baseY, mode;
    float phase;
} Goodstar;

I've then referenced it in another struct like so:

Goodstar goodStars[GOOD_STARS];
SDL_Texture *goodStar;

[GOOD_STARS] is equal to 100.

And then here's my collision detection code:

// Check for collision with good stars
for (int i = 0; i < GOOD_STARS; i++) {
    if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
        if (!game->man.isDead) {
            game->man.points++;
        }
        break;
    }
}

So right now it only checks for a collision and then adds a point.

EDIT 2:

This is the code you suggested and it works:

for (int i = 0; i < GOOD_STARS; i++) {
    if (!game->goodStars[i].awarded) {
        if (collide2d(game->man.x, game->man.y, game->goodStars[i].x, game->goodStars[i].y, 48, 48, 32, 32)) {
            if (!game->man.isDead) {
                game->man.points++;
                game->goodStars[i].awarded = 1;
            }
            break;
        }
    }
}

And this is my initialisation code:

  // Initialise stars
  for (int i = 0; i < GOOD_STARS; i++) {
    game->goodStars[i].baseX = 320 + random() % 38400;
    game->goodStars[i].baseY = random() % 480;
    game->goodStars[i].mode = random() % 2;
    game->goodStars[i].phase = 2 * 3.14 * (random() % 360) / 360.0f;
        game->goodStars[i].awarded = 0;
  }

sentences:
OBB vs rectangle/quad/plane with bounds collision detection/response I am able to resolve collision between an OBB and a plane but can't get it to work when I introduce some bounds on the plane size. I want to have the plane of width and height dimensions defined by a normal and a position.
The code for detecting/resolving is fairly simple if the plane doesn't have any bounds:
function obbIntersectsPlane( obb, plane ) {
  let r = obb.size.x / 2 * Math.abs( dot( obb.right, plane.normal ) ) +
          obb.size.y / 2 * Math.abs( dot( obb.up, plane.normal ) ) +
          obb.size.z / 2 * Math.abs( dot( obb.forward, plane.normal ) );

  let s = dot( plane.normal, obb.position ) - dot( plane.normal, plane.position );

  if ( Math.abs( s ) < r ) {
    return {
      overlap: r - s,
      vector: plane.normal
    };
  }

  return false;
}

sentences:
What is the signifigance of the Dot Product in World to Local Transformations? Looking for help understanding why this World to Local Space function works.

I'm working my way through Buckland's Programming Game AI By Example The following function is used in the book to convert a point from world space to an agent's local coordinate space (its i hat and j hat are AgentHeading and AgentSide respectively)

    inline Vector2D PointToLocalSpace(const Vector2D &point,
                             Vector2D &AgentHeading,
                             Vector2D &AgentSide,
                              Vector2D &AgentPosition)
{

    //make a copy of the point
  Vector2D TransPoint = point;

  //create a transformation matrix
    C2DMatrix matTransform;

  double Tx = -AgentPosition.Dot(AgentHeading);
  double Ty = -AgentPosition.Dot(AgentSide);

  //create the transformation matrix
  matTransform._11(AgentHeading.x); matTransform._12(AgentSide.x);
  matTransform._21(AgentHeading.y); matTransform._22(AgentSide.y);
  matTransform._31(Tx);           matTransform._32(Ty);

  //now transform the vertices
  matTransform.TransformVector2Ds(TransPoint);

  return TransPoint;
}

I've been learning about vectors and matrices for the last three weeks and still I'm having a lot of trouble understanding why this works in terms of vectors and matrices. What is the reason for using a a dot product in the translation coordinates? Why is it the dot product of the agent's position and its heading? What does this dot product correspond to geometrically?

Why not just translate by the Agent's position?

Are there any simpler ways of representing this algorithm?

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:
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:
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:
Should I still display splash screens for middleware that has been discontinued? Usually, you would include splash logos at the beginning of a game to credit various middleware that you've used. Say the company has dissolved or for open source the supporting group has simply moved on and declared the project over. In the hypothetical situation where a middleware project has been discontinued and you still have the legal right to use it, wouldn't you still include the logo for that project at the beginning?

Only concerned with the opening splashes, since I'm pretty sure it would be polite to credit the individuals who worked on that piece in the text credits or at the end.

sentences:
How do I eliminate black bar artifacts in AndEngine/TMX plugin? I used AndEngine gles1 along with the tmx plugin to generate my background maps.  The image width is not fit to my virtual device, so I increased the tmx image size. Here is my code for the camera width and Camera Height:

CAMERA_HEIGHT = 320;
final DisplayMetrics displayMetrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
float aspectRatio = (float) displayMetrics.widthPixels / (float) displayMetrics.heightPixels;
CAMERA_WIDTH = Math.round(aspectRatio * CAMERA_HEIGHT);

But it shows me black bars as follows:

sentences:
Unity: Draw a trench onto a terrain I am making an RTS game and want to add the ability to dig a trench without redrawing the whole terrain as that is causing lag. The solution would need to allow a user to build a trench on the map and have a unit able to stand in the trench.
The game is using 3d models at the moment.

My first thought was to have the trench on a layer that is rendered on top of the layer with the terrain but that would give the problem that a trench would be seen even if it was behind a hill.

Is there an alternative or a solution?

sentences:
How to get error line when debugging APK from Logcat I made android game by Unity and built APK. When I got error from this game, I can see the error message:

07-06 00:35:38.905: I/Unity(31609): (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
07-06 00:35:38.906: E/Unity(31609): NullReferenceException: Object reference not set to an instance of an object
07-06 00:35:38.906: E/Unity(31609):   at GameManager.OnRealTimeMessageReceived (Boolean isReliable, System.String senderId, System.Byte[] data) [0x00000] in <filename unknown>:0
07-06 00:35:38.906: E/Unity(31609):   at GooglePlayGames.Native.NativeRealtimeMultiplayerClient+OnGameThreadForwardingListener+<RealTimeMessageReceived>c__AnonStorey4.<>m__0 () [0x00000] in <filename unknown>:0
07-06 00:35:38.906: E/Unity(31609):   at GooglePlayGames.OurUtils.PlayGamesHelperObject.Update () [0x00000] in <filename unknown>:0
07-06 00:35:38.906: E/Unity(31609):
07-06 00:35:38.906: E/Unity(31609): (Filename:  Line: -1)

However file name and error line is wrong, so I can't check where exactly error came from.

I checked my logic almost 2 hours also the object references too, but there is no logic to access undefined object code.

It could be, but I can't see where it is. I must run this app because it uses Google Play Games Service, so it requires completed built APK without developlemt option checked.

Using Application.RegisterLogCallback not much help, it has exactly same result.

How do I get exact error line in this case?

sentences:
How to import Cocos2d-x in codeblocks ide? Is it possible to import cocos2d-x in codeblocks just as in xcode ?? How can I do that ?

I use ubuntu. It is not possible to use xcode in ubuntu. Cocos2dx is in c++. How can I use codeblocks for game development with cocos2dx??

Thanks

sentences:
RGB values from image into a one dimension array in c# I was wondering if there is a was a way to read rgb values from an image into a one dimensional array in C#. If it doesnt make sense, in java I would do something like this.

int[] pixels;
BufferedImage image = getClass().getResourceAsStream("asdfghjkl.png");

int w = image.getWidth();
int h = image.getHeight();

pixels = new int[w * h];
image.getRGB(0, 0, w, h, pixels, 0, w) ;

So any help would be great, or if you can point me in the right direction, that'd be great

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:
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:
Vertex Skinning Looks Messy on Real Android Device using Monodroid I have no problem doing the "vertex skinning" for three-dimensional animation. All goes well when using the emulator (and genymotion). However, when run on a real device (such as Samsung and Lenovo) looks messy.

Screenshoot (Emulator)

Screenshoot (Real device)

Passing skin transform matrix

int location = ...;
int arrayCount = ...;
float[] skinTransform = ...;
GL.UniformMatrix4(location, arrayCount, false, skinTransform);

GLSL vertex

uniform mat4 World;
uniform mat4 View;
uniform mat4 Projection;
uniform mat4 Bones[20];

attribute vec4 Position;
attribute vec4 BoneIndices;
attribute vec4 BoneWeights;
attribute vec2 UV;
varying vec4 v_Position;
varying vec2 v_UV;

void main()
{
    mat4 skinTransform;
    int boneIndex = int(BoneIndices.x);
    skinTransform += Bones[boneIndex] * BoneWeights.x;
    boneIndex = int(BoneIndices.y);
    skinTransform += Bones[boneIndex] * BoneWeights.y;
    boneIndex = int(BoneIndices.z);
    skinTransform += Bones[boneIndex] * BoneWeights.z;
    boneIndex = int(BoneIndices.w);
    skinTransform += Bones[boneIndex] * BoneWeights.w;
    vec4 skinPos = Position * skinTransform;
    vec4 worldPosition = skinPos * World;
    vec4 viewPosition = worldPosition * View;
    v_Position = viewPosition * Projection;
    v_UV = UV;
    gl_Position = v_Position;
}

APK

http://1drv.ms/1BzYV3Q
Touch screen to on/off animation.

Info

Xamarin.Android = 4.10.x.x
Emulator Target = API 16 or 4.1
Real device Target = API 16 or 4.1
App Target = API 10 or 2.3 (tested also in API 14 and API 16), results remain the same

Is there any solution to solve this problem?

Best regards and thank you.

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:
Graphics.drawImage will only fill a small portion of my control I'm trying to create a map class for a simple 2D game. The map has an array(100,100,5) of string, returning the kind of tiles to draw ( with 5 possible layers from 0 to 4) players will move on the 2nd layer, the background of the game is on layer 0)

I'm want a drawMap sub that I would be able to call as needed. ( not the onPaint method, because I'm loading the game data map from  a binary file, and this game contains the needed coordinates, number of tiles, etc and the array of tiles, so I need to load the map info 1st, then use the draw sub)

I'm struggling right now because only the Tiles(0 to 3, 0 to 1,0) are showing ... while my array is full of tiles  !

Heres the code :

Public class Map
   inherits Panel

'... properties and stuff ....'

 Public Sub New(Optional ByVal mapName As String = "")

    G = Me.CreateGraphics()

    Me.BorderStyle = Windows.Forms.BorderStyle.Fixed3D
    Me.Location = New Point(250, 50)

    Load(mapName)

    Me.Width = mapSizeX * tileSize
    Me.Height = mapSizeY * tileSize

End Sub

Public Sub DrawGraphics(ByVal layer As Integer, ByVal g As System.Drawing.Graphics)
    For y As Integer = 0 To Map.mapSizeY - 1
        For x As Integer = 0 To Map.mapSizeX - 1
            If Not Map.Tile(x, y, layer) = "" Then
                GetSourceRect( x, y, layer, Map) 'return rectangle from my spritesheet '
                dRect = New Rectangle((x * tileSize), (y * Map.tileSize), tileSize, tileSize)
                g.DrawImage(SpriteSheet, dRect, sRect, GraphicsUnit.Pixel)
            End If

        Next
    Next
End Sub
end class

Load(mapname) deserializes a binary file containing the value for mapSizeX and mapSizeY, as well as tileSize and the Tiles(100,100,5) array all filled up.

What am I doing wrong at this point ?

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: Gravity is really low when animation is added to a character Basically I added a animation to my character, applied root motion so he could move around, although the gravity somehow decreased alot, my character now descends slowly...

sentences:
How can an asset bundle's resources be destroyed after destroying the compressed bundle data? Using:

AssetBundle.Unload( false );

Will clear the compressed asset bundle data. This, unfortunately, destroys the bundle object as well, which means nothing is keeping track of the loaded resources.

Using:

AssetBundle.Unload( true );

Will clear all resources correctly. However, it may be desirable to load the required resources, free the compressed data, and then free the loaded resources at a later time. How can this be done?

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:
AndEngine Physics: Shape rotating but not updating physics effects I was looking at PhysicsExample from AndEngine's Examples. I made the following change that I added a vertical line shape and created a fixture for it. Then I registered a rotation modifier for that shape. It is rotating properly but not updating its physics properties on rotation means when it is rotating and any physics body hits it, it did not give collision effect. Here is my code:

final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
        final Rectangle ground = new Rectangle(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2, vertexBufferObjectManager);
        final Rectangle roof = new Rectangle(0, 0, CAMERA_WIDTH, 2, vertexBufferObjectManager);
        final Rectangle left = new Rectangle(0, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
        final Rectangle right = new Rectangle(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT, vertexBufferObjectManager);
        final Rectangle center1 = new Rectangle((CAMERA_WIDTH/2) - 2, (CAMERA_HEIGHT/2) - 100, 10, 200, vertexBufferObjectManager);
        final Rectangle center2 = new Rectangle((CAMERA_WIDTH/2) - 100, (CAMERA_HEIGHT/2) - 2, 200, 10, vertexBufferObjectManager);

        center1.registerEntityModifier(new LoopEntityModifier(new RotationModifier(2, 0, 360)));

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

Although the body give collision effect when it reaches the shapes initial position. I am new to AndEngine. Where I a wrong...???

sentences:
Why do my 3D models look so different when imported into Unity? I am importing an image from Maya into Unity but the shapes look drastically different from one another as well as the color and I am not sure what is causing this how can I fix it?

From maya

From Unity

sentences:
How deep does the GameObject.GetComponentsInChildren() , Go? So I have a GameObject which my scene will be it's children.
I wanted to get the BoxCollider of all the objects and their sub-objects and their sub-objects's sub-objects and ... .
So can I do that with just the GetComponentsInChildren(), or should I navigate through them all and find them one by one?

sentences:
Why do I not see the back of a model in the model I have created a die in blender, that uses two materials.  One material is transparent and the second is opaque.

When I look throught the die, I expect to see the opaque parts blocking the view, but I do not see them at all.

As you can see in the image above, the 6 dots on the back of the die are not shown, it just looks like it is empty.

What can I do to fix this?

sentences:
Generate vertices of a sphere by using spherical coordinates I'm trying to generate points for a sphere by subdividing the space of spherical coordinate in res sector and res slices.
At first I did my own implementation, but it wasn't working. After a while I looked online and I copied Songho implementation and others as well.
But I still have the same issue:

The points are not evenly spaced in the sphere, creating a strip.
This is the code I'm using to generate the sphere:
   float sectorStep = 2 * PI / res;
    float stackStep = PI / res;
    float sectorAngle, stackAngle;
    for(int i = 0; i <= res; ++i){
        stackAngle = PI / 2 - i * stackStep;
        float xy = r * sinf(stackAngle);
        float z = r * cosf(stackAngle);
        for(int j = 0; j <= res; ++j){
            sectorAngle = j * sectorStep;
            float x = xy * sinf(sectorAngle);
            float y = xy * cosf(sectorAngle);
            vertices.push_back(glm::vec3(x,y,z));
        }
    }
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &verticesVBO);
    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, verticesVBO);
    glBufferData(GL_ARRAY_BUFFER, vertices.size(), vertices.data(), GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(0);
    glBindVertexArray(0);

And here it's how I draw it:
    glm::mat4 projection = glm::perspective(glm::radians(camera.getFOV()), (float) SCR_WIDTH / (float) SCR_HEIGHT, 0.1f, 100.0f);
    glm::mat4 view = camera.getViewMatrix();

    glm::mat4 model = glm::mat4(1.0f);
    shader.use();
    shader.setUniform("projection_view", projection*view);
    shader.setUniform("model", model);
    glBindVertexArray(sphere.VAO);
    glDrawArrays(GL_POINTS, 0, sphere.vertices.size());

I wanted to draw the vertices first and then move to drawing the triangles.
Sorry if this is a stupid question.

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:
Handling image size based on different ios device versions (Unity2D) This game is built using Unity 4, C#, and the 2D toolkit. In the unity game scene settings, it is set to (ios 5 tall) and I matched the Menu background dimensions with the dimensions of an ios 5 tall device.  When testing this build on a different ios device(ios 4 etc...), the menu background doesn't fit (stretch) to the width and height of the tested device's dimensions. The answer seems pretty obvious that i'm not handling all devices dimensions.

What would be a good approach on handling images based on different ios devices? Are there any build settings to build a project that handles each device dimensions?

Thanks in advance for any advice or a good approach for cross-device handling

sentences:
Bubble shooter search alghoritm So I have a Matrix of NxM. At a given position (for ex. [2][5]) I have a value which represents a color. If there is nothing at that point the value is -1. What I need to do is after I add a new point, to check all his neighbours with the same color value and if there are more than 2, set them all to -1.

If what I said doesn't make sense what I'm trying to do is an alghoritm which I use to destroy all the same color bubbles from my screen, where the bubbles are memorized in a matrix where -1 means no bubble and {0,1,2,...} represent that there is a bubble with a specific color.

This is what I tried and failed:

public class Testing {

    static private int[][] gameMatrix=
        {{3, 3, 4, 1, 1, 2, 2, 2, 0, 0},
        {1, 4, 1, 4, 2, 2, 1, 3, 0, 0},
        {2, 2, 4, 4, 3, 1, 2, 4, 0, 0},
        {0, 1, 2, 3, 4, 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},
        };

    static int Rows=6;
    static int Cols=10;
    static int count;
    static boolean[][] visited=new boolean[15][15];
    static int NOCOLOR = -1;
    static int color = 1;

    public static void dfs(int r, int c, int color, boolean set)
    {
        for(int dr = -1; dr <= 1; dr++)
            for(int dc = -1; dc <= 1; dc++)
                if(!(dr == 0 && dc == 0) && ok(r+dr, c+dc))
                {
                    int nr = r+dr;
                    int nc = c+dc;

                    // if it is the same color and we haven't visited this location before
                    if(gameMatrix[nr][nc] == color && !visited[nr][nc])
                    {
                        visited[nr][nc] = true;
                        count++;

                        dfs(nr, nc, color, set);

                        if(set)
                        {
                            gameMatrix[nr][nc] = NOCOLOR;
                        }
                    }
                }
    }

    static boolean ok(int r, int c)
    {
        return r >= 0 && r < Rows && c >= 0 && c < Cols;
    }

    static void showMatrix(){
        for(int i = 0; i < gameMatrix.length; i++) {
            System.out.print("[");
            for(int j = 0; j < gameMatrix[0].length; j++) {
                System.out.print(" " + gameMatrix[i][j]);
            }
            System.out.println(" ]");
        }
        System.out.println();

    }

    static void putValue(int value,int row,int col){
        gameMatrix[row][col]=value;
    }

    public static void main(String[] args){
        System.out.println("Initial Matrix:");
        putValue(1, 4, 1);
        putValue(1, 5, 1);
        showMatrix();

        for(int n = 0; n < 15; n++)
            for(int m = 0; m < 15; m++)
                visited[n][m] = false;

        //reset count
        count = 0;
        //dfs(bubbles.get(i).getRow(), bubbles.get(i).getCol(), color, false);

        // get the contiguous count
        dfs(5,1,color,false);
        //if there are more than 2 set the color to NOCOLOR
        for(int n = 0; n < 15; n++)
            for(int m = 0; m < 15; m++)
                visited[n][m] = false;
        if(count > 2)
        {
            //dfs(bubbles.get(i).getRow(), bubbles.get(i).getCol(), color, true);
            dfs(5,1,color,true);
        }

        System.out.println("Matrix after dfs:");
        showMatrix();
    }

}

sentences:
How to render sprite array efficiently in j2me game? I am working on a landscape java game.

I have a sprite array like this;

Sprite stickArray[] = new Sprite[10];

and initializing it like this with visibility as false.

for (int j = 0; j < stickArray.length; j++) {

        if (stickArray[j] != null) {

            stickArray[j].setPosition(stickX, stickY);
            stickArray[j].setVisible(false);
        }
    }

Later I want to position it like one after another vertically on repeating a key.pressBool is false initially.

public void keyRepeatInGame(int keyCode) {
    int gameKey = getGameAction(keyCode);
    Graphics g = getGraphics();
    if (gameKey == FIRE || keyCode == KEY_NUM5) {
        pressBool = true;
    }
}

Later I have written code like this;
Initially one Sticksprite is there.above this sprite, I want to place each sticks on clalling keyrepeat()in space key.

for (int i = 0; i < stickArray.length; i++) {
            if (pressBool) {
                if (i == 0) {
                    stickArray[i].setPosition(stickSprite.getX(),
                            stickSprite.getY() - stickSprite.getHeight());
                    stickArray[i].setVisible(true);
                } else {
                    stickArray[i].setPosition(stickArray[i-1].getX(),
                            stickArray[i-1].getY() - stickArray[i].getHeight());
                    stickArray[i].setVisible(true);
                }
            }
        }

This code is working partially.Stick is getting added on the sprite,all at once.

How can I change the code to make the sticks repeatedly getting added on calling keyrepeat() only, and make it visible one by one properly?

sentences:
Get next tile by given angle I am new to game development, and I have been building some game with LibGDX engine.

The following function might make you feel bad

The function I am going to show, is accepting the current rotation index of my player (player has 4 rotations, north, south, west, east). The function will return how much to jump in X to get the next tile according to his direction (angle) and the selected move (you can only select left, right or forward per turn):

public int getIncrementXForRotation(int rotationIndex) {
    switch(this) {
        case MOVE_FORWARD:
            switch(rotationIndex) {
                case Face.EAST:
                    return 1;
                case Face.SOUTH:
                    return 0;
                case Face.WEST:
                    return -1;
                case Face.NORTH:
                    return 0;
            }
        case MOVE_BACKWARD:
            switch(rotationIndex) {
                case Face.EAST:
                    return -1;
                case Face.SOUTH:
                    return 0;
                case Face.WEST:
                    return 1;
                case Face.NORTH:
                    return 0;
            }
        case MOVE_LEFT:
            switch (rotationIndex) {
                case Face.EAST:
                    return 0;
                case Face.SOUTH:
                    return 1;
                case Face.WEST:
                    return 0;
                case Face.NORTH:
                    return -1;
            }
        case MOVE_RIGHT:
            switch (rotationIndex) {
                case Face.EAST:
                    return 0;
                case Face.SOUTH:
                    return -1;
                case Face.WEST:
                    return 0;
                case Face.NORTH:
                    return 1;
            }
        case TURN_LEFT:
            switch(rotationIndex) {
                case Face.EAST:
                case Face.SOUTH:
                    return 1;
                case Face.WEST:
                case Face.NORTH:
                    return -1;
            }

        case TURN_RIGHT:
            switch(rotationIndex) {
                case Face.NORTH:
                case Face.EAST:
                    return 1;
                case Face.WEST:
                case Face.SOUTH:
                    return -1;
            }
    }
    return 0;
}

Same function for Y.

Now I looked at this, and i thought to myself.. north can be an 0, and east can be 90, and south can be 180 and west can be 270, am I right?

So there is a way to mathematically do these coordinate increment according to the angle, isn't there?

The reason I classified my player angles by `enums` is because each direction is an image.

sentences:
Godot 3: How to add images without creating scenes? To add images, as far as I know you create a sprite in godot, but I don't want to do that, I'd like to do it pro grammatically using arrays, the reason is I'm creating a card game and I don't want to add 52 scenes and then attach 52 sprites.

Isn't there  a smarter way to do it? I haven't found anything. What I'm doing now  is I have a card scene and then I inherit from it the other cards scenes and attach sprites to them and add them to a 2d array but I'd like another way of doing that

sentences:
How can players randomly - and secretly - choose 5 cards out of 25 that match a specific condition So this is a less a coding question and more a 'there's gotta be a way'...
I have a Clue-like logic/deduction board game that has 25 cards - 5 of each color and 5 of each taste. Each card is unique, and has a unique combination of color and taste.
Just like in Clue, I want to have players randomly choose some cards that make up the answer they're trying to discover through logic and deduction. In previous versions, one side of the cards (the back side) had the taste of the card, and the correct answer would have exactly one of each taste. After some playtesting, a suggestion was made to have the correct answer have 5 cards, including exactly one card of each color and taste...
So that's what I'm trying to do. Players need to secretly determine this for themselves by using just some playing cards. One side needs to have the actual combination of color and taste on it, but anything can be on the back to make it work. I've tinkered with numbers and bar-code-like graphics, but anything's possible here (numbers shouldn't be easily memorized, naturally, and the backs of the cards should be able to remain visible without this system giving away what's on the other side...

sentences:
What coding issues can be significant in damaging the performance of a game? I have just finished a 2D game in Java that I've been working on for a while.

I found that on some computers it runs fine, and on others (which are not particularly slow in general), the game runs a little slower, and with minor interruptions every second or so. Not completely smooth.

Since I am a beginner to making games, and probably since I didn't plan everything about the game in advance, the code of the game is rather long, clumsy and probably inefficient.

I want to improve this in my next projects. So my question is - In general, what would be the main causes for a common 2D game to slow down on a computer?

What should I pay the most attention to, next time, in order to design an efficient game?

Making a small amount of classes? (Even if the classes are small
ones?)
Avoiding repetition of code? (Even small sections of code, such as
short if statements).
Avoiding too many threads running?
Anything else?

Obviously, all of the above are recommended for an efficient program.

But I'd like to know, what in a game's code, could be especially significant for making an efficient application, and what would be less important and will not save significant amounts of memory.

Any advice would be welcome - could be regarding game design, or regarding more specific coding issues.

I don't know if this matters, but please note that I'm talking mainly about real-time games, using a 'game-loop' that constantly updates the game and the dispaly.

Thank you

sentences:
How to offer directional ambient audio I'm working on a game side-project that will be heavily audio-based. One feature I'd like to offer are ambient sound zones which correspond to locations of nearby areas.

Say for instance the player is standing on a beach with waves breaking to the right, and a rainforest to the left. Each of these regions has its distinct ambience. If you continue forward, the breaking waves should still be just as loud on your right. Similarly, if you head into the forest, the sound of the waves should slowly be replaced as you move away from the beach. Many games seem to treat ambient sound as either vaguely positional, or as an environmental sound that comes from everywhere at once. What I'm trying for are different areas with different distinct sounds so you can actually orient yourself to them (I.e. you should be able to return to the beach by listening for the breaking waves, they shouldn't just be omnidirectional and faint.)

I don't want to get too deep into architecture, but my system is simple 2-D tile-based. I've thought of several possible approaches and am wondering a) which is best or b) if I've missed one that is better.

Place distinct, loud ambient sounds in specific locations. This would certainly provide directionality of a sort, but I wonder if the ocean waves might eventually sound ahead or behind and right as you walk down the beach, since all the ambience is coming from a single point. This also wouldn't allow for, say, walking out in the ocean past the breakers and hearing them behind you.
Placing sound sources throughout the area, spaced a reasonable distance apart. So for instance the breakers might be a single row of wave sounds which you could walk along or past. Similarly, the forest would be a grid of scattered nature sounds. This seems like the best approach, but I wonder if I'd quickly hit some limit for number of sounds that can be mixed. I'm using the web audio API, not sure if that intelligently doesn't render sounds that are too soft to hear. While this seems conceptually simpler, a long beach might have hundreds of distinct sound nodes placed along it.
Track the player's nearest intersection with a given zone, and play its ambience at those coordinates. So if you're walking along a beach with breaking waves to your right, I'd project out an invisible circle for as far as you can realistically hear, identify the closest intersection with various audio zones, and play their respective ambience. Maybe limit this to the nearest 2-3, since any more would likely be overwhelming. This seems least demanding in that it'd play fewer sounds, but would likely require more collision checks and thus might be impractical.

Thoughts?

sentences:
Debug.DrawLine doesn't go straight Heres the code:

void Update() {
    Debug.DrawLine(attackSpot.position, attackSpot.TransformDirection(Vector3.forward * distance), Color.red);
    Debug.DrawLine(transform.position,  transform.TransformDirection(Vector3.forward * distance), Color.green);
}

I'm drawing 2 lines, one is coming from attackSpot and one is coming from own transform.

Reason of this because my Raycast doesn't worked properly, so I decided to see visually to check.

Of course, attackSpot is pointing front direction.

Rotation of attackSpot in screenshot is local rotation. But when the play game, line coming from attackSpot doesn't go straight, it moves lower direction.

I also tried

Debug.DrawLine(attackSpot.position, attackSpot.forward * distance, Color.red);

But has same result. Why my ray doesn't go straight? What am I missing?

sentences:
Logic For camera Movement Every time I move the hero on my screen I increment a screenOffsetX and a screenOffsetY.
These add 1 if you move right, -1 if left to the sceenOffsetX. Add the screenOffestY +=1 if down, -=1 if up.

I also have a variable for the first time through drawing called drawingForTheFirstTime.

The problem is that I have a level of size 40x40 array. I am drawing a camera view of 20x20. I shift the camera fine as long as I am not near the edges of the map. When I try to go into the upper left of the map, I lose track of the hero.

I dont want the camera to move if the hero is close to the edge of the map. I want him to move independantly of the camera. Otherwise he stays at the same position on the screen while the map moves underneath him. I think it is only my if logic that is broken.

if(!(screenOffsetX != 0 || screenOffestY != 0) && !drawingForTheFirstTime)
{
    return false;
}
else
{
    //move camera
}

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:
How to write AI bots that can autoplay a shoot 'em up game? In a shoot 'em up game I want to have AI bots that can take up the player's slot and play the game (such as in this video). However they should come with different flavors (varying competency and playstyles). The problem is the related maths and AI programming are very new to me. Where should I start?

Suggestions for existing sample code/libraries/tools, reading materials or advice on architecture/algorithms are all welcome. Thanks in advance!

sentences:
How can i convert a non-convex mesh collider object to a convex mesh collider object I created a character object in Maya and stored it as char.obj, then I imported the object into Unity.

The character object is not colliding with any other Unity objects like cube, plane, sphere, etc.

Then I found non-convex mesh colliders do not collide with any other Unity default objects. How can I convert the non-convex mesh collider to a convex mesh collider?

Here is the error message I see:

  Non-convex MeshCollider with non-kinematic Rigidbody is no longer
  supported in Unity 5. If you want to use a non-convex mesh either make
  the Rigidbody kinematic or remove the Rigidbody component. Scene
  hierarchy path "mesh_octopus/Default", Mesh asset path
  "Assets/PlaceAsset/mesh_octopus/mesh_octopus.obj" Mesh name "Default"

sentences:
Problem making shooting follows an actor/object At first I created an actor to be a projectile, he acts with a simple projectile. When generated it goes straight, anyway...

To do this, I added the Projectile Movement component.

It turns out that I wish this projectile did not go straight ahead simply, I would like it to be generated when it came to a minion.

Then my problems began, because being simply an actor, it seems that he can not move with the Simple Move to Actor/Location function.

I created 3 sockets:

One for each shot/projectile I was going to test.

Shooter Blueprint:

The Event Atirar causes the 3 shots/projectiles I created to be generated (TiroActor, TiroCharacter and TiroPawn).

TiroActor Blueprint:

TiroCharacter Blueprint:

TiroPawn Blueprint:

I wish that when they were generated, they would go towards the only existing minion in the game, but this does not happen:

The Tiro Actor goes straight, and nothing makes it stop (I activated the "call in editor" option for the Event Andar, but it does not match).

The Tiro Character falls to the ground and does nothing, but corresponds when I call the Event Andar manually:

The Tiro Pawn is not even generated...

I modified the "Auto Posses AI" option of Tiro Character and Tiro Pawn to Placed in World or Spawned.

I removed the gravity of all the components of the Tiro Character, but even so when generated it falls to the ground.

I would like to know how to make an object (be it actor, pawn or character) when it is generated follow the target (in this case a minion) until it collides with it.

EDIT 1 (complement)

If it was difficult to understand, I'd like to know how to do something like an AA from a Clash of Clans archer, even a champion AA that attacks from a distance, whether from Dota or LOL.

The projectile of the Dota/LOL tower would be a good example. A guided missile too...

sentences:
Copyright information / issues (if any) for game I have always been a fan of the game Heroes of Might and Magic 3 (let's call it simply HOMM3), which shined long ago, around 1998.

For more information, this game was created by the 3DO company - which sadly went bankrupt in 2003. Then in 2015, somehow it was 'revived' (a rendition, actually) as HOM3-HD edition by Ubisoft.

Now, I'm thinking of my own game that uses the theme from this game (well, at least use the game characters and audio for example), which might be published onto Google Play and/or App store.

So I'm wondering: would there be any issues (e.g. risks of being sued, for example by Ubisoft) if I try to use HOMM3 (the original one, as I called it above) art and audio ? For audio, I still own a copy of HOMM3 so I have access to the audio (MP3) files directly from the game folder. For arts, there are spritesheets like this: spriters-resource, which seem to be freely available to use.

These are two versions (owned by 3DO vs owned by Ubisoft), but things could get complicated if we are not prepared, so better be safe than sorry.

sentences:
How do I control multiple Pawns without possesing them (RTS style)? I am making a multiplayer RTS but I have a problem controlling spawned units (let's call them Vessels), specifically moving them around with AI MoveTo bp.
Vessels can be created by both Clients and Server and are visible for everyone but neither clients nor Server can move Spanwed Vessels.
Only Vessels placed on the map beforehand can be moved and ONLY by the Server.
Also, the server sees all Client CameraPawn movements and clients see Server CameraPawn movements BUT clients don't see each other's CameraPawn Movements (if this is related somehow...)

How can I control a pawn in multiplayer from all clients for starters?
How can I limit control to a specific controller?
Why "preplaced" Vessels work(move) for Server only?

sentences:
How to stop sprite when overlap on in libgdx? How can I stop my player if he overlap or touch the ball? In my top down game my player is cat and I want to stop  his moving or stack in that place of the ball is located if he hit the ball I'm using acceleromter to move the cat left and right.

Here is my code. How can I add collide method just like the image bellow? Thank's and advance!

// Load the sprite sheet as a texture
cat = new Texture(Gdx.files.internal("cat.png"));
catsprite = new Sprite(cat);
player = new Rectangle();
player.width = 20;
player.height = 80;
player.x = 300;
player.y = 0;

basketball = new Texture(Gdx.files.internal("ball.png"));
ball = new Circle();
ball.x = Gdx.graphics.getWidth() / 2;
ball.y = Gdx.graphics.getHeight() / 2;
ball.radius = basketball.getWidth() / 2;

In render method

camera.update();
TextureRegion currentFrame = walkAnimation.getKeyFrame(stateTime, true);
spriteBatch.draw(basketball, ball.x-ball.radius, ball.y-ball.radius);
spriteBatch.draw(currentFrame,player.x, player.y);// Draw current frame at (50, 50)

if(player.y < 0)
    player.y = 0;
if(player.y > 900 - 80)
    player.y = 700 - 80;

// check collision
if(Intersector.overlaps(ball, player)){
    tmp.set(player.x, player.y + player.height/2, player.width, player.height/2);

    if (Intersector.overlaps(ball, tmp)){
        //top half (or both top and bottom) hit
        Gdx.app.log("overlaps", "yes");
    } else {
        //bottom half hit
    }
}

//Mobile acceleration
if (Gdx.input.isPeripheralAvailable(Input.Peripheral.Accelerometer)) {
    player.x -= Gdx.input.getAccelerometerX();
    player.y += Gdx.input.getAccelerometerY();
}

if (player.y > Gdx.graphics.getHeight() - 100)
    player.y = Gdx.graphics.getHeight() - 100;

if (player.x < 0) {
    player.x = 0;
    player.x += Gdx.graphics.getDeltaTime() * catSpeed;
}

if (player.x > Gdx.graphics.getHeight() - 250) {
    player.x = Gdx.graphics.getHeight() - 250;
}

sentences:
Determining if player-created structure matches a template in a 3D block-based game Disclaimer: this is one of those dreaded Minecraft-style questions, but I feel it's more a data structures and algorithms question

I'm really new to 3D data structures and am wondering what the best way to store and match a 3D block structure.

Right now, the player is able to place blocks in any arbitrary space and when these blocks match a pre-defined structure an event happens. The way I'm doing it currently is when a player places a block the game recursively checks each adjacent block to find the block with the lowest x, y, z coordinate and makes that block the root block. Then it checks the rest of the blocks, based off of the root block, to make sure they match a certain template. The problem is that as the template gets more complicated, so does my (terribly inefficient) code.

I'm thinking the best way to do this is to store some type of matrix that defines the structure and then match against the matrix whenever a player places a block. Are there already data structures/algorithms that would match this type of problem?

sentences:
Should I use an SQL database to store data in a desktop game? Developing a Game Engine

I am planning a computer game and its engine. There will be a 3 dimensional world with first person view and it will be single player for now. The programming language is C++ and it uses OpenGL.

Data Centered Design Decision

My design decision is to use a data centered architecture where there is a global event manager and a global data manager. There are many components like physics, input, sound, renderer, ai, ... Each component can trigger and listen to events. Moreover, each component can read, edit, create and remove data.

The question is about the data manager.

Whether to Use a Relational Database

Should I use a SQL Database, e.g. SQLite or MySQL, to store the game data? This contains virtually all game content like items, characters, inventories, ... Except of meshes and textures which are even more performance related, so I will keep them in memory.

Is a SQL database fast enough to use it for realtime reading and writing game informations, like the position of a moving character? I also need to care about cross-platform compatibility. Aside from keeping everything in memory, what alternatives do I have?

Advantages Would Be

The advantages of using a relational database like MySQL would be the data orientated structure which allows fast computation. I would not need objects for representing entities. I could easily query data of objects near the player needed for rendering. And I don't have to take care about data of objects far away. Moreover there would be no need for savegames since the hole game state is saved in the database. Last but not least, expanding the game to an online game would be relative easy because there already is a place where the hole game state is stored.

sentences:
How do I maintain game balance while promoting interaction between dead and alive players? How do you motivate players to be content with randomly selected roles that are often complex to play and differ drastically in playstyle (AND to stick around till the end of game)?

Some background: Town of Salem is a more diversified and polished version of the popular "party games" such as Mafia and Werewolf. There are about 30 roles with offensive/defensive/supportive/investigative specializations, assigned to players at random. Most of all, many roles have unconventional abilities that provide incentives for any player to stay engaged during each stage of a game session (i.e. early-game/initiative, mid-game, and end-game)

For example: Medium can chat with dead players. The catch is that the names of such dead players ("out of play") are anonymous to Medium. In this sense, it provides a greater flexibility in player contribution overall with a strong emphasis on mid and late-game . Players are motivated to keep deducing and cooperating until the game is declared over (as opposed to sitting back once they are out of play) knowing that their intel can affect the outcome via Medium regardless of how early they were killed off.

I am also interested to see examples from multiplayer games in the same genre.

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:
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:
Unity Component Hierarchy I'm currently working on a 3D RPG game and I'm adding Interactions with objects. I have a lot of objects to interact with and I've placed them in an folder/empty object "Interactables".

Now, I want all my objects to have a SpriteRenderer Component. I'm currently adding this Component on each Interactable Object, one by one.

Is there a cleaner way of doing that, for example adding the Component to the Interactables parent empty object and cloning it to all the children ?

Thank you!

sentences: Unity5 using non-convex meshcollider with rigidbody I want to build a car using wheel collider, mesh collider and rigidbody. The problem is that unity wants the meshcollider to be convex, and that cannot happen because my base model is bigger than 255 poly's.

sentences: Monster Spawner Reference Issue I have a monster spawner that spawns the "enemy" kid which is red, and it has a line in the script where it references the "player" gameobject's transform. Before I made the spawner, I had the enemies put by hand and I could reference the player object without issue. Now they're not handplaced, they are spawned from the prefab folder by the spawner. When they spawn the game gives the null reference exception error and stops. I look up to the enemies that are spawned and none of them have the player gameobject referenced. Also when I click on to the enemy prefab to reference the player object, it just doesnt allow me to. How can I resolve this issue?

sentences:
Compute world position by walking N units along spline? My goal is to move ahead along a spline 'x' world units, unfortunately there is no way to map spline points to world points.

What I do is I iterate along the spline by a small alpha amount (say 0.001), get the new spline point vs the old one and add the difference to a total up until it equals or is slightly greater than the distance I wanted to move in world space.

This works fine but there is a huge bottleneck with the sqrt, basically to calculate the distance between two vector points you need to do a square root calculation.

I feel it should be possible to just get the squared value and just use that, unfortunately I can't get the code working, here is what I have:

Where _distance is the amount to move, Distance is the alpha value along the spline.

        float distanceMoved = 0;

        float oldDistance = Distance;

        while (distanceMoved < (_distance))
        {
            Vector3 before = Position;
            float oldAlpha = Alpha;
            float oldDist = Distance;
            Distance += _iteration;

            distanceMoved += (before - Position).magnitude;
        }

Notice the line with (before - Position).magnitude, the .magnitude property performs a square root.

I've tried changing it to .sqarMagnitude and say distanceMoved < distance * distance but it has accelerated the rate of movement forwards.

Any ideas what is going wrong or how I can get rid of the square rooting or do this differently entirely?

sentences:
How should I render multiple objects in OpenGL? I am just getting my head wrapped around modern OpenGL. Let's say that I would like to draw 10 objects, how would I structure that? Would I call glDrawElements(...) in a for loop 10 times?

void render() {
  shader.bind(); // calls glUseProgram
  bindVAO();     // calls glBindVertexArray

  for(int i = 0; i < 10; i++) {
    glDrawElements(....)
  }

  unbindVAO;
  shader.unbind();
}

sentences:
Make half of the sprite transparent Guys if I have two sprites placed on the same spot. How can I show the half of each Sprite instead of the one on top? The sprites are basic circles

All sprites have basic colors, no textures.

sentences:
How can I roll up a plane with a vertex shader? I have plane that I want to roll up using a vertex shader, like this:

I found a math demo that shows the kind of curve I want my mesh to follow. I tried implementing this in my shader code, but the results don't form a roll as expected:

Shader " Custom/Rolling "
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_Bend("Bend",Float) = 1
_Strength("Strength",Float) = 1
}

SubShader
{
Tags {"Queue"="Geometry" "IgnoreProjector"="true" "RenderType"="Opaque"}
Cull Off

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

struct v2f
{
half2 texcoord  : TEXCOORD0;
float4 vertex   : SV_POSITION;
};

sampler2D _MainTex;
float _Bend;
float _Strength;

v2f vert(appdata_full v)
{
v2f o;

//I don't know what should I write here for rolling ,please help me.
//v.vertex.y *= ???
v.vertex.y *= exp(_Bend+(v.vertex.x*_Strength)); // something like this but this hasn't twist effect
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord;
return o;
}

float4 frag (v2f i) : COLOR
{

float2 uv = i.texcoord.xy;
float4 tex = tex2D(_MainTex, uv);

return tex;
}
ENDCG
}
}
Fallback Off
}

Instead of a neat roll, the end of my plane shoots up into the sky!

sentences:
Retain Position and Scale Values of Render Texture Canvas Elements to another Canvas Now the title might not be able to express the entirety of the question but here's my problem. In my main scene I have a camera and a canvas in overlay mode, let's call this "View A". In this view is a crosshair which position and size I want to manipulate depending on elements inside the canvas of "View B". "View B" is located in the main scene as a render texture it contains a camera and a canvas in camera space with another crosshair. Now what I want to do is the following: I'm trying to set the position and size of the crosshair in "View A" to practically overlap with the values of the crosshair in "View B", i.e. if the crosshair in "View B" is in the lower left corner of its screen I'd like the crosshair in "View A" to be in the same position with the same size but in the canvas of "View A".

What I'm currently capable of is setting the crosshair in "View A" to the same location as the crosshair in "View B" but only if the crosshair in "View B" is in its origin, as all I have to do in that case is to get the origin of the render texture quad in the screen space of "View A" canvas. I do this in the following way:
RectTransformUtility.ScreenPointToLocalPointInRectangle(CanvasTransform, CameraComponent.WorldToScreenPoint(RenderTextureQuadTransform.position), null, out Vector2 localPoint);
CursorTransform.localPosition = localPoint;

But now I'm stuck in figuring out how to get a scale factor that makes the crosshair in "View A" and "View B" look the same size and how to adjust the position of the crosshair in "View A" depending on the position of the crosshair in "View B".

sentences:
Making Save and Load Windows using SDL I've been working on a world builder project recently and I've finished most of the work but there is just one thing I can't think of how to do.

For example in a strategy game's world builder when you want to save a map and click the save button a window pops up and you can enter a name you want and save the map with that name, or overwrite a map you can chose by clicking one of the pre-saved maps in the list in the window. Or load a map again by clicking a map name in a load window.

How can I render a text while I'm writing it with SDL 2.0.3(when you're saving a map you need to see the name you give) and save that file with that name and also show other save files' names in a list?Is there a way to do it with SDL_ttf library or should I use bitmapfonts?

How can I decide if I want to overwrite a map or create a new one (I need to overwrite a map when it's name is clicked and create a new one when the bar to write the new map's name is clicked)?

In the load menu how can I load the specific save file I've chosen?

And just one more question: I'm currently writing the save data in a .txt file, is there a better way of doing that that you suggest?

I'm using SDL with C++.

Thanks.

sentences:
Isometric Game World Boundaries Equation I ran into a problem last night and I can't solve it since.
I'm making an isometric game based on tiles with equal rows and columns.
Now I made moving entities which should turn whenever they reach the boundaries of the world. As I illustrated on the picture they are turning back on the upper boundaries (green) , but not on the lower ones (red).
I tried various equations on the lower part, but i cannot figure out for the life of me what is the lower parts code. What would be an appropriate solution for the shrinking lines?

boolean checkBounds(){
        float absX = Math.abs(getX());
        float absY = Math.abs(getY());
        if(absY*2-absX<0 || ??? ) return false
        else return  true;
    }

sentences:
Is it a bad idea to couple action and animation? I'm making an ARPG (like Legend of Zelda but with more action), and this question raised during the development:

Should action and animation be coupled? Or should they be independent?

With this I mean, the process of executing an action (eg. Attacking) should be:

Input
Start Animation
Frames 1-3 are transitioning, do nothing
Frames 4-7 are attack moves, do the attack action during these (searching enemies in front of the character, pick the closest and deal the damage)
Frames 7-10 are transitioning, do nothing again
Animation finished, release input again.

This way, it's like the action is triggered by the frames, as events on the animation itself.

If it helps, I'm making the game on an Entity/Component System.

Should it be done this way? Why yes/no? What are the advantages/disadvantages?

sentences:
Jumping on meshes in Babylon.js So I want to make it possible for players to jump on objects (meshes) that are somewhat lower than the players camera.

I have set the checkCollisions to true but i can't seem to jump on any objects

(I'm using Babylon.js)

Here is my jump function

//Object i wanna jump on
var cube = BABYLON.Mesh.CreateBox("box", 10, scene);
cube.checkCollisions = true;
cube.position.y = - 4.5 ;

//Jump function
_playerJump : function(){
        $this = this;

        if($this.isJumping == false && $this.energy - 30 >= 0){
            var
                camera = $this.camera,
                jumpAnim = new BABYLON.Animation("jumpAnim", "position.y", 20, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE),
                keys = [],
                jumpStep;

            camera.animations = [];

            for(jumpStep = 0; jumpStep < 23; jumpStep ++)
                keys.push({frame: jumpStep, value: camera.position.y + jumpStep / 5});

            for(jumpStep = 24; jumpStep < 46; jumpStep ++)
                keys.push({frame: jumpStep, value: camera.position.y + 4.8 - (jumpStep - 24) / 5});

            jumpAnim.setKeys(keys);

            var easingFunction = new BABYLON.BezierCurveEase(.13,.01,.63,1.41);
            easingFunction.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEIN);
            jumpAnim.setEasingFunction(easingFunction);

            camera.animations.push(jumpAnim);

            $this.isJumping = true;

            $this._setEnergy(-30);

            $this.scene.beginAnimation(camera, 0, 46, false, 4, function(){
                $this.isJumping = false;
                $this.isCrouching = false;
            });
        }
    }

sentences:
What are the alternatives to OpenGL arrays for deferred rendering? I'm trying to build a deferred rendering technique in an OpenGL engine, but I can't figure how I could get more than the limit of 32 lights.

I use an array in my shader, feed light properties into this array then loop through it and compute lightning, but I can't get more than 32 items into my array.

What is a better alternative to this?

sentences:
Blur effect on background to make the forground more clear unity I'm making a game in unity and I'm trying to add a background blur effect to my game to make things a bit more clear.

Here is an example of what I am looking to do:

I'm trying to get the background blurriness and cloudy effect, but I have no idea how to go about getting a similar effect. It looks like a blur + cloudiness of some sort, but I've tried blurring my background objects and it just looks terrible.

Here is what I currently have:

I'm using Unity, it's all 2D sprites so I don't think I can use shaders, which is the only solution I could find people talking about, and have no idea how to proceed. Any help would be appreciated, Thanks.

Edit: Even knowing the terms I could use to search for a solution would help as I'm not quite sure what it is called.

sentences:
Problem with scrolling background in one OpenGL loop I have 960x3000 map image in png and I'm scrolling it in a loop like this (it's called in 60 FPS loop):

glPushMatrix();
    glBindTexture( GL_TEXTURE_2D, mapTex[iBgImg]);
    glBegin(GL_QUADS);
    double mtstart = 0.0f - fBgVPos/(double)BgSize;
    double mtend = mtstart + mtsize;
    glTexCoord2d(0.0, mtstart); glVertex2f(fBgX, TOP_MARGIN);
    glTexCoord2d(1.0, mtstart); glVertex2f(fBgX + MAP_WIDTH, TOP_MARGIN);
    glTexCoord2d(1.0, mtend); glVertex2f(fBgX + MAP_WIDTH, BOTTOM_MARGIN);
    glTexCoord2d(0.0, mtend); glVertex2f(fBgX, BOTTOM_MARGIN);
    glEnd();
glPopMatrix();

unfortunately it isn't smooth when the game is in windowed mode. However, it is smooth in full screen mode. I'm using GLFW for windows. Maybe there is something wrong with my method? Is there anything better? Or could this be hardware problem?

Edit:
Window is created using

 glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE);
 glfwOpenWindowHint(GLFW_REFRESH_RATE, 60);

and main loop is using glfwSwapInterval(1) to ensure 60 FPS;

sentences:
Raycasting to AddForceAtPosition goes to the wrong direction I'm trying to get my coin object's Rigidbody to move whichever way it was swiped on by the user through RayCast

void Awake()
{
    coinRigidBody = coin.GetComponent<Rigidbody>();
}

void Update()
{

    foreach (Touch touch in Input.touches)
    {
        if (touch.phase == TouchPhase.Began)
        {
            firstTouchPos = new Vector3(touch.position.x, touch.position.y, Camera.main.nearClipPlane);
        }
        if (touch.phase == TouchPhase.Moved)
        {

            lastTouchPos = new Vector3(touch.position.x, touch.position.y, Camera.main.farClipPlane);
        }

        if (touch.phase == TouchPhase.Ended)
        {

            Vector3 firstTouchWorldPos = Camera.main.ScreenToWorldPoint(firstTouchPos);
            Vector3 lastTouchWorldPos = Camera.main.ScreenToWorldPoint(lastTouchPos);
            Vector3 diffWorldPos = lastTouchWorldPos - firstTouchWorldPos;
            direction3D = diffWorldPos.normalized;
            power = diffWorldPos.magnitude * (force / Time.deltaTime);

            Ray firstTouchRay = Camera.main.ScreenPointToRay(firstTouchPos);
            Ray lastTouchRay = Camera.main.ScreenPointToRay(lastTouchPos);

            RaycastHit hit;
            Debug.DrawRay(firstTouchRay.origin, lastTouchRay.direction - firstTouchRay.direction, Color.red, 50.0f);

            if (Physics.Raycast(firstTouchRay.origin, lastTouchRay.direction * 100, out hit))
            {
                Vector3 hitLocation = hit.point;
                if (hit.collider.tag == "Coin")
                {

                    projectedVector = Vector3.ProjectOnPlane(direction3D, plane.normal);
                    coinRigidBody.AddForceAtPosition(projectedVector * power, hitLocation * 5);
                    throwCoinObject.throwWithForce(power, hitLocation, direction3D);
                }
            }
        }
    }
}

The Code is working but my only problem is that it goes only in a certain direction? And it seems that direction is manipulated by how the camera is facing the objects.
I just want it to hit the first touch origin then move to the direction the swipe was made.

Help would be really appreciated

sentences:
What AI technique should I use to control a car in a bumpy environment? What kind of AI can you recommend controlling a car in a level where there are hills, sharp turns, straight parts, et cetera?

There is AI in the game already. It uses points on the road to which the car accelerates and when it gets closer, the next points is taken. These points are predefined.
The problem is AI-controlled car are not fast enough compared to a human controlled car.
The difference is about 14 seconds, so what methods can you recommend to speed up cars?

Increasing just maximum speed of the cars does not help, because then, they do not take turns fast enough. Do you know a solution for this?
Do you know a resource where this problem is looked at and solved?

sentences: How to draw an arc between two angles? I'd like to draw an arc between two specific angles. For example, "draw an angle between 0 and 90 degrees" and it will draw only that part of the circle and ignore the rest.

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:
Workflow with Flash Pro CS6 and FlashDevelop: Using fla and swc to store assets I am using this tutorial:

http://www.flashdevelop.org/wikidocs/index.php?title=AS3:FlexAndFlashCS3Workflow

In the past older versions of Flash Pro I was able to complete these steps:

right-click on the symbol in the Library panel, select "Linkage..." dialog,
check "Export for ActionScript" and fill in the symbol name (ie. MySymbol_design or assets.MySymbol_design),
do not change the base class (ie. flash.display.MovieClip).

Right now, I am stuck at that part. Any hints?

What I wish to do is:

Use fla for the artist to store assets.
Publish to swc
Extract the assets in FlashDevelop by creating an instance of their class.

... How is this done in CS6?

To clear things up, this is what I see when I right click a Flash symbol:

sentences:
Changing AnimationOverrideController "sometimes" fails - Unity 5.2.1 I have the following code, in a menu where you can chose the armor and weapon of a character:

private List<string> armors = new List<string> { "armor1", "armor2", "armor2" };
private List<string> weapons = new List<string> { "weapon1", "weapon2", "weapon3", "weapon4", "weapon5", "weapon6", "weapon7", "weapon8", "weapon9" };

private int  armor_index = 0;
private int weapon_index = 0;

public GameObject avatar_body;
public GameObject avatar_weapon;

void Update() {
         if (Input.GetKeyDown(KeyCode.RightArrow)) nextArmor();
    else if (Input.GetKeyDown(KeyCode.LeftArrow))  previousArmor();
    else if (Input.GetKeyDown(KeyCode.DownArrow))  nextWeapon();
    else if (Input.GetKeyDown(KeyCode.UpArrow))    previousWeapon();
    else if (Input.GetKeyDown(KeyCode.Return))     loadLevel();
}

void nextArmor() {
    if (armor_index < armors.Count - 1)
        armor_index += 1;
    else
        armor_index = 0;

    setArmor();
    setWeapon();
}

void previousArmor() {
    if (armor_index > 0)
        armor_index -= 1;
    else
        armor_index = armors.Count - 1;

    setArmor();
    setWeapon();
}

void nextWeapon() {
    if (weapon_index < weapons.Count - 1)
        weapon_index += 1;
    else
        weapon_index = 0;

    setWeapon();
}

void previousWeapon() {
    if (weapon_index > 0)
        weapon_index -= 1;
    else
        weapon_index = weapons.Count - 1;

    setWeapon();
}

void setArmor() {
    avatar_body.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/body" ) as AnimatorOverrideController;
}

void setWeapon() {
    avatar_weapon.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/"+weapons[weapon_index] ) as AnimatorOverrideController;
}

The problem is when I start switching between the weapons, sometimes the sprite showing does not update. Inspecting the GameObject, it is weird, because the Animator Component has successfully updated, but the Sprite Renderer still shows a fixed sprite from the last Animator.

Here are 2 examples:

Here we see that the animator is set for the weapon Gladius, and that the Sprite renderer is looping through all the frames of that animation

Here we can see that even though we have moved to the Flanged mace animator, the Sprite Renderer is still stuck on a sprite of Gladius

The problem is hard to recreate, because it happens just SOMETIMES. If I were to switch back to gladius and then once again back to flanged_mace...

Now it works... but I didn't change anything.

What is going wrong??

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:
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:
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:
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:
Proper approach to handle transformation matrix and extract its components Basically I have a Transformation component object with following structure(pseudo):

TransformComponent{
  Vec3 position;
  Vec3 rotation; //in euler angles
  Vec3 scale;
  Mat4 worldMatrix; //transformation matrix in world space
  Mat4 localMatrix; //transformation matrix relative to parent transform
  Mat4 worldToLocal; //Matrix to convert children worldMatrix in localMatrix
  TransformComponent parent;

  /* calculates worldMatrix using position,rotation & scale.
   * Also calculates inverse of worldMatrix and stores it in worldToLocal;
   */
  void CalculateWorldMatrix();

}

Then I do some transformations like:

    transform.position = [1,1,1]; //set new position

    transform.CalculateWorldMatrix(); //recalculate worldMatrix with new translation coordinates.

    //Multiply worldToLocal with worldMatrix in order to get localMatrix.
    localMatrix = transform.parent.worldToLocal * transform.worldMatrix;

After that, I have localMatrix with position, rotation etc relative to parent transform.
But I can't figure out how to get components(position,eualerAngles,scale) out of localMatrix. As far as I googled I found some really difficult solutions, which I couldn't understand, and as I'm writing on JavaScript I hope there is a simple solution.
Maybe I am using wrong structure for transform object?
What is the common approach here?
I read that its preferred to use quaternions, but only advance they give is about gimbal lock, at this moment because of simplicity I would like to stick with euler angles if it's possible.

sentences:
Use libgdx box2d for dynamically generated top down map So, I've already found some information on how to use box2d and tiledmap together.

Since I want to generate my top down map (100 by 100 tiles), I thought about only using box2d.

The tiles would be fixed and only the player (and maybe some other movable parts like chests, etc) would be dynamic. I'd also like to use box2dlights later, so using box2d seems convenient.

My only concern on this is the performance. I haven't used box2d much, so I don't know how it handles such a big amount of boxes (though not all 10000 tiles would be visible at the same time).

Does anyone know how the performance would be influenced or advice on how to achieve this easier?

Thanks in advance

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:
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:
Drawing more that one quad with only one glDrawArray call....? Edit

After initially thinking that my sprite batch test was faster than calling each sprite individually, it appears that is not the case!! :-(

With a single set of GL calls for a each sprite, I can get about 90 quads to move with no performance degradation.

With my batching test I can get about 12 (all in one call).

The problem is that I can't find any examples (code) anywhere for how this can be achieved using Android (Java) and OpenGL ES 2.0.

My method involved passing in an array of coordinate sets instead of a single set of coordinates, and then the method would build an array to store these coordinates in and then render the relevant amount of vertices.  Like I say, it works but the performance is awful!! Is this the right approach?

Could anyone help? Thanks!

I'm using Android with openGLES 2.0 and I can't work out how to draw 2 (or more, but for the sake of simplicity, lets say 2 for the time being) textured quads using only 1 call to glDrawArrays.

My shaders are fairly standard and take into account sprite opacity as follows:

//vertex shader
    String strVShader =
              "uniform mat4 uMVPMatrix;" +
              "attribute vec4 a_position;\n"+
              "attribute vec2 a_texCoords;" +
              "varying vec2 v_texCoords;" +
              "void main()\n" +
              "{\n" +
              "gl_Position = uMVPMatrix * a_position;\n"+
              "v_texCoords = a_texCoords;" +
              "}";

//Fragment shader

    String strFShader =
        "precision mediump float;" +
        "uniform float opValue;"+
        "varying vec2 v_texCoords;" +
        "uniform sampler2D u_baseMap;" +
        "void main()" +
        "{" +
        "gl_FragColor = texture2D(u_baseMap, v_texCoords);" +
        "gl_FragColor *= opValue;"+
        "}";

Then my rendering method takes in vertices that set the position and size of the quad, set the texture, apply rotation (if any) etc...

And then draws with the following line:

GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

I've been looking for a couple of days now for examples of how this can be achieved, but nothing seems to explain how it is actually done.

Can anyone give me any clues?

Note: To keep the question short, I have omitted my actual draw method.  If this is required to give a fuller answer, please just ask and I will post.

Also please note that I need to do this as I'm trying to work out how to batch my sprites to increase performance.

sentences:
How does code translate to graphics? I know this is kind of a basic question, but I'm trying to create my own game from scratch and really don't understand this. How does the code of a videogame program certain pixels to be certain colors and then move them in agreement with the player's movement?

For example, in a 2D platformer, how does the code program the on-screen visuals of the world that the player is in? And then, how does it move a certain object matching the speed of the player and then eventually have it go off screen?

Thanks in advance!!

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:
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:
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:
Rendering multiline text with SDL_TTF Can you use any function to render more than a line of text in a surface?

If you can't do this, what whould be the way to go?
I am doing the following: Create a surface (not sure if should be a software or a hardware one) and then create as many surfaces as lines my text have, then blitting all the surfaces, and freeing all the surfaces. But this turns to be very slow. This is the code:

void Text::updateSurface() {
    if (surface != NULL) {
        SDL_FreeSurface(surface);
    }

    TTF_Font * font = TTF_OpenFont(fontPath.c_str(),size);
    if (font == NULL) {
        ERROR("Null font"<<TTF_GetError());
    }

    int maxWidth = 0;
    int totalHeight = 0;

    std::vector<SDL_Surface *> surfaces;
    for (size_t i=0; i<lines.size(); i++) {
        SDL_Surface * partialSurface = TTF_RenderText_Solid(font, lines[i].c_str(), color);
        if (partialSurface == NULL) {
            ERROR("surface == NULL: "<<TTF_GetError());
        }
        surfaces.push_back(partialSurface);
        totalHeight += partialSurface->h;
        maxWidth = std::max(maxWidth, partialSurface->w);
    }

    TTF_CloseFont(font);

    surface = SDL::allocateSurface(maxWidth,totalHeight);
    if (backgroundColor != NULL) {
        SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format,backgroundColor->r, backgroundColor->g, backgroundColor->b));
    }
    totalHeight = 0;
    for (size_t i = 0; i < surfaces.size(); i++) {
        SDL_Rect dst = {0, totalHeight, 0, 0};
        switch(aligment) {
        case ALIGMENT_RIGHT:
            dst.x = maxWidth - surfaces[i]->w;
            break;
        case ALIGMENT_CENTER:
            dst.x = (maxWidth - surfaces[i]->w) / 2;
            break;
        case ALIGMENT_LEFT:
        default:
            break;
        }
        totalHeight += surfaces[i]->h;
        SDL_BlitSurface(surfaces[i],NULL,surface,&dst);
        SDL_FreeSurface(surfaces[i]);
    }
}

This is the code for SDL::allocateSurface(...)

static SDL_Surface * allocateSurface(int width, int height, int bpp = -1, Uint32 flags = 0)

SDL_Surface * SDL::allocateSurface(int width, int height, int bpp, Uint32 flags) {
    if (bpp == -1) {
        bpp = SDL::bpp; //SDL_GetVideoInfo()->vfmt->BitsPerPixel;
    }

    if (flags == 0) {
        flags = SDL_HWSURFACE;
    }

    Uint32 rmask, gmask, bmask, amask;

    #if SDL_BYTEORDER == SDL_BIG_ENDIAN
        rmask = 0xff000000;
        gmask = 0x00ff0000;
        bmask = 0x0000ff00;
        amask = 0x000000ff;
    #else
        rmask = 0x000000ff;
        gmask = 0x0000ff00;
        bmask = 0x00ff0000;
        amask = 0xff000000;
    #endif

    return SDL_CreateRGBSurface(flags, width, height, bpp, rmask, gmask, bmask, amask);
}

sentences:
GLSL - Only draw arond point / flashlight effect I'm currently trying to achieve a sort of flashlight effect in GLSL. I only want to draw textures within a certain distance of a specified point (the mouse position, for example). Here's a quick example drawing of the effect I wish to achieve:

I've successfully created a shader that checks the position from a certain point to the position of the fragment, and then discards the fragment if the distance is larger than the specified light radius. The frag shader looks like this:

#version 400

#ifdef GL_ES
precision mediump float;
#endif

in vec4 v_color;
in vec2 v_texCoords;
in vec2 v_position;

out vec4 outColor;

uniform sampler2D u_texture;
uniform vec2 u_mousePos;
uniform float u_lightRadius;

void main() {
    float distance = distance((v_position + 1.0) / 2.0, u_mousePosition);
    if(distance > u_lightRadius) {
        discard;
    }

    outColor = v_color * texture2D(u_texture, v_texCoords);
}

The problem with this shader is that the visible area isn't a circle, it's an elipse. This is obviously because the screen aspect ratio is not 1:1. I've tried multiplying the Y values of all of the position variables with a resolution uniform, but it still remains an elipse.

My other problem is that I wish to have smooth edges on my visible area. I've read up some on the subject and I see that you can use mix and/or smoothstep to achieve this, but I'm unsure on how to implement it.

Anyone got any suggestions?

sentences:
Setting object-specific uniforms in a render queue I am currently trying to write a (very simple) queued renderer using OpenGL. My current idea looks like this:

struct RenderCommand {
    GLUint  vao;
    GLUint  texture;
    GLUint  shader;
    GLInt   zOrder;
};

void Renderer::addCommand(const RenderCommand& cmd) { /* add to queue */}

void Renderer::render() {
    /* sort the command queue to try and z-sort, batch textures, etc. */

    for(const auto& cmd: queue_) {
        // Bind shader/vao/texture when necessary, issue draw calls
    }
}

Now my problem is this: for sprites for example, I only have one set of quad vertices on the GPU, and I send the sprite vertex shader the sprite size using a uniform. Same goes for the model transform matrix for literally any object. That's okay when render calls issued when iterating over scene objects, but becomes a problem when everything is queued: since most sprites will use the same shader, how do I set the uniform?

I've had a few ideas for solutions, but none of them feels right:

Add data in RenderCommand for size, model matrix, etc. The big problem with that is flexibility: it supports the engine's default sprite (or 3D model or text) shader, but custom shaders with other uniforms won't work.
Add a custom data pointer to RenderCommand to point to uniform data to send before rendering. This is probably the most flexible option.
Add a UniformCommand type, which only uploads a uniform to the currently bound shader. It'll have to be handled carefully when the queue is sorted, to ensure it stays contiguous with whatever shader and model it corresponds to, but that sounds feasible.

sentences:
Collision response using the Minimum Translation Vector I am trying to use the Minimum Translation Vector (MTV) returned from the SAT algorithm for simple collision response. Please see the example below.

By separating the colliding boxes by moving the black box along the MTV, the box is now colliding with the other green box below. Moving the black box along the MTV for the collision with this new box then brings the box back to colliding with the first box, and an infinite cycle of trying to separate the boxes begins.
Am I missing something, or is collision response not possible using the MTV?

sentences:
How can I set decimal values to a Pygame rect position? I'm trying to make the gravity a bit slower, like

Dog.rect.y += 0.5
print (Dog.rect.y)
screen.blit(background, (0, 0))
screen.blit(spikeUp0.image, (0, 0))
screen.blit(spikeDown0.image, (0, 436))
screen.blit(Dog.image, (Dog.rect.topleft))
pygame.display.update()

But the dog floats. The minimum I get set to y 1 with rect methods. How can I make it slower?

Here is the complete code in GitHub Gist

sentences:
Monogame apply tint to only some parts of sprite Each player is a different colour (Red, Blue, Green, Yellow) and I want a small part of each piece of armour to be tinted to the player colour.  Is this possible without using a second armour sprite that overlays?

I'm hoping for something along the lines of reserving a certain portion of colours (say various shades of magenta) to convert back to a player colour while drawing.

sentences:
Coverting byte[] from stereo to mono produces crackling in OpenAL I'm trying to convert a Stereo byte[] to mono byte[]

Here is my code :

    private byte[] ToMono(byte[] data)
    {
        byte[] newData = new byte[data.Length / 2];

        for(int i = 0; i < data.Length / 4; ++i)
        {
            int HI = 1; int LO = 0;
            int left = (data[i * 4 + HI] << 8) | (data[i * 4 + LO] & 0xff);
            int right = (data[i * 4 + 2 + HI] << 8) | (data[i * 4 + 2 + LO] & 0xff);
            int avg = ((right + left) / 2);

            newData[i * 2 + HI] = (byte)((avg >> 8) & 0xff);
            newData[i * 2 + LO] = (byte)((avg & 0xff));
        }
        return newData;
    }

It converts to mono alright, but It produces crackling in OpenAL.

It seems that if I compile with "int avg = left;" The crackling stops. But I wanted to mix down both channels.

What is wrong with my code? How can take out the crackling?

sentences:
Changing color of UI Text in Unity into custom values There are a few objects in the scene as well as a title. I want the title to change its text and color based on the object that is mouse-overed. The script below is added to each object that is intended to change the color and text of the title.

The title changes it's color correctly when values like Color.red are assigned but doesn't change color when values like new Color(254f, 152f, 203f).

public Text title;

void OnMouseEnter()
{
    switch(name)
    {
    CONDITION1:
        title.color = Color.yellow;  // works well
        break;

    CONDITION2:
        title.color = new Color(254f, 152f, 203f);  // doesn't work
        break;
    }

    title.text = name;
}

void OnMouseExit()
{
    title.text = "DEFAULT VALUE";
    title.color = Color.white;
}

Is there a specific reason to the former method to work and latter not to work? How can I change the color of the Text element with custom values?

sentences:
RWTexture3D in Compute Shader on Intel HD 4000 I'm having some weird issues running a Compute Shader with DirectX 11 on an Intel HD 4000 GPU.

The goal is to write different shapes into a DXGI_FORMAT_R32_FLOAT 3D Texture with a size of 128x128x128 - the example below creates a sphere.

On a NVidia GTX 680 the texture is generated fine, but on an Intel HD 4000 it seems the Z-coordinate/3D texture slice coordinate is multiplied by 4 (see image below).

The drivers for the Intel GPU are up to date (Dec 2015). The compute shader is executed only once, immediately after initializing DirectX swapchain/viewport/... and I disabled all other render code in the application which could influence the compute shader.

I'm running DirectX with D3D11_CREATE_DEVICE_DEBUG enabled which prints no warnings/errors and shader compilation returns no error messages either.

In this picture you can see the 3D Textures generated by the two GPUs in comparison - the slices of the 3D texture are placed besides each other:

DirectX Code:

// INITIALIZATION

//loads & compiles shader from file
ID3D10Blob* computeShaderbuffer = m_Context->loadShaderFile(compute_shader, "cs_5_0");

device->CreateComputeShader(computeShaderbuffer->GetBufferPointer(), computeShaderbuffer->GetBufferSize(), NULL, &m_ComputeShader);

D3D11_TEXTURE3D_DESC desc = {};
desc.Width = m_dataSize.x; // 128
desc.Height = m_dataSize.y; // 128
desc.Depth = m_dataSize.z;  //128
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R32_FLOAT;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;

device->CreateTexture3D(&desc, nullptr, &m_DensityTexture3d);
device->CreateUnorderedAccessView(m_DensityTexture3d, nullptr, &m_DensityShaderWriteResource);

// EXECUTION
deviceContext->CSSetShader(m_ComputeShader, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &m_DensityShaderWriteResource, nullptr);

deviceContext->Dispatch(m_dataSize.x, m_dataSize.y, m_dataSize.z);

deviceContext->CSSetShader(nullptr, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &uav_null, nullptr);

Compute Shader:

RWTexture3D<float> output : register (u0);

[numthreads(16, 16, 1)]
void main(uint3 id : SV_DispatchThreadID)
{
    float3 size;
    output.GetDimensions(size.x, size.y, size.z);
    float3 center = size / 2.0f;

    float max_distance = center.x * 0.7f;
    float3 norm_position = float3(id) / size;

    output[id] = 1.0f - (length(float3(id)-center) / max_distance);
}

Am I doing something wrong or is it simply an Intel issue?

Thanks for your help!

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:
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:
My method for switching between cameras in Unity does not change the main camera I would like to be able to switch between a variable number of cameras in my scene.

The common approach requires toggling the active camera's 'enabled' property to true and setting the others to false.  This is an issue when iterating through the 'Camera.allCameras' array as it doesn't contain the inactive cameras.

I therefore thought that I could get around this by creating a local array of cameras during initialisation and then iterate through that:

using UnityEngine;
using System.Collections;

public class CameraSwitcher : MonoBehaviour
{
    int cameraIndex;
    Camera[] cameras;

    void Start()
    {
        cameraIndex = 0;

        // Assumes that all cameras are initially active in the scene
        cameras = new Camera[Camera.allCameras.Length];

        int i = 0;

        while (Camera.allCameras.Length > 0)
        {
            cameras[i++] = Camera.allCameras[0];
            Camera.allCameras[0].enabled = false;
        }

        // Does not get recognised as main camera when activated
        cameras[cameraIndex].enabled = true;
    }

    void HandleInput()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            cameras[cameraIndex].enabled = false;

            cameraIndex = ++cameraIndex == cameras.Length ? 0: cameraIndex;

            cameras[cameraIndex].enabled = true;
        }
    }

    void Update()
    {
        HandleInput();
    }
}

The two problems with this approach are:

1) I assume that all cameras in the scene are initially active

2) Setting the camera's 'isenabled' to true in the local camera array does not set the main camera and it therefore remains 'null'

How can I store all the cameras in the scene, regardless of their active status, iterate through the array and set the main camera based on the array index?

sentences:
How can I load a picture with alpha channel in JME? This code loads a picture into the game:

Picture mypic= new Picture("mypic");
        Texture2D tex = (Texture2D) assetManager.loadTexture("Textures/mypic.png");
        mypic.setTexture(assetManager, tex, false);
        mypic.setHeight(settings.getHeight());
        mypic.setWidth(settings.getWidth());

What have to be modified or add to show properly a picture with an alpha channel?

sentences:
Best practices for labeling game versions? Does anyone know if there's a best practice for labeling game versions.

I'm not sure if there's a standard name for it other than versioning but what I mean is basically:

1.0
1.1
1.2
1.3.1 beta

sentences:
Texture caching in 2D XNA game Developing on the XNA framework for Xbox, I have different 2D image resources being used depending on the level. At the end of a level, I'd like to leave as much loaded as is reasonable, so that the next time a level needs that resource, it's already loaded. However, there will be a great many resources, so I'm assuming that it's a poor idea to leave everything loaded always, simply because memory is limited. Is there a good way to know how much to reasonably unload to keep things running smoothly?

My idea: If the .net garbage collector supported soft references (like the JVM), I could change references to any resources not being explicitly used to soft references, and change them back or reload when they're needed again. That way the garbage collector, who knows the state of memory much better than I, can intelligently drop references as needed when loading new content. In other words, a simple cache. This soft reference construct doesn't exist in C#, however; is there an equivalent or some better way to handle this?

sentences:
Timing of coroutines in Unity is never precise I was looking an official example for coroutines in Unity here.

However, when I call WaitAndPrint the time taken is never exactly 5 seconds.

IEnumerator WaitAndPrint()
{
    float timeStart = Time.time;
    yield return new WaitForSeconds(5);
    Debug.Log(string.Format("Time taken = {0}", Time.time - timeStart));
}

if (Input.GetKeyDown(KeyCode.R))
    StartCoroutine(WaitAndPrint());

Instead, it varies around 5.003133.

This is most likely down to the frame rate, which makes me wonder how can I make sure that a coroutine takes the precise amount of time it should take despite the fluctuating frame rate?

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:
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:
Application.OpenURL not working I have a public void

Public void patreononclick(){Application.OpenURL("http://www.patreon.com/HubakaGs");}

Which supposed to open my patreon page when a button is tapped.
But when i tap the button in the built application, nothing happens.
I have assigned the function to the On Click() section of Button (Script).
I am building the game for android patform and i use Unity 2017.1.0p4 Personal.
How can i make the button to function properly?

Update:
I changed the function to
public void patreononclick(){
        Debug.Log ("the game should open patreon");
        Application.OpenURL("http://www.patreon.com/HubakaGs");
    }
But when the button is clicked, there is no message at the console.

sentences:
Texture rebind on android cause potential memory leak? After context lost, I have to rebind all my textures. I want to it the correct way, so I check each handle for availability. It's done by calling unloadFromVram(), and then loadToVram()

first unload:

public final void unloadFromVram()
{
    GLContextState.forgetTexture(handle); // invalidate cache

    if (glIsTexture(handle)) // check whether handle is still a texture instance.
    {
        glDeleteTexture(handle); // delete handle if it is a texture instance.
        handle = GL_NONE;
    }
}

upload again:

public final void loadToVram()
{
    handle = glGenTexture();

    GLESContextState.activateTextureInSlot(0, handle); // GL.glActiveTexture(glSlot) and GL.glBindTexture(GL.GL_TEXTURE_2D, texture);

    if (owner.isCompressed())
    {
        glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, textureData.getWidth(), textureData.getHeight(), 0, textureData.bytes);
    }
    else
    {
        glTexImage2D(GL_TEXTURE_2D, 0, format,textureData.getWidth(), textureData.getHeight(), 0, format, type, textureData.bytes);
    }
}

What have I investigated:

After doing so, most of my textures appears black or have invalid content (perhaps from other textures, or content which was bound to this handle before suspend).
If glIsTexture(handle) fails, and the handle has not to be deleted - the texture behaves just fine.
If I comment the whole check and deletion in unloadFromVram() - everything works just fine.

I suppose, if I won't delete bound handle - it will cause a memory leak, due to texture's data is still in memory, so I have to avoid it. What do I have to do with this?

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:
Implementing Screen Shake I'm looking to implement screen shake in a 2D top down game.
From an earlier Q on this exchange, I learned that noise values could be a good candidate, so I intent to try that.

But I wonder: is a screen shake more about rotating the 2D topdown camera, or about jittering the position of that camera?

Or does it really require both?

Additionally, I would like to know if a good screenshake would require motion blur? Something like rendering your world in 4 small micro-steps for each 60fps frame, maybe? Or can you shake the camera at 60fps with normal rendering and it still looks good?

The quality I am after is something like shown in this video. It's kinda hard to judge, but it seems that video does translational jitter only?

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:
Libgdx - multiple images in a group, best practices - also overdraw question I am trying to right a card game, that will have an image in the middle, a coloured border and potentially a symbol in the top left. I am using libgdx and a stage/scene2d.
The image will change depending on the suit (these are not your normal 52 deck type of cards), the border colour will change to match the suit, though this colour can be pre determined by the user so I can't pre-save coloured images (though I guess I could pre save about 15 diff colours and give the user a choice of 15) and the symbol will only be on some cards and not others.

As you can see from the two images I've added I have two diff images, border colours and symbols.
My question is relating to groups and overdraw.

I presume I should set up a group with 3 images in, and I'm hoping having this won't slow my game down as I will have potentially 30 cards on screen at once and 30 groups with up to 3 images in each could be a lot to draw. Is this right and will LibGDX be able to handle it fine?

How should I do the coloured border? Should I have the entire card a coloured rectangle and the image drawn on top? Would the draw method be trying to draw the coloured section underneath the image and thus wasting GPU/CPU time?
A friend of mine said I could just have a white image, and then set the colour using RGB values in the code? Is this possible? That would mean I could only have a single jpg which would be much better for apk size.

Or should I ignore using a jpg image and try and draw the coloured square using ShapeRenderer?

Thanks, I hope these questions aren't too many in one post.

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:
Collision between Mesh Plane and 2D Sprite I've just recently started programming using Unity and made a couple of games with it, I'm trying out more and more advanced stuff as I do more games, but right now...

I'm trying to make a game that's basically a way simpler clone of pokemon y/r/g/b (I'm only concerned about tile placement, player movement / collision, and dialogue boxes at this time)

I tried about 3 methods for tile placement and found that using a mesh worked best for me (using tiled and tiled2unity) and imported the tmx files into unity.

Now, I just dont know where to go from here.

Starting with the player, I don't want to add physics since most games like this doesn't really have physics involved. So I tried adding a box collider to the player then a controller that uses transform.translate. Unfortunately, I dont think the colliders work nicely with transform.translate.

In this scenario, is the best setup for the player simply just using a kinematic rigidbody2d then adding the code/methods to collide with the map? Also since translate might be a bad idea, is transform.position a better alternative to use? (note that the player moves in increments in a "tile-like movement", any comments or suggestions?)

I'm also quite surprised by the lack of simpler games such as this one. Most of the examples I can find online are physics based platformers and top-downs that use code like velocity, addForce, with physics components involved. Any available source code that I could study would be welcome.

(I've also posted this on Unity Forums but people frequent here more often)

sentences:
Deal Damage to Player I have to make a simple "avalanche" game to show I know how to use the physics and creating terrain. But I actually wanted to go a little above and beyond and actually give the player health so there is a actual purpose to dodging the sphere objects. I found a very useful guide on how to set up player health, the only thing is I don't know how to set up the player taking damage when he collides with a sphere. Here is the code I have for the players health

#pragma strict

public var health : float = 100f;                           // How much health the player has left.
public var resetAfterDeathTime : float = 5f;                // How much time from the player dying to the level reseting.
public var deathClip : AudioClip;                           // The sound effect of the player dying.

private var anim : Animator;                                // Reference to the animator component.
private var playerMovement : PlayerMovement;            // Reference to the player movement script.
private var hash : HashIDs;                             // Reference to the HashIDs.
private var sceneFadeInOut : SceneFadeInOut;            // Reference to the SceneFadeInOut script.
private var lastPlayerSighting : LastPlayerSighting;    // Reference to the LastPlayerSighting script.
private var timer : float;                                  // A timer for counting to the reset of the level once the player is dead.
private var playerDead : boolean;                           // A bool to show if the player is dead or not.

function Awake ()
{
    // Setting up the references.
    anim = GetComponent(Animator);
    playerMovement = GetComponent(PlayerMovement);
    hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent(HashIDs);
    sceneFadeInOut = GameObject.FindGameObjectWithTag(Tags.fader).GetComponent(SceneFadeInOut);
    lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent(LastPlayerSighting);
}

function Update ()
{
    // If health is less than or equal to 0...
    if(health <= 0f)
    {
        // ... and if the player is not yet dead...
        if(!playerDead)
            // ... call the PlayerDying function.
            PlayerDying();
        else
        {
            // Otherwise, if the player is dead, call the PlayerDead and LevelReset functions.
            PlayerDead();
            LevelReset();
        }
    }
}

function PlayerDying ()
{
    // The player is now dead.
    playerDead = true;

    // Set the animator's dead parameter to true also.
    anim.SetBool(hash.deadBool, playerDead);

    // Play the dying sound effect at the player's location.
    AudioSource.PlayClipAtPoint(deathClip, transform.position);
}

function PlayerDead ()
{
    // If the player is in the dying state then reset the dead parameter.
    if(anim.GetCurrentAnimatorStateInfo(0).nameHash == hash.dyingState)
        anim.SetBool(hash.deadBool, false);

    // Disable the movement.
    anim.SetFloat(hash.speedFloat, 0f);
    playerMovement.enabled = false;

    // Reset the player sighting to turn off the alarms.
    lastPlayerSighting.position = lastPlayerSighting.resetPosition;

    // Stop the footsteps playing.
    audio.Stop();
}

function LevelReset ()
{
    // Increment the timer.
    timer += Time.deltaTime;

    //If the timer is greater than or equal to the time before the level resets...
    if(timer >= resetAfterDeathTime)
        // ... reset the level.
        sceneFadeInOut.EndScene();
}

public function TakeDamage (amount : float)
{
    // Decrement the player's health by amount.
    health -= amount;
}

Thanks for the help guys, and helping me to learn unity.

sentences:
Rendering issues in Monogame when using shaders I am currently fiddling with Monogame, trying to work with Shaders and I have encountered a really weird issue. If the first ever draw in the application's lifetime is with a custom shader all further draws without a custom shader get this red tint (as if blue and green channels were set to 0):

(A is the correct one, the sprite is white and black)

The following code produced these:

spriteBatch.Begin(); // Use this for A
//spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, Gfx.MyShader); // Use this for B
spriteBatch.Draw(Gfx.PlayerStand2, new Vector2(10, 10));
spriteBatch.End();
spriteBatch.Begin();
spriteBatch.Draw(Gfx.PlayerStand2, new Vector2(50, 50));
spriteBatch.End();
spriteBatch.Begin();
spriteBatch.Draw(Gfx.PlayerStand2, new Vector2(80, 80));
spriteBatch.End();

And this is the shader:

sampler TextureSampler : register(s0);

float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
    return tex2D(TextureSampler, texCoord);
}

technique Shader1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

It all depends on the first draw - if I replace the first two lines with this:

counter++; // Starts at 0
if (counter == 1){ // Run only on the first draw
    spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, Gfx.GaussianBlur);
} else {
    spriteBatch.Begin();
}

They all become red. If I replace == with != they all display correctly.

I am using OpenGL for rendering. I am aware I could circumvent this problem by always using a custom shader but I fear that this is but a symptom of a greater issue that will come later to bite my bottom. Or hopefully something completely trivial that I missed.

Update: I tried to reproduce it in DirectX version and in this case the batch with the shader does not render, but the other sprites are not red.
I also tried to compile the files via Monogame Pipeline with the same effect.

sentences:
How can I find the valid words in a grid of characters? I am creating a game similar to Tetris, with two main differences: the screen already begins filled with tiles (like in Puzzle Quest for Nintendo DS and PC) and each individual tile has a letter in it. The player's objective is to eliminate tiles by forming valid words with them. Words are formed by placing letters next to each other, in any direction, except diagonally.

The player can move an entire row of tiles to the left or to the right or an entire column of tiles up or down, for as many spaces as he desires (if the movement of a row/column surpasses the limits of the board, the letter that crosses the limit will "cycle", appearing at the other end of the row/column). After the player's action, the game should check the entire board to look for valid words and remove the letters that form those words from the board. The letters above those that were removed will fall down in the place of those letters that were removed and new letters will drop from the top of the screen until the board is filled up again.

I have already written a linear algorithm that, given a sequence of characters, determines if it is a valid english word. The problem I am having is: how can I check for valid words on the board? Is brute force the only way? Testing all possible combinations from the board to see if they are valid is very slow, even for a small (5x5) board. Any help will be very appreciated, thanks!

sentences:
How do I toggle color writes in SlimDX 11/Direct3D 11 with FeatureLevel 10? I'm having trouble setting the RenderTargetWriteMask field of a RenderTargetDescription struct. I simply want to toggle color writes but every time I try to enable the color writes are changed back to zero. Here is the code:

BlendState bs = null, bs1 = null;

try
{
    RenderTargetBlendDescription rtBlendDesc = new RenderTargetBlendDescription()
    {
        RenderTargetWriteMask = ColorWriteMaskFlags.All,
        BlendEnable = false,
        BlendOperation = BlendOperation.Add,
        BlendOperationAlpha = BlendOperation.Add,
        DestinationBlend = BlendOption.Zero,
        DestinationBlendAlpha = BlendOption.Zero,
        SourceBlend = BlendOption.One,
        SourceBlendAlpha = BlendOption.One,
    };

    // default blend state
    bs = BlendState.FromDescription(_device, new BlendStateDescription()
        {
            AlphaToCoverageEnable = false,
            IndependentBlendEnable = false,

        });
    for (int i = 0; i < Constants.MaxSimultaneousRenderTargets; ++i)
        bs.Description.RenderTargets[i] = rtBlendDesc;

    // set default blend state
    _device.ImmediateContext.OutputMerger.BlendState = bs;

    // in debug you will see that the RenderTargetWriteMask field of each render target is set to 'None'...
}
catch (Exception e) { e.Handle(); F.DisposeResource(ref bs); F.DisposeResource(ref bs1); }

Update:
I'm not able to set any of the values stored in RenderTargetBlendDescription.

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:
Pixel Perfect 2D tiles I'm trying to make an 64x64 tilemap using Super Tilemap Editor & Unity but my tiles looks terrible. I did my research about pixel perfect 2D and all of the solutions were for pixel art, they didn't work for me.

I have the following tileset I made in Adobe Illustrator as an example

Tiles looks like this when placed in game (1x zoom)

I'm pretty sure they're not 64x64 in game, they also look pixelated probably because they're smaller than they actually are on camera.

So my question is, how can I calculate the correct camera size for 64x64 tiles and do I have to make any changes in order to make sprites look pixel perfect? I'm currently using 1080/64/2=8.4375 (vertical resolution / PPU / 2) as camera size.

sentences:
Restrict Up/Down rotation, detect angle upwards/ downwards I have an object using Quaternion.LookRotation() to look at target object, I would like to be able to restrict the rotation by being able to set the range that the object can rotate at, for example from 45 degrees to 180 degrees, this would mean the object does not rotate lower than 45 degrees and does not rotate higher than 180 degrees, currently my code looks like this:

void Start(){
    baseRotation = transform.localEulerAngles;
}
    Vector3 targetPos = Target.position;
    Vector3 dif = targetPos - obj.position;
    dif.z = 0;

    Quaternion lookAngle = Quaternion.LookRotation(dif, obj.up);
    print("angle: "+ Quaternion.Angle(lookAngle, Quaternion.Euler(baseRotation)));
    if (Quaternion.Angle(lookAngle, Quaternion.Euler(baseRotation)) < rangeMax - rangeMin)
    {
        targetR = lookAngle;
    }
        obj.rotation = Quaternion.Lerp(obj.rotation, targetR, Time.deltaTime * 100);
}

However this code makes sure that rotation both upwards and downwards equally does not exceed the same angle, which is not quite what I want, as I said I would like to set the start angle and the end angle. How would I do that? Could you post the code that would give me an idea?

Thanks in advance!

sentences: PokeMMO. How they do it? Well PokeMMO is a JAVA game project which basically is the original FireRed title for the GBA made online. They know this type of projects don't last long because of the copyrighted material used, but they somehow made their client extract resources from ROMS. So they don't offer any copyrighted material on their download. I wonder what technique they could be using for this? All I know is that they use LWJGL.

sentences:
Gameserver travel time checks I'm making a little RPG multiplayer game where each player can travel long distances. Traveling from point A to B can take up to 10 minutes and – once initiated – is an automatic process. Now, I am not quite sure how to go about this on the server-side, the server has to be the one telling the clients that the traveling player has arrived or not.

Do I have to run some sort of timer where I check every X seconds/milliseconds if all the traveling players have reached their destination in order to update the DB? (the characters are saved on the server to prevent cheating).

The way I imagined it was simply to capture the timestamp at the start of travel, then use the distance to calculate what the time should be when the player will arrive, and then run some sort of timer that checks each traveling players "start time" , "actual time" and "destination time", but since I have never done this before I'm not sure if this is a good way of doing it?

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:
Reconstructing 3D Rotation from 8 byte - Assistence required I am currently trying to load 3D models and animations into a program. The file format has no public description, so I am decoding them piece by piece. (I'm studying computer science and it's for educational purposes)

My problem is to restore 3 dimensional rotation from the skeleton files as the rotation is stored in 8 bytes only and I can't figure out how that data represents rotation around 3 axis. This is a sample skeleton with 11 joints:

                                   float |    float |    float             Bytes (hexadecimal values)
Joint  0: Parent: -1 Position: ( 0.000000|  0.000000|  0.000000) Rotation: 00 40 00 40 00 C0 00 C0
Joint  1: Parent:  0 Position: ( 3.042923| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint  2: Parent:  0 Position: ( 3.803955| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint  3: Parent:  0 Position: ( 4.482897| -0.000000| -0.085759) Rotation: 00 00 82 5A 00 00 82 5A
Joint  4: Parent:  1 Position: ( 0.824744| -0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  5: Parent:  2 Position: ( 0.694988| -0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  6: Parent:  3 Position: ( 0.509095| -0.000000| -0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  7: Parent:  4 Position: ( 0.609431|  0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  8: Parent:  5 Position: ( 0.609431|  0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint  9: Parent:  6 Position: ( 0.609431|  0.000000| -0.000000) Rotation: 00 00 00 00 00 00 FF 7F
Joint 10: Parent:  7 Position: ( 0.842106|  0.000000|  0.000000) Rotation: 00 00 00 00 00 00 FF 7F

which should form roughly this shape:

3-6-9
|
|2-5-8
||
||1-4-7-10
|||
 0

But as you can see, the joints only extend in the 1st dimension (excluding 1, 2 and 3 which do extend a little in the 3rd dimension) so the coordinates have to be relative to the parent (which makes perfectly sense in terms of a skeleton).

My problem is to figure out how the rotation is stored in the 8 bytes per joint.

Short example: joints 1, 2 and 3 have to store a 90° rotation for the skeleton to work ..
I allready did some research for different representations, but none can store arbitrary rotations around 3 axis in only 8 bytes, usually it takes double the space (4 floats) ..

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 only render part of an image in lwjgl/openGL I'm making a mining/building game in java using slick2D and I want to make it so you can only see a few blocks in any direction while you are underground. The best example I could find of what I want to do is the game miner dig deep.

One way I thought of doing it would be to have a large image and just draw transparent areas on it where you need to be able too see but even if that would be an efficient method I wouldn't be sure how to do that.

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:
What is a Game Engine? I am new to Game Development, All I have developed is some 2d Games, using Game Maker by YoYo Games. There game development is much more easy, just as simple as Drag and Drop.
But, Now I wish to evolve in Game Development, and wanna try some hands with the common programming languages like, Java, C++ or C. In order to achieve this, I came around the first topic, Game Engine.
So, What is Game Engine.?
That is a broad question, with various answers. I came out with some conclusion after reading various links,

Wikipedia:
A game engine is a system designed for the creation and development of video games. The core functionality typically provided by a game engine includes a rendering engine for 2D or 3D graphics, a physics engine or collision detection (and collision response), sound, scripting, animation, artificial intelligence, networking, streaming, memory management, threading, localization support, and a scene graph.
GameCareerGuide.com
It exists to abstract the (sometime platform-dependent) details of doing common game-related tasks, like rendering, physics, and input, so that developers (artists, designers, scripters and, yes, even other programmers) can focus on the details that make their games unique.
Engines offer reusable components that can be manipulated to bring a game to life. Loading, displaying, and animating models, collision detection between objects, physics, input, graphical user interfaces, and even portions of a game's artificial intelligence can all be components that make up the engine.

Now what I understand is, Game Engine takes care of all the common work, like physics, loading etc...
As far my question is concerned, what is a Game Engine (Programmatically)?
Is it a Library? With pre-defined functions and classes, which can be inherited? Or what so ever, what is it?

sentences:
How can I child one sprite to another? I am a newb at GameMaker.  I have a 2D map which you can move around.  I want to add pins to the map, such that when the map moves, the pins stay in the same position relative to the map.  By default, the map will move, while the pins remain stationary.

I have tried creating a sub-layer of instances on my map instance layer, but the depth of the sub-layer is always greater than the parent layer.  I have tried overriding the depth, but it gives me a warning suggesting unpredictable results.

I have searched the internet, but all I could find was overkill code which I am hoping is not necessary.  (And none of those suggestions directly addressed my question.)

How can I make it so that my pins move around with the map?  I would like to avoid using code for something so simple.

sentences:
Why is OpenGL provided with latest GeForce drivers so extremely slow? I'm writting a code in OpenGL and using two computers - an old and a new one.

On the old computer (which I use for debugging/creating implementation for the old GL) I have GeForce 5500 FX. Before windows reinstall on it, I had NVIDIA drivers with OpenGL 1.5. And everything worked perfectly. Games made quite good FPS, even with dozens or hundreds sprites.

However, after XP reinstall, I installed the drivers provided with my video card but it seems there's no OpenGL at all (mysterious 'GDI Generic' renderer). So I tried to download the newest NVidia drivers. After their installation I saw there's OpenGL 2.3 but when I runned my app it worked with extremely low FPS (about 0.25, I mean I had to wait four seconds for any app reaction) with only one sprite. And as I loaded smaller images, the FPS relatively increased, but on the new computer it's always (no matter how big and how many sprites) speed, so it must be the perfomance problem. Without any sprites, it seemed it worked normal, but game without graphics doesn't make any sense.

That's why I downloaded the oldest drivers for NVIDIA GeForce 5500 FX I found on the Nvidia site. But they're still providing OpenGL > 2.0 (2.1 exactly). The problem's the same.

I also tried to change all the properties of OpenGL to increase performance but it didn't help too.

So what can I do? I'd like to find drivers with OpenGL 1.5 but it seems they're not on the NVIDIA site and most people say it's the best to download they from there.

sentences:
Realistic intensity of a sun in Unity to match the outside world I am creating an ARCore application in Unity where I want to make lighting shadows that match the real lighting outside.

For this, I have made a rotational directional light that simulations the real sun. The suns altitude and azimuth angles is found from the phones GPS coordinates. In combination with the rotational sun, I will also have a hemisphere of directional lights simulation the sky. These directional lights will have different colors and intensities. The color and intensity of these I have found using the model presented by Preetham in the paper A Practical Analytic Model for Daylight. I need to properly scale the intensity of the sun and these sky lights to make the lighting conditions look as realistic as possible.

In order to make the Augmented objects have the same lightning conditions as the real objects, I need to make the intensity of the sun in Unity similar to the real sun. The Unity documentation reads that for light intensity:

  The value can be between 0 and 8.

I have been told that parameters like these in Unity have no coloration to the real world conditions. Are you aware of any good practices for setting the intensity of a sun in Unity or do you know of scientific method for 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 can I change tags on a Steam Workshop item? A few years ago, I posted a L4D2 modification to the game Workshop on Steam.
I'd like to be able to change the tags associated with the mod (currently, 'Weapons, UI') but it's not obvious to me how I should edit the mod profile to make this change.
If anybody can tell me how to do this, I'd appreciate it!

sentences: How to make enemies randomly choose a path and then come back if wrong one? So I'm making a 2D Tower Defense-game in Unity with C# where the enemy has to go to the base, but can go to the wrong path randomly and then turns around when the road ends. How can I achieve this?

sentences:
How to render an animated gif to the screen using SDL2? So, I have an animated gif that is 5 frames (not the same as what is seen in this tutorial). Upon opening, my gif is already animating, unlike the png in the above tutorial.
How can I render it to the screen using SDL2?

The code I have now only renders the gif when I close out the window, and even then, it is only for a split second and I can only see one frame. How can I improve my code?

This is the code that implements the game's main loop:

#include "game.h"

int main( int argc, char* argv[])
{
    init();

    SDL_Texture* texture = IMG_LoadTexture(renderer, "male_base-test-anim.gif");
    SDL_Rect base;
    base.x = 0;
    base.y = 0;
    base.w = 948;
    base.h = 335;

    bool quit = false;

    SDL_Event e;

    while( !quit )
    {
        //Handle events on queue
        while( SDL_PollEvent( &e ) != 0 )
        {
            //User requests quit
            if( e.type == SDL_QUIT )
            {
                quit = true;
            }
        }
    }

    SDL_RenderClear(renderer);
    SDL_RenderCopy(renderer, texture, NULL, &base);
    SDL_RenderPresent(renderer);

    SDL_DestroyTexture(texture);
    texture = NULL;
    exit();
    return 0;
}

sentences:
Black bar in beetween the image when Background move infinite I'm trying to scroll my background forever and so I'm using the background image twice. When the first one goes off screen, it should relocate to the end of the second one. However, there seems to be a black bar in between the two images and so it seems that the image is not being moved into place quick enough. What would be the algorithm to do such a thing to give the illusion of a continuous background? I've got this at the moment.i use this line of code for moving the background

>  for 1st sprite poistion

    >     sprite->setPosition(Vec2(0,0));
        sprite->setAnchorPoint(Vec2(0,0));

    for 2st sprite poistion

    > sprite2->setPosition(Vec2(sprite->boundingBox().size.width -10, 0));
        sprite2->setAnchorPoint(Vec2(0,0));

    void HelloWorld::sprite_move(){
    > sprite->setPosition( Vec2(sprite->getPosition().x-1, sprite->getPosition().y));
        sprite2->setPosition( Vec2(sprite2->getPosition().x-1, sprite2->getPosition().y));

        if( sprite->getPosition().x <-sprite->boundingBox().size.width){
            sprite->setPosition( Vec2( sprite2->getPosition().x + sprite2->boundingBox().size.width, sprite->getPosition().y));
        }
        if( sprite2->getPosition().x <-sprite2->boundingBox().size.width){
            sprite2->setPosition( Vec2( sprite->getPosition().x + sprite->boundingBox().size.width, sprite2->getPosition().y));
            }
        }

sentences:
Best way to let the player know there are multiple solutions to a problem?(and force them to play again) I am going to work on a map for my game that is in first person mode. This is the story(planned).

He is on a sinking ship and he wants to escape before the ship sinks. He has a few ways of doing so, either with the on board seaplane or an emergency raft. Both methods will lead the player to different maps in the game. So here is the question:

How can I notify the player that there is another way of "winning" the map if he chooses one. I do not want to just pop out and say "hey you could have used the boat" or even include a progress map of some sorts, but I still want the player to visit the map again in the future to figure out the paths. Any suggestions would be awesome.

The lighting would be dimmer as the scene is set at night. There will be blood, grease and other dirty stuff on the player's screen. The ship itself is most probably going to wobble around.

edit
Sorry that I didn't clarify, but I want to know methods to lure players to play the map again. Methods of letting the player know that there are different methods works, but I think that should not be the only method. I'll change the title.

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:
What is best method for 2D pathfinding in procedural world? I have been researching path-finding for 2D games and would like to create a system that allows A* to perform as best as possible over a near infinite world. This system is intended to manage not only the player's character but other AI that would wander the world in search of resources.

So far I have made grid based A* that I then modified into Theta* to smooth out the path. But I would like to change that to use navmeshes so I can reduce as many nodes as possible. I have looked in to delaunay triangulation and fortune's algorithm for voronoi but am unsure how that works on a large scale where I would want to generate more navmesh as the world is explored.

I have also considered quadtrees but they seem slower then navmeshes.

So my main question is, what would work on a near infinite procedurally generated world? And what is fastest quadtrees or navmeshes? If navmeshes are faster, are polygons better than triangles?

Thanks for any help!

sentences:
Calculate an AABB for bone animated model I have a model that has its initial bounding box calculated by finding the maximum and minimum on the x, y and z axes. Producing a correct result like so:

The vertices are then stored in a VBO and only altered with matrices for rotation and bone animation. Currently the bounds are not updated when the model is altered. So the animated and rotated model has bounds like so:

(Maybe it's hard to tell, but the bounds are the same as before, and don't accurately represent the rotated/animated model)

So my question is, how can I calculate the bounding box using the armature matrices and rotation/translation matrices for each model? Keep in mind the modified vertex data is not available because those calculations are performed on the GPU in the shader.

The end result I want is to have an accurate AABB the represents the animated model for picking/basic collision checks.

sentences:
Are there any good blogs or articles on the business of indie games? Interested in both successes and failures (and semi-successes).

Maybe this might be better at OnStartups but I think the game market is quite a bit different than the business market that's prevalent there (i.e. selling something that's fun instead of selling something that's useful)

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:
Polling events with SDL results in stuttering response when dealing with multiple objects I'm new to SDL programming and I'm not quite sure I got how it handles events.
Given an instance like this defined in "game.c":
static struct {

  SDL_Window* window;
  SDL_Renderer* renderer;
  BinaryTree* objects;

} game = { NULL, NULL, NULL };

(Which of course gets properly initialized)
My game loop is defined in the same file as follows:
void game_run() {

  bool closeRequested = false;

  while(closeRequested == false) {

    SDL_RenderClear(game.renderer);

    binaryTree_startIteration(game.objects);

    while(binaryTree_hasNext(game.objects)) {

      GameObject* gameObject = (GameObject*) binaryTree_getNext(game.objects);

      SDL_Event event;

      while(SDL_PollEvent(&event)) {

        if(event.type == SDL_QUIT) {

          closeRequested = true;
        }
        else {

          if(event.type == SDL_KEYDOWN) {

            gameObject_onKeyPressed(gameObject);

            if(event.key.keysym.scancode == SDL_SCANCODE_UP) {

              gameObject_onUpKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_DOWN) {

              gameObject_onDownKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_LEFT) {

              gameObject_onLeftKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_RIGHT) {

              gameObject_onRightKeyPressed(gameObject);
            }
          }

          if(event.type == SDL_KEYUP) {

            //
          }
        }
      }

      gameObject_onRendering(gameObject);
      SDL_RenderCopy(renderer, gameObject_getTexture(gameObject), NULL, gameObject_getDestination(gameObject));
    }

    SDL_RenderPresent(game.renderer);
  }
}

game.objects contains every object which has to be rendered (via game.renderer) onto the the window (game.window). So, on each frame game.objects gets iterated on and for each element various functions get executed, before its texture is loaded to the renderer.
Of course gameObject_onRightKeyPressed() is called only if the right key was pressed, so if this function is defined as
void gameObject_onRightKeyPressed(GameObject* gameObject) {

  gameObject->destination.x += 1,
}

On each frame that the right key is pressed, gameObject's texture will move by 1 pixel to the right.
This works perfectly if game.objects contains only one element, but if a second element gets added, only the first one will smoothly respond to my input, while the other will move by 1 or 2 pixels just once in a while by keeping the right key pressed. It's like the first element contained in game.objects "steals" the input, so that when the second element's turn comes, there's no input for it to respond to. What did I do wrong?

sentences:
anisotropic fog of war Here I am not talking about how to render fog of war, but how to model exploring of terrain in a more sophisticated way.

In a straight-forward approach, terrain explored by a game unit is simply represented by a circle whose radius is how far this unit can see. And visible area is just union of isometric circles. But I can tell that it is not the case in popular games.

Please take a look at the following screenshot from League of Legends, for example.

The sight of view is anisotropic. The shape of surrounding terrain is also taken in to account.

Any idea how this can be done?

sentences:
How can I create a tunnel/parallax/depth effect based on mobile device tilting? I would like to create applications similar to what's displayed in these videos:

VR Tunnel Live Wallpaper for Android
The parallax view Part 1

These mobile application are supposed to react to tilting of the phone, so I created a few 3D objects for this purpose in Blender (one similar shape - 2nd link), but I do not know how to move the back of this object in Unity because I am a beginner.

Can you give me some tips on how to figure this out? I’m not talking about a ready solution or something, I just do not know how to ask a specific question and I do not know what to do next.

sentences: (Unity 5) Force child object to be perpendicular to the ground? As i mentioned in the header, i want my MainCamera child object to stay perpendicular to the ground, any ideas?)

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:
Trying to understand 3D transforms by making an aircraft control script. How would you implement 3D transforms correctly in this example? I'm struggling to understand 3D transforms in Godot. (I know, I know...)
I'm trying my best to implement an aircraft control script, and I've gotten myself into gimbal lock hell. My controls work pretty well until the Y direction decides to flip, and now my controls to pull up make the plane go down, etc...
I've read the godot 3D transform documentation, but I still find myself looking for an "Aha!" moment.
I figured a good way for me to learn would be to post what code I have and see how others would implement the movement code using transforms correctly.
Thanks for any help in advance.
extends Spatial

# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var camera = $Camera
const SPEED = 7
const ROTATE_SPEED = 1.25
const MIN = 0.9
var rx = 0
var ry = 0
var rz = 0
# Called when the node enters the scene tree for the first time.
func _ready():
    pass

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
    self.transform.basis = Basis()
    if Input.is_action_pressed("movement_forward"):
        ry -= 1
    if Input.is_action_pressed("movement_backward"):
        ry += 1
    if Input.is_action_pressed("movement_left"):
        rx += 1
    if Input.is_action_pressed("movement_right"):
        rx -= 1
    if Input.is_action_pressed("rotate_left"):
        rz += 1
    if Input.is_action_pressed("rotate_right"):
        rz -= 1
    self.transform.orthonormalized()

    self.rotate_z(deg2rad(rz))
    self.rotate_x(deg2rad(ry))
    self.rotate_y(deg2rad(rx))
    self.transform.origin += -self.transform.basis.z * SPEED * delta
```

sentences:
Obstacle spawn constraints in Jetpack Joyride Jetpack Joyride: https://www.youtube.com/watch?v=3KENMuzsras

tl;dr

What's the best way to add constraints to obstacle spawning (algorithms) or how to design obstacle spawning to allow constraints?

More details and my understanding

I am trying to understand how to add constraints to a spawning algorithm and I'm using Jetpack Joyride as reference (although I don't mind a general answer, especially if you're not very familiar with the game). I am particularly interested in the electrical obstacles [see image], so I will only consider them from now on.

There is probably a list of such obstacles from which one is fetched and placed on the screen. But where and when you place them is extremely important. First, you want to make sure your obstacles are between some minimum height -the floor- and some maximum height -the ceiling-. Then you may also want some minimum distance between any two consecutive obstacles. Also you don't want to spawn them too often, otherwise the game becomes repetitive. Then clearly you want to avoid sequences of obstacles that are impossible to pass. Then in some moments obstacles tend to spawn closer to the ground than usual. And so on.

I have no idea how to integrate, design-wise, all these constraints into obstacle spawning.  I could probably have a lot of if statements and flags that are checked for each new item fetched from the available obstacles pool, but if I have a great number of constraints, the code may become very messy. I don't how this is approached in general.

sentences:
HTML5 game programming style I am currently trying learn javascript in form of HTML5 games. Stuff that I've done so far isn't too fancy since I'm still a beginner. My biggest concern so far has been that I don't really know what is the best way to code since I don't know the pros and cons of different methods, nor I've found any good explanations about them. So far I've been using the worst (and propably easiest) method of all (I think) since I'm just starting out, for example like this:

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var width = 640;
var height = 480;
var player = new Player("pic.png", 100, 100, ...);
also some other global vars...

function Player(imgSrc, x, y, ...) {
   this.sprite = new Image();
   this.sprite.src = imgSrc;
   this.x = x;
   this.y = y;
   ...
}
Player.prototype.update = function() {
    // blah blah...
}
Player.prototype.draw = function() {
    // yada yada...
}

function GameLoop() {
   player.update();
   player.draw();
   setTimeout(GameLoop, 1000/60);
}

However, I've seen a few examples on the internet that look interesting, but I don't know how to properly code in these styles, nor do I know if there are names for them. These might not be the best examples but hopefully you'll get the point:

1:

Game = {
   variables: {
      width: 640,
      height: 480,
      stuff: value
      },
   init: function(args) {
      // some stuff here
      },
   update: function(args) {
      // some stuff here
      },
   draw: function(args) {
      // some stuff here
      },
};
// from http://codeincomplete.com/posts/2011/5/14/javascript_pong/

2:

function Game() {
    this.Initialize = function () {

    }
    this.LoadContent = function () {
        this.GameLoop = setInterval(this.RunGameLoop, this.DrawInterval);
    }

    this.RunGameLoop = function (game) {
        this.Update();
        this.Draw();
    }

    this.Update = function () {
        // update
    }

    this.Draw = function () {
        // draw game frame
    }
}
    // from http://www.felinesoft.com/blog/index.php/2010/09/accelerated-game-programming-with-html5-and-canvas/

3:

var engine = {};
engine.canvas = document.getElementById('canvas');
engine.ctx = engine.canvas.getContext('2d');

engine.map = {};
engine.map.draw = function() {
    // draw map
}

engine.player = {};
engine.player.draw = function() {
    // draw player
}
// from http://that-guy.net/articles/

So I guess my questions are:

Which is most CPU efficient, is there any difference between these styles at runtime?
Which one allows for easy expandability?
Which one is the most safe, or at least harder to hack?
Are there any good websites where stuff like this is explained?

or...

Does it all come to just personal preferance? :)

sentences:
Changing color for each element in linerenderer not working I want to change color for each line (element) just like in color switch. But my code is not working. What I wanted is that the right line should turn blue then the down line should turn color red. What is wrong with my code?

void Start()
{
    lineGeneratorPrefab = new GameObject();
    DrawLine();
}

private void DrawLine()
{
    GameObject myLine = new GameObject();
    myLine.transform.position = start;
    myLine.AddComponent<LineRenderer>();
    LineRenderer lr = myLine.GetComponent<LineRenderer>();

    lr.positionCount = 4;

    lr.SetPosition(0, new Vector3(-2, 0, 0));
    lr.SetPosition(1, new Vector3(2, 0, 0));
    lr.SetPosition(2, new Vector3(2, -2, 0));
    lr.SetPosition(3, new Vector3(-2, -2, 0));
    lr.materials[2].color = Color.blue;
    lr.materials[3].color = Color.red;
}

sentences:
Changing colour of multiple prefab instances when dragging over them So I am having some issue trying to get it so that when I touch/mousedown that an instantiated prefab changes color and then with mouse down still any other prefab that mouseenters, that prefab should change color as well. the bit of code that i have is shown below. Nothing happens though, other than the one prefab that received the OnMouseDown changes color, but not the others OnMouseEnter. If i remove the if statement though, they do change color OnMouseEnter. Any suggestions on how to do this or what i may be doing wrong?
Thanks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Letter : MonoBehaviour
{
    Color clkColor = Color.red;

    private bool _clicked;

    void Start()
    {
        _clicked = false;
    }

    void OnMouseDown()
    {
        _clicked = true;
        this.GetComponent<SpriteRenderer>().color = clkColor;
    }

    private void OnMouseEnter()
    {
        if (_clicked == true)
        {
            this.GetComponent<SpriteRenderer>().color = clkColor;
        }

    }
}

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: Unity: Flip Sprite Direction I'm toying around with the new Sprite class in Unity, and I'm trying to work out how to change the direction the sprite is facing ("flip" it). I'm sure I can most likely just scale it across the x axis by -1, but I'd just like to know if there's a new, "official" way of doing it with Sprite or SpriteRenderer. Thanks!

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 to hide assets from user? ( e.g.: a png file ) I think the title is quite self-explaining, still this is a big area I think, so let me drop a few words:

I've got a simple experiment game project going, and I want to make sure, that the user isn't messing with the game assets like player skin etc.

In my opinion the best way would be that on production I would merge all the assets into one file and the application would check the hash of that file, so it could detect the corrupted data.

Is this an acceptable practice? There must be sum libraries / applications which are targeting this problem, could you guide me on this?

Project details: unix/linux, c++, sdl

sentences:
Unity access method from separate script I'm learning Unity3D and I'm practising accessing game object scripts from other objects. For the most part I've got it down, but I've run into a weird issue causing a NullPointerException.

I've set up a GameObject, with the following script attached to it:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {
public Player[] players;

// Use this for initialization
void Start () {
    players [0].currentPosition = 0;
    players [1].currentPosition = 1;
    players [2].currentPosition = 2;
}

// Update is called once per frame
void Update () {
    foreach(Player p in players)
    {
        if(p.mFormationType == Player.FORMATIONTYPE.ATTACK)
            p.transform.position = p.attackPositions[p.currentPosition];
        else
            p.transform.position = p.defensivePositions[p.currentPosition];
    }
}

public void swapPositions(Player selected)
{
    Debug.Log (selected.currentPosition);
    if(selected == null)
        Debug.Log("Balls - " + selected.gameObject);

    if(selected.currentPosition != 0)
    {
        int previousPos = selected.currentPosition;

        players[0].GetComponent<Player>().currentPosition = previousPos;
        selected.currentPosition = 0;
    }
}
}

And I've set the Player objects within the UI. I then later attempt to do this when I click on one of the Player objects:

void OnMouseOver()
{
    if(this.currentPosition == 0)
        return;

    if(Input.GetMouseButtonDown(0))
    {
        PlayerController pc = this.controller.GetComponent<PlayerController> ();
        pc.swapPositions (this);
    }
}

But it results in an NPE within the swapPositions method in the PlayerController class, when it attempts to access players[...]

I've stepped through and at the start of the PlayerController script they're all there and set up perfectly, but later on, they're null.

Can anyone explain why this is happening please?

Thanks in advance.

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:
Unity projects and building I've made my first game, in Unity, and I want to upload it to MediaFire.

I'm not sure what to upload. Should I upload the whole project, or is a certain part enough for someone to play it?

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: Emit light from items In order to create a day/night cycle in my game, I decreased the r,g and b values of the Color variable after a certain amount of time has passed. This worked as expected. I am wondering in order to create light from an item, like a fire or lamp, could I create a circle around the item and set the color in that circle to be white? Or is there a better way for accomplishing this in 2d?

sentences:
Understanding .obj file I downloaded a 3d model of a car. By judging by the skins and images available model treats wheels and car body as separate nodes. I want to access its child nodes (wheels) to specify animation.

But I don't know the names of its child nodes. Is it possible to figure out names of its child nodes by looking at the file content. I have a obj file of the 3D model.
I am using JMonkey 2.

EDIT
here is the link thefree3dmodels.

Thank you in advance

sentences:
Why do some games persistently have mostly one viable strategy, while others can have many? The interesting thing in League of Legends is the existence of the "meta", which, for the purpose of this question, can be defined as the One Strategy That Rules Them All. The meta shifts between patches; but soon after a patch is released, a new variation of the meta emerges and everyone agrees that this particular strategy is, in most cases, objectively best.

It's not that Riot Games doesn't try to migitate this. For instance, they introduced Runes that were supposed to allow personal preferences to be a bigger factor in gameplay – that is, allow a bigger diversity of viable strategies. But most such attempts backfire: there soon emerges the One Correct Rune Page For A Champ anyway.

Oddly, I am told and I read on Internet, this is not the case in Dota 2. (I don't know; I don't play Dota.) According to information I was able to gather, in Dota "nothing is slated in stone" and many heroes can be legitimately played in many roles, there exist multiple viable lane distributions and multiple viable strategies.

This seems counter-intuitive because of another difference between the two games that is frequently pointed out – that is, Dota embraces the concept of hard counters (i.e. if you pick a wrong hero pre-game and are hardly able to be relevant in-game then tough luck, you should've picked another hero), while LoL considers such mechanics broken and instead strives to provide soft counters mostly. Superficially, hard counters would seem to make a game lean towards "slated in stone" strategy (the correct pick is entailed by previous own team and enemy team picks), while soft-counters would seem to allow more diverse strategies thanks to allowing a greater variation of champs to pick in any given situation.

Might I ask, what exactly makes a game have One Strategy To Rule Them All, and what exactly makes a game have multiple viable strategies instead? I provided the examples of LoL and Dota because I think the difference is most striking given the similarity between the two games, but I believe the question easily applies to almost any competitive multiplayer game.

sentences:
Good map file structure? I need a map file structure for my game but does anyone know a good way to map it out? I was thinking something like this:

name=MyMap
add[floor[stone]][solid][20, 640]
add[playerspawn][20, 620]

sentences:
Do I always need to call SaveAssets & Refresh after calling AssetDatabase.CreateAsset? I'm working with AssetDatabase.CreateAsset and all over the internet (not so much in the official documentation) I see

AssetDatabase.CreateAsset(blah, blahPath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();

Why?

SaveAssets says it Writes all unsaved asset changes to disk so I assume that there's a situation in which you can have changes to your assets in memory, but not on disk. Is this the case when you create an asset with CreateAsset? I tried ending the Unity process right after creating a file but it looks like it writes to disk immediately, but I've only tried in-editor on Windows. Maybe it behaves differently in runtime or on different platforms.

Refresh says it will import any assets that have changed their content modification data or have been added-removed to the project folder. The editor UI gets updated when I call CreateAsset even if I don't Refresh, so is this for updates from other sources, or what?

I'm trying to understand the process and not do things just because everyone does it like that.

sentences: C# different resolutions compatible application Can you give me a quick tour for an application which has to work in different resolutions. It's a game, with lot's of graphics and images and effects. We are using C#. The game is simple 2D, looking like OGame but working like a desktop application. Our problem is how to make it compatible with different resolutions. What I expect you to give me is an advice - which technologies or combination of technologies and/or some basic tricks I should use to make my application work the same in different resolutions. Thank you!

sentences:
Unreal Engine: saving in-game images to disk without blocking game thread I am working on an Unreal based open-source UAV simulation (Microsoft AirSim) where I am trying to capture and save images from a camera that's attached to the drone. The image underneath gives an idea of how the game looks like. The rightmost view on the bottom is the actual view from the camera, the other two are just processed versions of the same image.

Right now the way it's set up in this way: There's a camera asset, which is read through the code as a capture component. The three views in the screenshot are linked to this capture component. The views are streamed without any problem as the drone is flown around in-game. But when it comes to recording screenshots, the current code sets up a TextureRenderTargetResource from this capture component, and subsequently calls ReadPixels and saves that data as an image (please see below for code flow). Using ReadPixels() as it is, is blocking the game thread directly and slowing down the whole game by a lot: drops from ~120 FPS to less than 10 FPS when I start recording.

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);
}

Looking at this article, it seems evident that ReadPixels() "will block the game thread until the rendering thread has caught up". The article contains sample code for a 'non-blocking' method of reading pixels (through removal of FlushRenderingCommands() and using a RenderCommandFence flag to determine when the task is done), but it doesn't significantly improve the performance: the rate at which images are saved is slightly higher, but the game thread still runs at about only 20 FPS, thus making it really hard to control the UAV. Are there any more efficient asynchronous methods that can achieve what I am trying to do, perhaps, say, in a separate thread? I am also a little confused as to why the code has no trouble streaming those images on-screen as fast as possible, but saving the images seems way more complicated. It's fine even if the images are saved to disk only at 15 Hz or so, as long as it doesn't interfere with the game's native FPS too much.

sentences:
Inside realtime lighting I have a small house with point light in it. But as you see, directional and sky lighting affect inside lighting. It's too bright.

How can I make that inside is only affected by point light and not by directional light. Or maybe just a small amount of directional light.

sentences:
Get / Calculate edges of a 3D object - C # I need to get all vertices in the edge position of a determinate object 3D (in this case a path).

See the image:

My question is, how can I get only the edges vertices, like the image?

sentences:
Job prospects for game QA/testers I'm currently a (happily employed) automated software tester that's curious about game testing/QA. Do game companies hire dedicated testers for pay? If yes, then what are the job prospects like? If no, then how does becoming a game tester work (volunteers? mixed roles? crowdsourcing?). Obviously game companies have full-time devs, artists, designers, managers, etc. but what does QA look like?

NOTE: I'm curious about how QA works in a game dev setting, but I'm not really looking for job tips or "Do this if you want to get into game QA".

sentences: missing editor version 5.5.1f1 on this machine. Select another version from the list unity missing editor version 5.5.1f1 on this machine. Select another version from the list unity am new to unity please help someone thanks

sentences:
How to handle objects on 2D Map I am making a 2D RPG game in Monogame XNA. For the moment I have 2 kinds of data in my game: sprites objects and tiles.
All the sprites are contained in a array list. I iterate over the sprites ArrayList to update and draw each sprites. Sprites objects are sort by their Y positions before each draw. This way, my character and other enemies can walk behind sprites. Sprites can be anything that require player interaction for example: chest, tree, enemy, player…
Tiles represent inanimate objects(2D array) (object that you cannot interact with) and only used for collision data and have a basic animation system.
However, for sprites collision checking I have to iterate over every sprites to do a bounding box overlap check.
My system works well, but I want to simplify things. What if I store static objects in my 2D tile array? I could just do getTile(x,y) to get the object stored in that position instead of going through my array list.
In the future I would like to have several types of objects, weapons, projectiles, and I want a consistent way to organize this.

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:
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:
Weird Animation Behavior in Unity I discovered a weird animation bug and have no idea how to solve it. Below you find the script I attached to my humanoid character.

using UnityEngine;
using UnityEngine.AI;

public class PlayerCharacter : MonoBehaviour {

    private Animator anim;
    private NavMeshAgent agent;

    private bool dead = false;

    void Awake()
    {
        this.anim = GetComponent<Animator>();
        this.agent = GetComponent<NavMeshAgent>();
    }

    public void Kill()
    {
        this.dead = true;
        this.anim.SetBool("Dead", true);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.X))
        {
            Kill();
        }
    }

    public bool IsDead()
    {
        return this.dead;
    }
}

My character makes use of the NavMeshAgent and can walk around and idle - everything works fine. But if I want to kill the player the dead animation loops continuously. This also happens if I change the death animation.

This is my AnimationController:

As you can see, the transition has the condition "Death" with is set to true in the Kill() method. The code for walking and idling in combination with the NavMeshAgent is similar, but the script shown above doesn't work as expected and I have no clue why the animation starts to loop continuously (which looks a bit funny btw). Additionally the animation is not played to end, it restarts after a few frames.

Any ideas? I could also post a video of the behavior if it would help.
Thanks in advance! :)

sentences:
Link CSS file with HTML file in Unity Power UI I want to link css file with html in Unity with the help of Power UI. I already converted css file into bytes format but it not still worked. Here is the code

    <link href="Resources/bootstrapUnity.css.bytes"/>

Hello Game

    <button type="button" class="btn btn-success btn-lg">Play</button>
    <button class="btn btn-info">Test</button>

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:
3D Flight with pure local rotation without roll creep I'm working on a flight race game with a specific constraint and cannot find a solution.
Hereinbelow, an image of a test scene.

My ship has a cylinder (children) in front of it from which I get a TargetYaw and a TargetPitch. Each of them is clamp between [-1,1]. After, I update my yaw and pitch angle of my parent object using this values.

private void UpdateYaw()
{
    _deltaYaw = Mathf.Lerp(_deltaYaw, _targetYaw, _yawAcceleration * Time.deltaTime);
    _yawAngle += _deltaYaw * _yawSpeed * Time.deltaTime;
}

private void UpdatePitch()
{
    _deltaPitch = _targetPitch;
    _pitchAngle = Mathf.LerpAngle(_pitchAngle, -(_deltaPitch * _pitchMaxAngle), _pitchAcceleration * Time.deltaTime);
}

This is where my constraint happens. My flying object upward vector must be align with the normal vector of the road it is following. But, at the same time, I need to keep the same controls over it. Hereinbelow how I get the angle to make this happens.

// hover
float _targetRoll = 0;
float _rollAngle = 0;
public float _rollAcceleration = 2;
private int layermask = (1 << 8);
private Vector3 oldDown = Vector3.down;
private Quaternion toRotation = Quaternion.identity, targetRotation = Quaternion.identity;
void UpdateHoverRoll()
{
    RaycastHit hit;

    if (Physics.Raycast(transform.position, oldDown, out hit, Mathf.Infinity, layermask) == true)
    {
        toRotation = Quaternion.LookRotation(transform.forward, hit.normal);
        oldDown = -transform.up;
        LocalRotationTarget = toRotation.eulerAngles.z;
    }
    _rollAngle = Mathf.Lerp(_rollAngle, _targetRoll, Time.deltaTime * _rollAcceleration);
}

So, now that I got my 3 angles I need to find a rotation system which after I apply my roll, pitch and yaw do not change how I control my ship. If I roll to 90 degrees, I must still yaw around my local up vector and pitch around my local right vector (my control don't get inverse) for exemple. Here an example of what i tried:

private void UpdateRotation()
{
    Quaternion q = Quaternion.AngleAxis(_turnAngle, Vector3.Normalize( Quaternion.Euler(0, 0, LocalRotation) * Vector3.up))
                   * Quaternion.AngleAxis(_pitchAngle, Vector3.Normalize(Quaternion.Euler(0,0,LocalRotation) * Vector3.right))
                   * Quaternion.AngleAxis(LocalRotation, Vector3.forward);
    transform.rotation = Quaternion.Lerp(transform.rotation, q, 1);
}

Thank you in advance.

PS : I am having difficulties to write this because my English skill are kinda low. Hopefully, it is still understandable, if not don't hesitate to ask/tell me.

sentences:
In Unity, how to get reference of descendant? I'm trying to get descendant game object, not a child. Let's assume that I have a GameObject and it's hierachy looks like this:

Weapon
- Hands
- metarig
  - upper_arm.L
  - upper_arm.R
    - forearm.L.001
      - hand.L.001
        - weapon.L.001
          - AttackDetection(!)
- Sword

I want to access "AttackDetection" from Weapon(Root) in script. But when I try this:

void Start() {
    attackDetectionGObject = this.transform.Find("AttackDetection").gameObject;
}

It fails with this:

  NullReferenceException: Object reference not set to an instance of an object

Looks like transform.Find just looking up it's own child, not descendant. I try to find way to solve this problem, but there's nothing I found.

Any advice will be very very appreciate it.

sentences:
How can I move the camera directly under a certain plane? I am attempting to render a "reflection" of a scene for water:

To create this illusion, I need to render the scene from below, and then ignore all geometry below the water line.

As such, I need to move the camera below the water, and invert the pitch.

I have one problem: My entire framework is based on the fixed-function pipeline. Basically, I need to call the correct glTranslatef() calls and glRotatef() calls to be able to simulate the camera being in the new position, and then render the scene.

Unfortunately, I have so far failed to achieve this. Calling the glRotatef() function obviously just rotates the entire scene, so I am struggling to just simulate the camera rotation.

The water is at a height of 300. I believe I may be moving the camera down correctly by calling glTranslatef(0, -(2 * (camera.y() - 300))), but it has been impossible for me to get them to both work.

sentences:
Change running tween speed I have words inside a tween and I need to slow down a tween that is already running and I am using updateTweenData to do so. All running tweens are in an array.

updateTweenData works, but the problem is, when I set the slower speed, words become closer together and when I set the normal speed, words space out.

Here's a jsfiddle that demonstrates the problem.
Just click slower/faster buttons and notice how words behave.

I want just the speed to change and everything else to remain the same.
How can I achieve this?

Best regards.

sentences:
Game Slowed by Particles in XNA I am developing an XNA game and am trying to improve the performance of the game by hiding objects that are not visible to the user.

My first thought was to use a BoundingFrustum based on the camera's view and projection matrices, and then only draw objects whose BoundingBox collides or is inside the frustum. However, trying to do this gave me very unpredictable results, with objects disappearing before going out of view and sometimes not showing at all at certain camera angles.

Has anyone else implemented a successful solution to improve their game's performance?

sentences:
Behavior tree implementation details I have been looking around for implementation details of behavior trees, the best descriptions I found were by Alex Champarand and some of Damian Isla's talk about AI in Halo 2 (the video of which is locked up in the GDC vault sadly).

However, both descriptions fall short of helping one actually create a BT, one particular question has been bugging me for a while.

When is the tree in a behavior tree evaluated?

Furthermore:

If the tree is in the middle of executing a sequence of actions (patrolling waypoints) and a higher priority impulse comes in (distraction sound) , how to switch to that side of the tree seamlessly without resorting to a state machine like system and if it is decided that the impulse was irrelevant (the distraction is too far away to affect this guard), how to go back to the last thing that the guard was doing ?

I have quite a few questions like this and I don't wish to flood the board with separate queries so if you know of any resource where questions like these can be answered I would be very grateful.

sentences:
on_Tween_tween_completed not triggering I'm using this script to print out my text in a textbox one character at a time, and to do this I'm using a Tween. I have this set up so that when the Tween sends the tween_completed signal, then the variable finished becomes true. But for whatever reason, the tween_completed signal never gets sent. Does anyone see a reason that the signal wouldn't be sent? Thank you!
extends Control

var tempdialog = [
    'Super Animal Racing is shaping up to be a great game!',
    'Thomas is so good at programming omg!',
    'Isn\'t this so exciting?'
]

var dialog_index = 0
var finished = false
var totalcharacters = 0

func _ready():
    load_dialog()

func _process(delta):
    $AnimatedSprite.visible = finished
    print("visible", finished)
    if Input.is_action_just_pressed("jump"):
        load_dialog()

func load_dialog():
    if dialog_index < tempdialog.size():
        finished = false
        $RichTextLabel.bbcode_text = tempdialog[dialog_index]
        $RichTextLabel.percent_visible = 0
        $Tween.interpolate_property(
            $RichTextLabel, "percent_visible", 0, 1, 1,
            Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
        )
        $Tween.start()
    dialog_index += 1

func _on_Tween_tween_completed(object, key):
    print("tweentrigger")
    finished = true
```

sentences:
What's the DSA version of glTexImage2D? I want to set the initial data of a texture in an OpenGL 4.5 program (using OpenTK.Next and .NET), utilizing the new Direct State Access methods.

However, I cannot find a DSA version of glTexImage2D. There are methods like glTextureSubImage2D which accept a texture object ID, but using those to set the intial data fails with InvalidOperation.

I'm pretty sure there should be such a method... comparing textures to array buffers, array buffers do have a DSA version to set their initial data, glNamedBufferData.

According to the documentation, the DSA methods are all named ...Texture... unlike the "old" methods which are named ...Tex..., but searching through them didn't reveal me something like glTextureImage2D.

Anyone knows if there even is a DSA method to set the initial texture data?

sentences:
How can I check if player is an operator in Forge? In Minecraft Forge, I would like to know if there is any way to find out if a player currently has vanilla "OP" / "Operator" status. I can't find a method that does this on the EntityPlayer Class.

I'd like something like:

EntityPlayer player = (EntityPlayer)sender;
if (player.getOpStatus) {
    [do some stuff]
}

sentences:
Collision detection between image and drawables I'm trying to collide my ball_1 to greengreen drawable. How can I determine the collision?

public  class MainActivity extends Activity  implements Runnable{

    private Imageview ball1

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ball1 = (ImageView) findViewById(R.id.ball_1);
        Drawable gr1 = new Drawable(R.drawable.greengreen)

        public void run() {
            startballanimation();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }//trying to use an if else statement here to collide imageview ball1 to drawable"greengreen"
        }
    }
}

sentences:
How to use "weighted average easing" correctly with variable framerate? I often use a weighted average for smoothly animating numerical values to a target value, like so:

frame(dt) {
    value = ((value*someFactor) + targetValue) / (someFactor+1)
}

As you can see dt (delta time) is not used at all, so the result is not the same for different framerates. How can dt be applied correctly here?

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:
Unity - Water Cube (to 2D game) I wonder if you can create a cube of water within the unity!

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

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

As shown below:

For this result:

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

Its possible?

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:
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:
Is it possible to add touch screen functionality to a Windows Standalone build for a Surface Pro? I have an application which is currently PC/ Windows Standalone, however I need it to be able to work with the touchscreen on a Surface Pro tablet when the same build is run on here. The interaction the user has is that of clicking buttons to open and close windows etc (all buttons use the OnClick() functionality), so any input required would just be simple button taps.

I simply need this to work on a Surface Pro touchscreen display when it is run on there, so mouse clicks to be replaced with taps of the buttons.

I've read many posts on the subject, but many are from Unity 4.6 and nothing conclusive for Unity 5. Many posts I found stated that this feature was introduced for Unity 5, but others suggest it is not supported and third party plugins are needed.

I don't currently have access to a Windows touch screen device, so am unable to do a quick check. I therefore want to make sure it is possible before I purchase a device and commit to the update.

From what I gather, the 'Standalone Input Module' has now replaced the 'Touch Input Module' which apparently had a checkbox to tick if you wanted to have it work in Standalone. As such a checkbox does not exist in the former, I am unsure whether this feature is still supported.

So I would like to know -

Is it supported in Unity 5?

If so -

Does it 'just work' automatically or does extra work need to be done to tell it to use touch screen if it is running on a Windows touch screen device?

Many thanks in advance

sentences:
Pygame surface rotation, rect rotation or sprite rotation? i seem to have a conceptual misunderstanding of the surface and rect object in pygame.

I currently observe these objects this way:

Surface

Just the loaded image

rect

the 'hard' representation of the ingame object (sprite). Used for simplifying object moment and collision detection

sprite

rect and surface grouped together

What i want to do is rotate my sprite. The only available method i found for rotation is  pygame.transform.rotate.

How do i rotate the rectangle, or even better, the whole sprite?

Below is the image of how i visualize this problem.

sentences:
What do auto handles do in AngelScript? I'm trying to figure out the purpose of the '@+' token in Angelscript, near the bottom of the page lists then as auto handles, and if I'm reading it right, then this in action would look like this:

Obj@+ ChooseObj(Obj@+, Obj@+);

void main()
{
    Obj@ A, B;

    {
        @A = new Obj();
        @B = new Obj();
    }

    // at this point A and B have a refcount of 1.
    Obj@ C = ChooseObj(A, B);
    //Let C = B, so A got decref'd and was deleted

    // this should be false, because the object's refcount was deleted,
    // but the pointer wasn't reassigned.
    if(A !is null)
    {
    //this should crash from an invalid pointer
        A.doMethod();
    }
}

Meanwhile, B got decref'd and incref'd, so it has a refcount of 1 when it gets returned, then gets addrefed again when it gets assigned to C. So C/B correctly has a value of 2, but that seems to be more a coincidence than anything.

In short I feel like I must be reading this wrong. What is it talking about?

sentences:
Control how quickly 2D vehicle straightens out I'm implementing vehicle movement in a 2D environment, where a vehicle consists of a front and a back "axle", both represented as 2D points. When the front axle moves, the back axle should follow in that direction, mimicking the way vehicles move. The way I have it right now looks like this:

After moving the front point A (white), I place B on the line between A and B such that a constant distance (the vehicle length) is kept. More accurately, I use the vector from A to B, normalize it, multiply it with the vehicle length, and add it to A, to get the new B. When searching for similar issues, I found this question's answer to come to the same technique.
As you can see, the resulting movement is quite recognizable as vehicle movement. The front also does not need to move as smoothly. Below I moved the front manually by dragging it around. As you can see, backwards movement also works perfectly:

I want to use this movement system as the back bone of a puzzle game, so its stiffness is actually an asset, since it is also quite predictable.
The only issue that I have is that it takes a good while for the vehicle to straighten out, by which I mean have the back come in line with the travel direction of the front. I'm looking for a way to control how quick this happens.
I have already played around with biasing/weighing the back point onto the line on which the front appears to be traveling, but that resulted in weird moving behavior for any other scenario than moving in a perfectly straight line. I also haven't been able to think of a different system that would inherently straighten out quicker.
So... I'm happy to try out any ideas that you might have!
Thanks!
Update 1: I've implemented the idea from @GaleRazorwind. This results in the back point moving away from the front point:

sentences:
Creating random nebulae for scrolling space background If you've ever seen a picture of space, you'll most likely see that there is some kind of pretty nebula in the background. I would like to find out how I could create random, semi-realistic looking nebula, so my current background (gif below) looks less boring. The reason I want it to be random is because it wouldn't make much sense for the same nebula to appear over and over again. I've heard that shaders might be what I'm looking for, but I've never even touched a shader, so I wouldn't know.

What I currently have:

sentences:
How can I get fastest region server in Photon C++ Client API? I am facing problem with my online multiplayer board game. It takes long time to create and join room. Also sometimes other player doesn't get the data. After searching all over the Photon C++ code I found this function :

void NetworkLogic::onAvailableRegions(const ExitGames::Common::JVector<ExitGames::Common::JString>& availableRegions, const ExitGames::Common::JVector<ExitGames::Common::JString>& availableRegionServers)
{
    EGLOG(ExitGames::Common::DebugLevel::INFO, L"%ls / %ls", availableRegions.toString().cstr(), availableRegionServers.toString().cstr());
    mpOutputListener->writeLine(L"onAvailableRegions: " + availableRegions.toString() + L" / " + availableRegionServers.toString());
    // select first region from list
    mpOutputListener->writeLine(L"selecting region: " + availableRegions[0]);
    mLoadBalancingClient.selectRegion(availableRegions[0]);
}

In the last line its just passing 0th region of the available regions. I think that region could be the slower one. Anyways, I am still facing the problem and I need help. Thanks.

sentences:
Where to update Player health text graphics? (C++) I am trying to update the text rendered on the screen after the health of a player changes. The problem I am having is deciding where to update this.
The player and health graphics are separate objects.

Currently,my code is organized like this:
The main c++ has vectors:

vector< Players>
vector< Renderables>

"Renderables" is anything that can be rendered. It has a member function render() which is called for every object in the vector.  A "Text" class inherits from it. It contains the string that is displayed on screen. "Text" has its own render function, and calls its member function getString() inside its render function.

The question is where do I update this string once the player's health has changed?

My current solution is actually to have a "PlayerHealth" subclass of "Text", which holds a pointer to the player.  That way "PlayerHealth"can just redefine getString() as player->health converted to a string, and using "Text"'s render function. But I've been told this wasn't a very good method and was wondering what other approaches there were to this problem.

Thank you for your time

sentences:
How do I wrap my web browser game as a standalone for Steam? I've got a PHP/Java based game, which runs in the browser. However, I want to submit this game to Steam.

Now Steam doesn't allow web-based games unless they come in some kind of wrapper.

How can I package my web broswer game so that I could distribute it through Steam?

sentences:
Unity List script field with +/- buttons in editor I am using Unity 2018.4.11f1 LTS. I have a script with a public List<GameObject> field.

In the property inspector, Unity provides a UI to this field where you specify the size of the list and then assign elements:

public List<GameObject> receivers;

My question is: Is there a way (perhaps a different field type) to have Unity provide an editor UI that consists of a +/- button where you can add and remove elements, rather than a list-size-based UI?

Something more along the lines of e.g. what it gives you for UnityEvents:

sentences:
How do you find games with a similar idea? I'm thinking about making an indie game and want to know if there's maybe one with similar idea.

I'm not asking about my idea specifically, I just want to know how to find out if a game has the same idea as the one I want to implement.

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:
How do I open/edit a *.xnb file in XNA Game Studio 4.0? I've downloaded a *.xnb font sprite, but I don't know how to open/edit it. I installed XNA Frameword 4.0 in VS 2010.
Thanks for your help!

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:
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:
Tags changing automatically on iOS build! First let me tell you that game runs fine in the editor. I check for hitting an enemy via a tag comparison and as I said it works correctly in the editor but when I deploy to my iPad and attach remotely with with MonoDevelop, I can see that the same object I'm checking against in Editor and had "Enemy" tag now has another tag, "Door".

Even before character doing anything, their tag is changed to "Door".

It's actually in the main menu and before running much code so I'm fairy certain it's not my code.

I'm sure there is nowhere in the code that I'm changing the tags.

And my specs: Unity is 5.6.1, Xcode is 8.3.3 and my iPad iOS is 10.3.2 and my macOS (OS X) is 10.12.5
(Tried with both Append and Replace builds)

Thanks

sentences:
Dealing with Spritesheets - resizing Let's say that I have a spritesheet with 4 sprites (standing, breathing player).

When I load it with

player_bitmap = BitmapFactory.decodeResource(resources, R.drawable.player_standing);

it sets it's width and height to for example 100/50 and I have to divide it by 4 and I get four sprites 25x50.

Problem is here that when I switch the app to tablet (I was on phone) sprites have different sizes when loaded.

How to solve issues like this?

Thank you

sentences:
How to solve this card game turn requestes clashing issue So I am developing a poker card game using JS +node.js + socket.io.

It is turn-based game. There will be a host and 4 other players.The flow is the players need to make a yes/no choice, then the host need to make a yes/no choice upon players' move, then players will need to make another yes/no choice, then the server will determine who wins.

Put simply,

1:Host set up the hand ----->2: inform all players----> 3:A player make a move(ticking yes or no) --> 4:this move will show up on the host's screen--->5:the host need to make his/her move(ticking yes or no)--->6: the host's move show up on players' screen, they make another yes/no choice----> 7:the server determine who wins.

The issue lies on step 5.

There will be multiple moves waiting for the host to process. Now the current design is all moves are shown by the form of a custom confirm box. It has yes/no button. It works perfect when there is only one host and one player. But when there is more than 2 players, there is a serious clashing problem.

If player A makes a move, it shows on the host's screen, and before the host ticking anything, player B makes a move and then player B's move (confirm box) will replace player A 's confirm box. In this case the host will not be able to process player A's move and the game cannot finalise.

How to get this clashing issue sorted? I hope I am not making this issue sound too complicated but I have been scratching my head.

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:
Can a .exe file ported from a program like NW.js or Electron be put console stores? I'm early in development working on a game in HTML5/JavaScript canvas, and I wondering if porting the game with some HTML/JS to .EXE converter would allowed it to be posted on consoles?

I think it should be possible, since Downwell(though made with an entirely different language) is a .EXE file, and is available on Switch and Playstation.

sentences:
Why are microtransactions more or less universally hated? In many games nowadays we see micro-transactions in the form of in-game purchases. The benefits of these purchases can be anything from disabling ads, cosmetic unlocks, or in-game currency. Here's an example:

That is of course an extreme example of pricey micro-transactions. But it seems that even more "reasonable" in-game purchases are more or less despised by the community as a whole, even though they are there to help monetize the game and without them the game wouldn't exist.

So why are micro-transactions so despised?

sentences:
projected textures not appear on the "back" of the mesh as well? I want to create blood wounds on my character's bodies by using projected textures. I've watched some commentaries on games like Left 4 Dead and they say they use projected textures for the blood.
But the way projected textures work is that if you project a texture on a rigged character, say his chest, it will also appear on his back.
So what's the trick? How to get projected textures appear only on one "side" of the mesh?

I use the Panda3D game engine, if that will help.

sentences:
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 are buttons made to be clicked? I just want to ask a general question. According to that answer, I'll continue thinking.

You know in games there are lots of clickable items. Play button, exit, combo-boxes, etc.

My question is: Are those buttons drawn in same canvas with background and all other things, or for every different thing there is another canvas object?

My question is a general sense. I'm not asking about a specific game, I'm asking how they are made generally.

I'm planning to start a game on Android, and I'm confused actually how to design buttons, and other object. Probably I'm going to use View/SurfaceView for now. I don't have much experience with OpenGL yet.

Thanks in advance.

sentences:
Unity 5.6 - Can no longer select empty GameObject with Gizmo in editor Has anyone else noticed this?
I'm using the latest version of Unity (5.6.0p2) and it appears Gizmos are no longer selectable by default.

Is there any way to restore this behaviour?

Some of my objects are essentially empty (no meshrenderer/Filter) with a MonoBehavior attached, which require a gizmo drawn sphere so it can be selected.

Is there a better/more appropriate way of making non-mesh gameobjects selectable in the editor that I'm not aware of?

I understand I could use Handles to detect a mouse click but this doesn't allow for simple drag selection (marquee tool) if I want to select a load at once.

sentences: anyone knows any open skeletal/bones 2d animations framework for java? Some examples could be the animations framework used in Aquaria, or in Crimson Legend.

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:
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:
Generate and then rasterize vector shape in Monogame/XNA I apologize if this is too broad, but I can't seem to find information on this anywhere (perhaps I am searching for the wrong thing?)

Anyways, I'm making a simple game where the player visits different, small, circular planets.  I've successfully made a simple circle texture directly with a for loop, but I've run into a few problems:

How can I easily add variation to the landscape (e.g. Perlin noise)
How can I detect where the surface of the planet is?
How can I easily add objects to the surface of the planet?

I realized that all 3 of these problems could most likely be solved if the planet was generated with a vector polygon.  Noise could be easily applied, and the normal of each edge could help with surface detection/object placement.

However, I could barely find any info on the subject.  Let me be clear - I don't want to directly render a vector shape; I want to invisibly create a semi-random polygon, and then create a filled-in texture based on that convex shape.

Is there any easy way to do this?  Is there a better way to execute this idea in general?

sentences:
Collision detection / physics for simple game I am currently working on a mini game for class (first time doing something like this) and I don't really know how to start with collision detection at all. The game I'm creating is a top down sumo fighting game on a icy circular arena where you move around gaining momentum and velocity and try to knock each other off to gain points.

So far I have the movement acceleration/friction pretty much down and I also have a system to detect when a collision occurs, I just don't know how to actually push the characters away when they collide. I think I will base the knock back amount/ damage on the velocity the attacker has against their velocity alongside the character's resistance stat that I will be adding. I also assume that I will have to do some intense math with like tangents and stuff to get the direction correct but I'm not sure how to do that at all.

I would greatly appreciate any help and I am open to future help if you want to assist me on this project later via Discord or something. Thanks for everything.

import pygame, sys, time
from pygame.locals import *
import random
import math

#Colors
colorRed=pygame.Color(241,59,62)
colorPurple=pygame.Color(200,254,249)
colorBlue=pygame.Color(52, 207, 235)
colorGreen=pygame.Color(100,182,100)
colorWhite=pygame.Color(255,250,250)
colorBlack=pygame.Color(0,0,0)
colorOrange=pygame.Color(242,164,0)
colorBrown=pygame.Color(148,103,58)

#Dimensions
w=800
h=600
pygame.init()
fpsClock=pygame.time.Clock()
screen=pygame.display.set_mode((w,h))
pygame.display.set_caption ('SUMO')
centerX=w//2
centerY=h//2

#Stage
stageR=250
def stage (centerX,centerY):
    """stage (centerX,centerY) - creates a stage with given centerpoint"""
    pygame.draw.circle(screen, colorBlue, (centerX,centerY),stageR)

#Character 1
xR=int((stageR//10))
x1=int(centerX-(stageR*0.8))
y1=centerY
x1_dir=0
y1_dir=0
def char1 (x1,y1):
    """char1 (x1,y1) - creates char1 at given coordinates"""
    pygame.draw.circle(screen, colorRed, (x1,y1),xR)
print (x1)
print (centerX)

#Character 2
x2=int(centerX+(stageR*0.8))
y2=centerY
x2_dir=0
y2_dir=0
def char2 (x2,y2):
    """char2 (x2,y2) - creates char1 at given coordinates"""
    pygame.draw.circle(screen, colorGreen, (x2,y2),xR)

while True:
    screen.fill(colorBlack)
    for event in pygame.event.get():
        #Game Exit
        if event.type== QUIT:
            pygame.quit()
            sys.exit()

    distance=math.hypot(x1-x2,y1-y2)
    if distance <= 2*xR:
        print ("HIT")

    keys = pygame.key.get_pressed()

    if keys[K_d] or keys[K_a]:
        x1_dir += 0.1 if keys[K_d] else -0.1
    else:
        x1_dir *= 0.98

    if keys[K_w] or keys[K_s]:
        y1_dir += 0.1 if keys[K_s] else -0.1
    else:
        y1_dir *= 0.98

# -------------------- CHAR2 MOVEMENT --------------------

    if keys[K_RIGHT] or keys[K_LEFT]:
        x2_dir += 0.1 if keys[K_RIGHT] else -0.1
    else:
        x2_dir *= 0.98

    if keys[K_UP] or keys[K_DOWN]:
        y2_dir += 0.1 if keys[K_DOWN] else -0.1
    else:
        y2_dir *= 0.98

    stage (centerX,centerY)
    char1 (round(x1),round(y1))
    char2 (round(x2),round(y2))
    x1+=x1_dir
    y1+=y1_dir
    x2+=x2_dir
    y2+=y2_dir
    pygame.display.update()
    fpsClock.tick(60)
    ```

sentences:
Sphere UV mapping. Texture Streched I am trying to write a sphere mesh algorithm. Unfortunately, is the texture stretched vertically at the very end of the image. This should be near U 0.99~.

Below is the code used for the sphere creation. In the Image below that you can see a sphere created by Maya with the correct textures applied to it. Therefore, the issue is defiantly the UV map created by this code.

If I increase the number of parallels that are wrongly called meridians. Then the texture looks nearly spot on, but one thin line of garbage.

Hope someone sees the issue. I worked on it for 2 days now :(
There is a live version online for a closed examination of the object.
https://upmkuhn.github.io/AGAV/AGAV/

Btw what is the correct terminology for such an issue?

function makeSphere(radius, numParallels, numMeridians)
{
    var index = 0;
    var grid = [];
    var vertecies = [];
    var normals = [];
    var texture = [];
    var faces = [];

    for (var p = -1; p < numParallels; p++)
    {
        var row = [];
        var parallel = Math.PI * (p +1) / numParallels
        for (var m = -1; m < numMeridians; m++) {
            var meridian = 2.0 * Math.PI * m / numMeridians
            var cartesian = sphericalToCartesian(radius, meridian, parallel);
            var vec3xyz = vec3.create(cartesian);
            vertecies.push(cartesian);

            //NORMALS
            vec3.normalize(vec3xyz, vec3xyz);
            normals.push(vec3xyz);

            x = vec3xyz[0] == 0 ? 0 : vec3xyz[0];
            y = vec3xyz[1] == 0 ? 0 : vec3xyz[1];
            z = vec3xyz[2] == 0 ? 0 : vec3xyz[2];
            //UV
            var u = (Math.atan2(x, z) / (2 * Math.PI) + 0.5);
            var v = y * 0.5 + 0.5;

            texture.push(u,v);
            row.push(index++);
        }
        grid.push(row);
    }

    for (var i = 0; i < texture.length;i+=2)
    {
        var u = texture[i];
        var v = texture[i+1];
        if (Math.abs(u-v) < 0.5)
        {
        }
    }

    for (var p = 0; p < (numParallels ); p++) {
        for (var m = 0; m < numMeridians; m++) {

            if (m < numMeridians) {
                var p1 = grid[p][m];
                var p2 = grid[p + 1][m];
                var p3 = grid[p][m + 1];
                faces.push(p1, p3, p2, grid[p + 1][m + 1]);
            }
        }
    }

    return {
        vertecies: vertecies,
        normals: normals,
        texture: texture,
        faces: faces
    }
}

function sphericalToCartesian(radius, azimuth, elevation)
{
    var x = radius * Math.sin(elevation) * Math.cos(azimuth)
    var y = radius * Math.sin(elevation) * Math.sin(azimuth)
    var z = radius * Math.cos(elevation)
    return [x , y , z];
}

sentences:
displaying image on modelmesh with transparency i have a modelmesh that has a image on it. When i draw the modelmesh i get the image but i also get a black bacground. The image is png and transparent and is added in 3ds max(i don't give it coordinates to be drawn, it sits on the modelmesh). How can i make the black background transparent?

Here is my drawing code:

 foreach (BasicEffect effect2 in modelMesh)
 {
     effect2.DiffuseColor = Color.White.ToVector3();
     effect2.LightingEnabled = true;
     effect2.AmbientLightColor = new Vector3(1, 1, 1);
     effect2.Projection = camera.projectionMatrix;
     effect2.View = camera.viewMatrix;
     effect2.World = transforms[modelMesh.ParentBone.Index] * gameobject.orientation;
     effect2.Alpha = 1;

  }
  modelMesh.Draw();

sentences:
rotating menu with Actors in libgdx I am intending to build a circular menu, with menu items equally distributed around the circle. When clicking on a menu item the circle should rotate so that the selected item is facing the top. I am using libgdx and I am not very familiar with the Actors concept, so I intuitively  tried to implement an Actor, who is drawing a texture and then transforming it by using Actions, with no success:

    class CircleActor extends Actor {

    @Override
    public void draw(SpriteBatch batch, float parentAlpha) {
        batch.draw(texture1, 100, 100);
    }

    @Override
    public Actor hit(float x, float y) {
        return this;
    }

}

and the rotate action:

    CircleActor circleActor = new CircleActor();
    circleActor.action(Forever.$(RotateBy.$(0.1f, 0.1f)));
    // stage.addActor();
    stage.addActor(circleActor);

The texture is rectangular, but it doe not work. 1. What is wrong? 2. Is it a good approach to solve the task?

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:
Questions about property-centric game object runtime I was reading Game Engine Architecture by Jason Gregory

So according to him, I should use an array of entities, and arrays for each property, such as an array gameObjectsPosition, gameObjectsHealth... But in my case, the world is divided in a chunk grid. Each chunk have its own array (or for the moment vector but I plane to change that) of entities (game objects). Then, what should I do? Create a single array containing all entities positions wherever there are (and so one for health, level, orientations, dimensions...), or create the property specific arrays in each chunk?
Then how to process these property arrays? I mean, for each dynamic entity, I could update dimensions, sizes and health or I could for each property update each entity. Example:

 UpdateWorld() {
     for each entity in dynamicEntities
          entity.updatePosition()
          entity.updateHealth()
          entity.updateDimensions()
          entity.updateMesh()
 }

 UpdateWorld() {
     for each entity in dynamicEntities
          entity.updatePosition()
     for each entity in dynamicEntities
          entity.updateHealth()
     for each entity in dynamicEntities
          entity.updateDimensions()
     for each entity in dynamicEntities
          entity.updateMesh()
 }

How to handle sizes for each chunk? That'd mean each chunk have an array with MAX_ENT_PER_CHUNK (say in my example 1024), and then if a chunk have 24 entities there would be 1000 entities useless. Also, I can't use more than 1024 entities. I could use pointers, but then the CPU cache would hit a lot of misses.
How to handle IDs? If I have an array of entities I need to use IDs. I can use macro SID has specified in the book, but the IDs are not ordinals (they may not begin at 0)

sentences:
How can I tell in code if vsync is disabled on desktop PC? My game needs to behave differently to get the best performance if the user disables vsync globally (basically, I need to change the scheduling on my housekeeping operations).

Is there a graphics card independent way (SDK call, C/C++) for me to find out if vsync is disabled?

I'm using opengl/glfw 3.2.1, and I can use glfwSwapInterval(0) to force vsync disabling, but that's not the same as reading the player's current default preferences.

I can always use application settings, but it'd be good if the game could default to the most suitable approach for the default video settings.

sentences:
How do you setup a scrollable overworld map on an HTML/JQuery based game? Problem and Requirements

I'm putting together a simple game that will involve an overworld map consisting of 12px x 12px square terrain tiles.  These maps may be as large as 500x500 in size (so 250k tiles).  I would like the player to be able to drag their way around this map quickly and easily, much like you can in Lords Mobile or other similar mobile games.

It would be preferable if the user could easily zoom in and out.  I will also be placing interactive 'nodes' of various sorts on this map.

Technologies and Stats

Languages:

Lucee backend to generate these maps
HTML and JQuery for display
I'm willing to use other Javascript libraries, but would prefer not to have to learn some whole new framework unless absolutely necessary.

Devices:

Game will be designed primarily for mobile devices, but should run in any browser on any device.
Due to mobile support, resources will be limited.
I will likely create an Android app made up of a splash screen and a webview.  My Java skills are lacking (and I dislike Java) so I really don't want a Java based solution.

Map Stats:

Maps are expected to be between 200x200 and 500x500.
They may need to be larger, possibly in excess of 1200x1200.  So I would like a scaleable approach.

Possible/Rejected Solutions

The obvious first thought was to create a large container div, and an < img > for each tile absolutely positioned within that container.  However, a quarter of a million img tags, each with events attached, is insane, so I rejected this almost as soon as I thought of it.  I tested it anyway on my gaming PC just in case and memory usage shot through the roof and there was significant lag.  This would be completely impractical on a phone or other mobile device.

So then I thought that since the world map won't really ever change, maybe I could create one large image, and just pickup where the player taps via the click event properties and calculate the tile from that.  However, for a 500x500 map of 12x12 tiles, that would be a 6000x6000 image (36 megapixel).  Again, I would be concerned about a mobile device handling that, especially with hundreds of 'nodes' and other 'stuff' dropped on top of it.

So I thought maybe I could just build a container div at the full 6000x6000 size, and then load terrain tiles just for the 30-40 terrains within (and surrounding) the viewport.  As the user tries to scroll I could dynamically generate the other img tags based on data either from an AJAX call or an array that holds all of the terrain data (if it's not too resource intensive).  This seems overly complex, though, and I'd prefer a simpler solution, especially if this is going to lead to any sort of lag.

Question

How do other HTML/Javascript based games handle this sort of large scale overworld map?  I can try to muddle through this myself, but this must be a very common need and I'm sure there are great solutions already out there.

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:
Unity3d multiplayer canvas so I am making multiplayer game and I stuck on one thing, I have blood overlay canvas in my scene(you know, in fps games if somebody shoots you your screen becomes red and this stuff), and when I shoot enemy, his screen becomes red, but mine also.

thats what i ahve now: if raycast hits enemy, player script calls: ColorController.MakeItred(); color controller is attached to this canvas image, here is its code:

`

 void Start () {
       if (current == 100 || current == 0)
        {
        opacity = 0;
        }
    }

// Update is called once per frame
void Update () {
          image = GetComponent<Image>();
    image.color = new Color32(reds, greens, blues, opacity);

    if (current == 0)
    {
        opacity = 0;
    }
    if (!playing)
    {
        if (opacity > 0)
        {
            StartCoroutine(toLower());
        }
        }
    if (opacity == 255)
    {
        playaudio();

    }

}

public static void MakeItred()
{
    opacity = 255;

}
public static void MakeItOff()
{
    opacity = 0;

}
 void playaudio()
{
    AudioSource audio = GetComponent<AudioSource>();
    audio.Play();
}
private IEnumerator toLower()
{
    playing = true;
    opacity -= 1;

    yield return new WaitForSeconds(interval);
    playing = false;
}`

btw thats function in player code that calls colorcontroller.makeitred,

[ClientRpc]
    public void Rpcdoit()
    {
        ColorController.MakeItred();
    }

-Nick
thanks.

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:
Lighting in Unreal is not fluid, lighting changes drastically at object "borders"? I used the starter content's wall objects, an atmospheric fog, a directional light and this is the result:

As you can see, it's obvious where the new object starts.

Why?

sentences:
Balancing players between air/land fields in a PvP match Background:
In my game there are two teams per PvP match, and those two teams are further divided into air/land fields. Each team has 12 players on the ground and 6 patrolling the sky. The goal of the game is for the air/land units to work together to win the match. Players are matchmade into games randomly, without taking into account skill/field preference/etc (the short explanation is that we don't have control over this).
The problem:
If I allow complete freedom in choosing fields, I might end up with no players in the sky or vice versa on one or both teams. If I don't give players a choice, they won't be happy when they aren't assigned to the field of their preference. Overall I imagine the fields would balance out on their own if they're equally enjoyable, but there's little room for error there -- if either field gets a bad first impression, it'll be difficult to recover from. I want to ensure there are some constraints in place to prevent death by conjecture.
I thought of adding 1 or 2 landing pads at either team's base, and that way players who wanted to play the land field could land, and players who wanted to play the air field could take a parked aircraft on the landing pad. This could breed tension between players where more than 2 players are competing for landing pads though.
What are some approaches I can take to resolve this, which avoid forcing player behavior as much as possible, but still ensure gameplay is predictable and reliable? Specifically I'm looking for what key issues an answer takes into account and how it resolves them. If you're drawing experience from something that's already been put into practice and already has tangible results, those results would be a wonderful addition to your answer.

sentences: How can I position objects in a circular motion from the inspector From the image below, I would like to position copies of my original circle (which is at the center) that are 1 unit away from the center and 30 degrees from each other in a circular motion. I would like to do this in the inspector. How can this be done?

sentences:
How can I end my game when the right character statistics get to 0? I'm creating a text-based RPG game.  In my game, a player has five different stats, which might decrease over time as the player does certain things.

public static int HP = 100;         //CHARACTER STARTING VITAL HIT POINTS
public static int food = 100;       //CHARACTER STARTING FOOD
public static int water = 100;      //CHARACTER STARTING WATER
public static int sanity = 100;     //CHARACTER MENTAL SANITY
public static int stamina = 100;    //CHARACTER STARTING STAMINA

I'm not sure how I can implement the logic to end the game when any of those stats reaches zero. My main game loop looks like this:

public static void main(String args[]){
    Map mainMap = new Map(10, 10);
    Character hero = new Character(mainMap);
    Main.start();

    while (true) {
        printmap(hero, mainMap);

        // Ask the player what direction to move, move the player.
        Character.moving();

        // ...
    }
}

The Character type has instances of all the players stats (as well as methods to increase or decrease them). How can I accomplish ending the game when a stat hits zero?

sentences:
Using server timestamp to synchronize actions across clients tl;dr
The question is rather simple: how unsynchronized can internal clocks be between different machines?

Context
We have a "hybrid" approach where the Clients are authoritative on certain things, and the Server on some others. That is to make our life easier because the gameplay doesn't need to be too tight about certain things.
In this case, the Server will pre-determine a sequence of Enemy Types to be spawned at different locations with pre-determined delay between the spawns. We would then let the Clients handle the rest during the gameplay.
However, if we want the Clients to be mostly synched on the display of the enemies, they would need to initiate this sequence at the very same time, and thus we cannot rely on the network to have transmitted the data at the very same time for all Clients.
The idea we had was to send a timestamp of the format returned by System.currentTimeMillis() which would indicate when to begin the sequence.
But then one question remains in the way: how unsynchronized can internal clocks be between different machines?

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:
How do I find the angle required to point to another object? I am making an air combat game, where you can fly a ship in a 3D space. There is an opponent that flies around as well. When the opponent is not on screen, I want to display an arrow pointing in the direction the user should turn, as such:

The arrow will be on the HUD. It will not actually turn to the opponent. I want it to indicate which direction a user should turn to see the enemy ship. This arrow will circle around the cross-hairs (radius 60 pixels).

So, I took the camera location and the opponent location and did this:

double newDirection =
   atan2(activeCamera.location.y-ship_wrap.location.y,
   activeCamera.location.x-ship_wrap.location.x);

After which, I get the position on the circumferance of a circle which surrounds my crosshairs, like such:

trackingArrow.position = point((60*sin(angle)+240),60*cos(angle)+160);

It all works fine, except it's the wrong angle! I assume my calculation for the new direction is incorrect. Can anyone help?

sentences:
How to modify a property after animating it in Unity3D? I animate localPosition. The animation works well, but after, I can't change a value of localPosition in editor or code. I want to change a value after the animation completes, not at the same time.

I use Animator with AnimationClipPlayable. I create Animator in editor and the rest in code (AnimationClip, AnimationClipPlayable, AnimationCurve).

The animation animates a property from one position to another. It finishes, I don't do anything to stop the animation.

Let me know, if you need a code example or video presentation.

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:
How can I measure the execution time of some code? How can I capture how long something takes to complete and log it to the output window (in Visual Studio)?

Is there a special library for this?

clock_t start, end;
double cpuTime;

start = clock();

//....bit to be timed

end = clock();

cpuTime= (end - start) / (CLOCKS_PER_SEC);

OutputDebugString(TEXT("Time: %d", cpuTime));

This code might work but where does it come from?  A special include?

sentences: UnityEditor.SyncVS.SyncSolution putting wrong language version in generated files I'm working on getting our Unity projects building in bamboo for our build server. We have a cli step that runs through the Unity commands for creating a build. It works fine on several projects, but for some reason this particular project I'm working on I'm getting an error that states I need to use c# version 7.2 or newer. If I log in to the build server and open the .csproj files in notepad and check the language version, it's setting them to 7.0. However, if I deactivate the cli step so that the build job only clones the project, then manually log in and open unity and go through the process so it generates the .csproj files, then check them, the language version is set to 8.0. The project works fine locally on my own pc. And it works when setup manually on the build server pc, but when ran through the cli step, it generates them at an earlier c# version. This leads me to believe there is a problem with the UnityEditor.SyncVS.SyncSolution step in my commands. I'm just not sure what it could be, or why it's behaving differently for this project as opposed to other projects that are using the same code base (where the problem is said to occur), same Unity version, same build server, etc. Anyone else experience this issue or have any thoughts on a solution?

sentences: If you make a game for facebook do you have to have a "real website" on the domain name? Can you just use the domain to house your database and code?  Do you have to have a "real" front end webpage?

sentences:
Advice on rendering a 2D scene My game  will be made up of objects. Essentially the level editor will give me a bunch of objects to choose from and I can drag them in and thus a level is made. The objects could have animation in which case they are responsible for knowing which frame and layer they are on.

So then I can have these:

Animated non-movable objects
Unanimated non-movable objects
Animated movable objects
Unanimated movable objects

So first I was thinking of, when the level starts, build a quadtree for all non-movable objects.

This way I can easily avoid rendering ones which are not in view.

Then from there I can do bounding box check on dynamic objects (or maybe if I add something like Box2D it can do it).

But then comes the rendering.

At first I was thinking of each object rendering itself, but then I cannot do atlasing.

I'd like to do atlasing. I was thinking that animated objects can just use their own frame sheet. But objects which are not animated should use atlasing.

I know this can be categorized as premature optimization, but I don't want to eventually find out that it is horribly slow.

Any design suggestions / comments would be welcome. Does it seem like a good idea to try to atlas in the sort of game I'm making, which is a platformer that is not tile based.

sentences:
What techniques are useful for modelling Character Actions via OOP? I'm trying to rewrite a legacy php Browser-Based-Game so that it uses object oriented programming.  I find it relatively easy to model concrete nouns, like: new Npc(), new Character(), new Account(), new Clan().

I'm finding it more difficult to model a character's actions.

For example:

usable skills.
a test for whether two characters are multiplayers
attacking another character
test for whether a character is allowed to attack another character
etc.

Have you done something like this, and if so, what overall approach did you use to model the in-between-the-nouns behavior?

sentences:
Calculating spaceship course There is an idea for (soft) sf strategy game following me for a long time but I need to get a grasp of some math before moving further with it.

Lets assume there is a spaceship traveling (in space) with some velocity and its engines can generate some acceleration - with maximum acceleration much smaller in magnitude than obtainable velocity. Now given the planned use of engine (acceleration in time) I think ti is fairly straightforward to calculate movement of the ship.

But the problem I need to solve is reverse - given starting position, velocity and desired destination I need to find a plan of engine usage (acceleration over time) that will guide the ship to the destination in minimal time.

There may be some complications like

The ship can only accelerate in one direction and turning (changing direction) takes time
There are some large bodies with gravitational pull that affects ship course
The destination point is moving in time - for example it is relative to planet or moon orbiting larger body
The timing is important - for example the ship is flying in fleet and need to arrive on target at roughly same time as her companions

Now I do not expect to get ready to use solution but my question is where I could look for clues? What I should study? What similar problems or related algorithms can help?

As this is for a game the solution may be simplified and even involve some "cheating" that would not work in real life.

sentences:
Publish to folder equivalent for a desktop GL project with visual studio Mac 2019 I'm not home so the only computer I have access to is a Macbook, and now I would like to see how I could pack up projects to export for various platforms. But when I build my project it only produce a windows executable. Since the project is DesktopGL I can execute it via the command
mono-sgen64 DesktopGL.exe

but this requires to include as redistributable the mono runtime. can't I publish the project in order to target Mac OS specific output and then get a fully packed .app executable like I can with the publish to folder thingy on windows?
I'll appreciate any help and really thank you for your attention.
Also if I could have access to linux executables I would be highly thankful.
Here is a recap of what I've found already:

the publish to folder is only available for Mac with a .asp.net or core console project
https://docs.microsoft.com/en-us/visualstudio/mac/publish-folder?view=vsmac-2019
We can use appify.sh script but I don't know how it would read the content files etc. and this won't be compatible with linux
I've allready used this script to create a packed php executable but I never included ressources
https://mathiasbynens.be/notes/shell-script-mac-apps
as I mentioned earlier I can execute the game properly using the mono executable so if I go that way I could create a run.sh script but this won't be the thing I'm looking into
i figured it by looking where was located the actual executable of the game once I've run the project
I've also found this nugget package which seems to add publishing parameters but I don't know if I can trust it
https://www.nuget.org/packages/InfinitespaceStudios.MonoGame.Packaging/0.1.4-alpha

sentences:
java Game: Rendering issue! Hi I am making a java game in were you can build land. At the moment you can build but not destroy. So I want to be able to destroy. I have an array of the tiles. I think I might need to do something like remove the tile that the mouse is hovering on form he arraylist so how can I do this? I don't think you need my code to explain to me because I only want to know how to remove the Tile that the mouse is hovering over. Please help me.

EDIT** MY array is a arraylist kind of arraylist and I have an arraylist for each block.

sentences:
How to split a screen in half using LibGDX without scaling? I am currently working on a racing game with libGDX and I need to split the screen in half for a two-players mode. (Player 1 in first half and Player 2 in second half).

I already have Camera1 that will follow Player 1's car, and Camera2 that will follow Player 2's car.

Basically, I want the first half to show Player 1's car and the second half to show Player 2's car.

I have been searching for a while online for a way to split screens with LibGDX and found how to split the screen in two with this code:

/*Left Half*/
Gdx.gl.glViewport( 0,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );

/*Right Half*/
Gdx.gl.glViewport(Gdx.graphics.getWidth()/2,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );

However, it squeezes the screen into the right half, which is not what I want.

Is there a way to split the screen without squeezing it?

sentences:
In SDL, what is the difference between using a Surfaces and a Renderer? I am new to SDL and I've been following some tutorials; in one tutorial he used Surfaces (a window surface and image surface) and a BlitSurface function to draw images without using any renderer (used SDL Image library for JPG, PNG etc.).
And in another tutorial, he used a Renderer.
What's the difference between those two? It seemed to me they do the same thing but I'm assuming if they were the same, one wouldn't exist.

sentences:
How to keep the camera view to within room dimensions me = self;
    view_yview[0] += ( me.y-(view_hview[0]/2) - view_yview[0]) * 0.1;
    view_xview[0] += ( me.x-(view_wview[0]/2) - view_xview[0]) * 0.3;

This is the code I use to smooth camera movement in game maker. But it's going beyond the room dimensions; showing stuff that shouldn't be shown, as the camera should stop following the player at a point.

How do I achieve this?

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:
Rotate view matrix based on touch coordinates I'm working on an Android game where I need to rotate the camera around the origin based on the user dragging their finger. My view matrix has initial position of sitting on the negative z and facing origin. I have succeeded in moving the camera through rotation left or right, up or down based on the user dragging the finger, but my problem is obviously that after I drag my finger up/down and rotate say 90 degrees so my intial position of -z is now +y and still facing origin, if I drag my finger left/right I want to rotate from +y to +x, but what happens is it rotates around the pole +y. This is to be expected as I am mapping 2D touch drag coords to 3D space, but I dont know where to start trying to do what I want. Perhaps someone can point me in the right direction, I've been googling for a while now but I don't know what I want to do is called!

Edit __
What I was looking for is called an ArcBall, google it for lots of info on it.

sentences: Why do most racing games have tracks that are closed loops? In most racing games (Mario Kart, Sega Rally, F-Zero, etc.), racers typically make some number of laps in a closed circuit.  The most notable exceptions that come to mind are all arcade games, or arguably not even a racing game (Trackmania, OutRun, the Cruis'n series).  Why would a designer want to build tracks as closed loops, and why is it so commonplace?

sentences:
What is the correct way to draw layered Sprites in modern OpenGL? So what do I mean by layered sprites? Layered Sprites are Sprites that consist of multiple layers, e.g. you have sprite sheets for the basic Body, the Head, Clothes, Weapons, etc.

Well now I wanted to know how you would draw this in the most efficient way; right now the idea is to use vertex buffer objects (VBOs), but I heard that it is expensive to change the textures in a VBO...

So what would be the correct way to draw them? My idea right now would be to draw the Map tiles first (with a texture atlas), then I would draw all the basic bodys, then the heads, then clothes, and then the weapons. Would that be the best way or is there a more efficient way?

I also thought of using vertex arrays instead of VBOs, but as far as I know they are deprecated...

sentences:
Displaying possible movement tiles What's the fastest way to highlight all possible movement tiles for a player on a square grid? Players can only move up, down, left, right. Tiles can cost more than one movement, multiple levels are available to move, and players can be larger than one tile. Think of games like Fire Emblem, Front Mission, and XCOM.

My first thought was to recursively search for connecting tiles. This quickly demonstrated many shortcomings when blockers, movement costs, and other features were added into the mix.

My second thought was to use an A* pathfinding algorithm to check all tiles presumed valid. Presumed valid tiles would come from an algorithm that generates a diamond of tiles from the player's speed (see example here http://jsfiddle.net/truefreestyle/Suww8/9/). Problem is this seems a little slow and expensive. Is there a faster way?

Edit: In Lua for Corona SDK, I integrated the following movement generation controller. I've linked to a Gist here because the solution is around 90 lines of code.

https://gist.github.com/ashblue/5546009

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:
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:
How do you move a sprite in sub-pixel increments? Pixels are either on or off. The minimum amount you can move a sprite is a single pixel. So how you make the sprite move slower than 1 pixel per frame?

The way I did it was to add the speed to a variable and test if it had reached 1 (or -1). If it did, then I would move the sprite and reset the variable to 0, like so:

update(dt):
    temp_dx += speed * dt
    temp_dy += speed * dt

    if (temp_dx > 1)
        move sprite
        reset temp_dx to 0
    if (tempy_dy > 1)
        move sprite
        reset temp_dy to 0

I disliked this approach because it feels silly and the sprite's movement looks very jerky. So in what way would you implement sub-pixel movement?

sentences:
Collision detection not working on some parts of mesh Racing game with a single mesh to act as a collider for all the track sides. Recently revised the mesh and now it is behaving strangely. The player correctly collides (bounces off) some parts, on other parts it is hit and miss whether the collider works and on others the player acts like there is no collider present at all.

I have checked that all the meshes normals are facing the correct direction and that there are no gaps in the mesh.

I have set the collisions on the player rigid body to be continuous.

Can anyone suggest what might be happening?

I was previously using the exact same technique but re-created the collider mesh to clean it up and upon importing from Blender into Unity the collider behaviour is now all over the place.

This picture shows part of the collider where the player just passes straight through the walls.

Car collider in Unity:

Track mesh collider in Unity:

sentences:
AABB test does not consistently detect edge-to-edge contact when bounds are very different in size My function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size of the other), then the collision wouldn't be detected correctly; I would have to have them intersect for a collision to be registered, rather than having it register when they are at least in direct contact, which is the intended behavior.

Below is my code:

local function DetectCollision(a, b) -- AABB to AABB
  local collisionX = (a.Position.X + a.Size.X) >= b.Position.X and (b.Position.X + b.Size.X) >= a.Position.X
  local collisionY = (a.Position.Y + a.Size.Y) >= b.Position.Y and (b.Position.Y + b.Size.Y) >= a.Position.Y
  local collisionZ = (a.Position.Z + a.Size.Z) >= b.Position.Z and (b.Position.Z + b.Size.Z) >= a.Position.Z
  return collisionX and collisionY and collisionZ
end

To be more specific, the issues start to occur when I cut the size of one of the AABBs in half. For instance, if I had two cubes where one's size is 12 on all axes and the other is 6 on all axes, then the collision will not register. Upon debugging, I noticed that only one of the collision bools will become false. This seems to depend on what axis the smaller bounding box moves from in relation to the bigger one, so if I moved the smaller AABB away from the bigger one on the y-axis, then collisionY will be false.

sentences:
Unity: set y rotation messed up the object I created 3 boxes, then align the three to form some sort of a gate,
I set the parent to an empty object so that I can easily move it. And I add box collider inside the gate.

When I try to rotate it on Y axis, the boxes deforms

I just want to rotate the Y, not deformed it. Here are the object

Is this related to the transformation I created before?
Something that requires to apply the transformation first? like in blender3d?

sentences:
How to set shader global variable in sharpdx without using Effect class I am working with SharpDX, i thinking to try using (uniform) global variables for HLSL constants instead of constant buffers.

But, in my code SharpDX's Effect class is not used: i use PixelShader and VertexShader classes instead - constructed directly from bytecode blobs (i just don't use techniques/passes, i compile shaders separately).

With Effect class, i can assign new value to any constant in HLSL program by its name, as DirectX allows that, in any time. Example (i haven't tested this; yes, its ugly here):

SharpDX.Direct3D11.Effect fx = //
fx.GetVariableByName("someOption").AsVector().Set<Vector3>(newVectorValue);//nice

But i don't use Effect class.
How can i set global HLSL variable using Vertex/PixelShader class instance?
If it is not possible, shame on SharpDX dev then, in native DirectX it is much easier.

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:
What are the advantages of having a real time based physics? Possible Duplicate:
  Fixed time step vs Variable time step

Now just let me clarify what I mean by "real time based physics", which I will call RTBP from now on. Well, basically, it implies taking, you guessed it, actual time into calculations.

For example:

timePassed = time - lastTime

positionx += vx*timePassed
positiony += vy*timePassed

lastTime = time

This would be a simple RTBP model. What's the alternative? I call it "step based physics" (SBP from now on), which would just be this:

positionx += vx //v in SBP is obviously smaller than in RTBP
positiony += vy

I currently use SBP, but I see that many people actually include time in their calculations. Why is that? I of course limit the update time to 1000/60ms.

Once the update interval is limited, both models would behave the same. The only difference is when the FPS drops. I believe that here is where PBS excels over RTBP. In PBS the game would, yes, run slower, but would always produce the same results! In RTBP, the position might increase so much that an object actually passes through a wall!

Anyway, there must be something that I'm missing.

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:
Rigidbody on UV animations I know we need to add rigidbody if we are moving objects.In Unity 5 the performance of moving non rigidbody objects has been increased too.

Though I have doubt over ,Do I need to add rigidbody if I am animating only UVs without moving the object?

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:
Is normal mapping cpu overhead or gpu overhead? In Unity3D Engine,

I usually apply normal mapping using fragment shader.

In this case,

this normal mapping is cpu overhead or gpu overhead?

sentences:
Integration error in high velocity I've implemented a simple simulation of two planets (simple 2D disks really) in which the only force is gravity and there is also collision detection/response (collisions are completely elastic). I can launch one planet into orbit of the other just fine.

The collision detection code though does not work so well. I noticed that when one planet hits the other in a free fall it speeds backward and goes much higher than its original position. Some poking around convinced me that the simplistic Euler integration is causing the error.

Consider this case. One object has a mass of 1kg and the other has a mass equal to earth. Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration, 7 at the end of the second, 4 at the end of the third and 0 at the end of the fourth iteration.

At this points it hits the ground and bounces back with the speed of 10 meters per second. The problem is with dt=1, on the first iteration it bounces back to a height of 10. It takes several more steps to make the object change its course.

So my question is, what integration method can I use which fixes this problem. Should I split dt to smaller pieces when velocity is high? Or should I use another method altogether? What method do you suggest?

EDIT: You can see the source code here at github:https://github.com/elektito/diskworld/

sentences: How to make my SpriteSheet be POT? So let's say my sprite sheet has 3 sprites in one row. One sprite is 64 pixels wide and high. When that is combined my sheet would be 192 pixels wide and 64 high. So from that, how am I supposed to make it's dimensions POT without stretching sprites inside?

sentences:
How should I pause a rotation when my character collides with a gameObject? My character always moves forward and when he enters a turn(Trigger) this is what happens:

if(other.CompareTag("TurnLeft"))
{
    // Rotates the character in 90 degrees in 6 seconds.
    MoveObject.use.Rotation(transform, Vector3.down * 90.0, 6);
}

But when he contacts with the ("StageColliders"), he keeps rotating, even though he doesn't change his position. I practically need him to pause rotating when he hits ("StageColliders") and continue when he's free of collision.
Something like this would be ideal.

if(other.CompareTag("StageColliders"))
{
    // Pause the rotation above.
}

I found the MoveObject script here http://wiki.unity3d.com/index.php?title=MoveObject
in case someone's curious.

sentences:
Why would this scaling matrix have no effect? To draw a simple model using the DirectXTk, I'm doing the following.  It all works perfectly, draws correct, and so on.  Except changing the scaling factor makes NO difference, and I can't figure out why.

_MissileScale = 5.0f;
XMMATRIX GetWorldMatrix()
{
    XMMATRIX translation = XMMatrixTranslationFromVector(XMLoadFloat4(&_Position));
    XMMATRIX rotation    = XMMatrixRotationRollPitchYaw(_RotationX, _RotationY, _RotationZ);
    XMMATRIX scaling     = XMMatrixScaling(_MissileScale, _MissileScale, _MissileScale);

    return scaling * rotation * translation;
}

Then when I draw it, I ask for that matrix.  The rotation and translation work, but not the scaling.

        XMMATRIX mView = pCamera->GetViewMatrix();
        XMMATRIX mProj = pCamera->GetProjMatrix();
        XMMATRIX mWorld = pMissile->GetWorldMatrix();

        _ptrMissileModel->UpdateEffects([pCamera](IEffect* effect)
        {
            XMFLOAT3 ambientLightColor(0.5f, 0.5f, 0.5f);
            auto lights = dynamic_cast<IEffectLights*>(effect);
            if (lights)
            {
                lights->SetLightingEnabled(true);
                lights->SetPerPixelLighting(true);
                lights->SetLightEnabled(0, true);
                lights->SetAmbientLightColor(XMLoadFloat3(&ambientLightColor));
                lights->SetLightDiffuseColor(0, Colors::White);
                lights->SetLightDirection(0, pCamera->GetWorldAhead());
                lights->SetLightEnabled(1, true);
                lights->SetLightEnabled(2, true);
            }
        });

Any thoughts?  Of all the linear transformations you'd think scaling would be the hardest to get wrong!  I've tried the two "flailing" attempts of reversing my order of multiplication and of transposing the matrix before handing it off to the shader, neither helped (both broke the rendering as you'd expect).

sentences:
Instancing pixel shader parameters -- pass instance data through vertex shader? I'm working on a deferred shader, and I want to use instancing to draw point lights.

From what I understand, I can send the instance data through the vertex shader and pass it through unchanged to the pixel shader. Is this the correct way to do it, or can I send the instance data straight to the pixel shader somehow?

sentences:
How can I expose a property to Unity that should be treated like an asset path? I want to be able to do something like this:

public FileInfo XmlBehaviourFile;

And then use the asset browser in the Unity editor to select an asset. Ideally, I would like to limit it to XML files but that isn't too important.

I am aware of TextAsset but I can only access either a string or byte array of the contents. I can probably make this work, but at the moment, my library takes a FileInfo and handles the reading itself.

Is there a Type I can use that will make Unity let me choose a file in the editor and then simply store the path (ideally, it would handle making sure the path is relative and including the asset in the build).

Alternatively, would it be possible to write such a type that would work, I've not extended Unity, but I am aware it is possible.

sentences:
How can I Increase pixel In rendering my shader? This is my flow map shader , it works correctly but I have problem In Rendering.
how can I Increase pixels per unit In my shader?

Shader "Custom/Flow Map"
{
    Properties
    {
        _MainTex ("Sprite Texture", 2D) = "white" {}
        _Color ("Tint", Color) = (1,1,1,1)
        _FlowMap ("Flow Map", 2D) = "white" {}
        _FlowSpeed ("Flow Speed", float) = 0.05

        [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
    }

    SubShader
    {
        Tags
        {
            "Queue"="Transparent"
            "IgnoreProjector"="True"
            "RenderType"="Transparent"
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
        }

        Cull Off
        Lighting Off
        ZWrite Off
        Blend One OneMinusSrcAlpha

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile _ PIXELSNAP_ON
            #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;
                OUT.color = IN.color * _Color;
                #ifdef PIXELSNAP_ON
                OUT.vertex = UnityPixelSnap (OUT.vertex);
                #endif

                return OUT;
            }

            sampler2D _MainTex;
            sampler2D _FlowMap;
            float _FlowSpeed;

            fixed4 frag(v2f IN) : SV_Target
            {
                float3 flowDir = tex2D(_FlowMap, IN.texcoord) * 2.0f - 1.0f;
                flowDir *= _FlowSpeed;

                float phase0 = frac(_Time[1] * 0.5f + 0.5f);
                float phase1 = frac(_Time[1] * 0.5f + 1.0f);

                half3 tex0 = tex2D(_MainTex, IN.texcoord + flowDir.xy * phase0);
                half3 tex1 = tex2D(_MainTex, IN.texcoord + flowDir.xy * phase1);

                float flowLerp = abs((0.5f - phase0) / 0.5f);
                half3 finalColor = lerp(tex0, tex1, flowLerp);

                fixed4 c = float4(finalColor, 1.0f) * IN.color;
                c.rgb *= c.a;
                return c;
            }
            ENDCG
        }
    }
}

sentences:
What is the practical use of IBOs / degenerate vertex in OpenGL? Vertices in 3D models CAN get cut in the process of optimizing 3D geometry, (degenerate vertices) by 3D graphics software (Blender, ...) when exporting because they aren't needed when reusing a vertex for multiple triangles.
(In the current case 3D data is exported from Blender as .ply and read by a simple application that displays the 3D model)

Every vertex has a few attributes like position, color, normal, tangent,...
But the data for each vertex that is cut through the vertex sharing is lost and is missing in the vertex shader.

Modern shader techniques like Bump or Normal mapping require normals/tangents per vertex which are also cut.

To use complex shader techniques IBOs must not be used? Or is there a way to use IBOs and retain the data per vertex that was origionally lost?

sentences:
Do I need to use SteamWorks in my game to have it on steam? Do I need to use SteamWorks in my game to have it on steam? The website talks about it however it does not state it is necessary so I am asking if it is.

I am not asking how to do it I'm asking if I need to do it.

sentences: Can I mod Among Us mobile so people don't get kicked because of network problems, and how? I want to make a mod for Among Us which will allow people to stay in game despite short-lived connection problems (as opposed to being kicked after 1 second of network issues).

sentences:
What coordinate system to use to handle 2D UI? Following on from the aspect ratios question, I'm interested to hear what other people are using when working on 2D UI systems (most likely their own home-grown solutions). Specifically, how do you handle coordinate systems. To my mind there are three options:

Hard-coded co-ordinates (e.g.: 0 -> 720, 0 -> 576)
Normalised co-ordinates (0.0 -> 1.0, 0.0 -> 1.0), mapped into real coordinates before rendering
Virtual co-ordinates (e.g.: 0 -> 1600, 0 -> 1000), mapped into real coordinates before rendering

Hard-coded is obviously only useful if you're on a fixed platform and know what your screen space coordinates are in advance, or if you're prepared to author screen layouts for every possible set of screen dimensions.

Normalised co-ordinates are nice, but suffer from ambiguity when the aspect ratio of the screen isn't fixed (e.g. 0.75 maps to a different physical co-ordinate when running in widescreen than it does in 4:3). Also, for the authors, it's really counterintuitive to declare a UI element to be (0.2 x 0.2), only to find it's not actually square when rendered.

Virtual co-ordinates are unambiguous, but suffer from the same problems as normalised co-ordinates at the remapping stage: a tiny decimal discrepancy can result in off-by-one errors meaning that UI elements which should tile now have a seam between them.

Similarly, when you do have a fixed resolution screen, both normalised and virtual coordinates mean that it's very difficult to guarantee a 1:1 mapping between your artist's finely crafted pixels in the UI image, and pixels on screen, meaning you run the risk of nasty scaling artefacts (assuming you're rendering as textured quads on screen).

We've gone with the virtual co-ordinate approach, specifically to avoid ambiguity about aspect ratios. So when rendering to a 16:10 screen, the UI space is (0,0) -> (1600,1000), but when rendering to 4:3, the usable UI space is actually (133,0) -> (1467,0).

Are there any better solutions that I'm just not aware of? Are there any good strategies for minimising the problems these 3 approachs have?

sentences: Can free Unity Store assets be used in non-Unity games? Does Unity Store allow to use assets listed as free in games built without the use of Unity engine? It's a pretty big place for free assets and I wonder if this isn't against the Unity Store's usage agreement.

sentences:
Should I assign a unique ID to individual units of game currency? I am currently making a MMORPG.

At the moment, I am working on the currency part of the game but I'm confused whether I should assign a unique serial number for every unit of the currency generated.

I'm hoping to use this system to trace any misuse of the virtual currency but is this a common practice and if not, would this be a good idea on operational and / or performance point of view?

sentences:
Unity 2020.1.8f1 cannot build xcode project for iOS We recently updated a project to Unity 2020.1.8f1
But it will not build the xcode project for iOS because of missing plist key value pairs.
This is really weird cus, before, I would build the xcode project, then fix the plist stuff, then build to iOS.
Here are the errors Im getting when I try to build.

WebCamTexture class is used but Camera Usage Description is empty. App will not work on iOS 10+.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean &)(at / Users / bokken / buildslave / unity / build / Modules / IMGUI / GUIUtility.cs:189)

Microphone class is used but Microphone Usage Description is empty. App will not work on iOS 10+.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

I tried adding this script to Editor folder in assets
    using UnityEngine;
    using UnityEditor;
    using UnityEditor.Callbacks;
    using System.Collections;
    using UnityEditor.iOS.Xcode;
    using System.IO;

    public class AddStuffToplist {

        [PostProcessBuild]
        public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
        {

            if (buildTarget == BuildTarget.iOS) {

                Debug.Log("adding plist stuff");
                // Get plist
                string plistPath = pathToBuiltProject + "/Info.plist";
                PlistDocument plist = new PlistDocument();
                plist.ReadFromString(File.ReadAllText(plistPath));

                // Get root
                PlistElementDict rootDict = plist.root;

                rootDict.SetString("NSCameraUsageDescription","Natcorder unity asset uses this");
                rootDict.SetString("NSMicrophoneUsageDescription","Natcorder unity asset uses this");
                rootDict.SetString("NSPhotoLibraryUsageDescription","Natcorder unity asset uses this");

                //rootDict.SetString("Privacy - Photo Library Usage Description", "Natcorder unity asset uses this");
                //rootDict.SetString("Privacy - Microphone Usage Description", "Natcorder unity asset uses this");

                // Write to file
                File.WriteAllText(plistPath, plist.WriteToString());
            }
        }
    }

I get exactly the same errors if I use Privacy - Microphone Usage Description or NSMicrophoneUsageDescription as the key for example.
Also the debug line I added "adding plist stuff" never shows up in the console, so maybe this script is not working?

sentences:
Using fully cropped sprites with TexturePacker and Cocos2d When using texturepacker, you can set your trim-mode to crop. This is nice, because when a sprite loads in cocos2d your bounding box will only be the visible area of your sprite - which is useful for things like collision detection etc.

However, if you have a complex animation - say a warrior with a sword, there is a good chance that the visible rect of your sprite is changing with each frame. For example, when the sword swings backwards or forwards your sprite width would adjust.

Cocos2d seems to handle this in a less then ideal way - when the dimensions change the sprite seems to dance around, rather then anchoring to centered point. In an engine I wrote, I handled this by using a set anchor point and direction for an animation. So if an animation got wider you could make sure it extended in a given direction (for example, a punch would extend in one direction, rather then appear to push the sprite backward from the fist)

Does cocos2d have any mechanism for handling this? I looked at anchorpoint, but it doesn't seem to handle this scenario.

sentences:
How to put a reference to my player (already instanced) into a prefab that will be instantiated later I'm making an enemy in my game. He stands at the side of road with a rocket launcher and fires when you get close. It nearly all works fine, except I just need a reference to the players position so that I can make his rocket explode when it reaches the same height on the map as the player car.

The enemy is a prefab which is NOT instanced at build-time, there a several spawn-points all with n% chance of spawning a guy there using the prefab. The player IS instanced at build-time. And here is my problem..

Although I have put a "public GameObject player" into my variables in the script on the prefab, it doesnt let me drag the already instanced player into it. I've read about a bit, and I see that Unity will not allow this (or at least thats what I gathered!)

So after much searching I came up with

player = GameObject.FindGameObjectWithTag("Player");

But i havent even tested yet because the source where i got that advice in the very next comment the guy says I shouldnt do this because it takes too much system resources up.

EDIT: I have tested it with that line, it does work. But is there a better way

But he doesnt say the way that it should be done! And the thread is about 6 years old. So I thought I'd write here again and ask you fine folks for more help.

I hope I explained the problem clearly enough, I think i got the terminology right. Basically, the RocketerEnemy prefab is going to be instantiated in runtime, but the PlayerCar is already instantiated by my dragging it into the heirarchy at the beginning of the project. This is stopping me from dragging the PlayerCar object into the box in the Inspector (for the Enemy prefab) .
All I really need is the PlayerCar.transform.position.Y value for each frame.

THANKS IN ADVANCE !

sentences:
Techniques for benchmarking code running on the Sega Genesis' 68000 CPU? I'm playing around with writing code for the Sega Genesis, which uses a Motorola 68000. I'm not an assembly code guru by any means so I'm writing in C and using SGDK. As it's slower than assembly, I'd like to be able to benchmark so that I can find slow spots and optimize them as much as I can. But I'm at a loss of how to do that. It doesn't look like the CPU has any timers or ticks that I can use. Any ideas?

One idea I've got is to find the code I want to benchmark and set it to run 1000 or 10,000 times, and have something visible happen when it's done. Because it's looping many, many times, the amount of time it takes is measurable with a stopwatch. Not the most friendly way, but it might be possible to use in some cases.

sentences:
Using Euler angles to rotate object 360 degrees I'm trying to create script that rotates object in given axis by set amount of degrees.
That's my 2 core methods
public Vector3 rotation;

public void RotateDegreesFast ()
{
    transform.DOLocalRotate (GetTargetRotation (), rotationTime);
}

private Vector3 GetTargetRotation ()
{
    Vector3 newRotation = new Vector3 (
        rotation.x + transform.localEulerAngles.x,
        rotation.y + transform.localEulerAngles.y,
        rotation.z + transform.localEulerAngles.z)

    return newRotation;
}

I was using this script for a little while, it was working perfectly in Y and Z axis. Now I try to rotate object 45 degrees in X axis (rotation = new Vector3(45f, 0f, 0f)). It works until rotation in x value equals 135. Transform.localEulerAngles.x is returning 45 instead of 135. So it's stuck between 90 and 135 degrees. I was trying to use transform.localRotation.eulerAngles.x instead, but it doesn't work as well.
I am aware this works that way because specific Euler angle can be represented in many ways. I also know that DOTween has DOLocalRotateQuaternion method, but the thing is that this component is often reused by a designer that sets value of rotation variable in the inspector. It's way easier to use Euler angles for him.

sentences:
MMORPG game balancing I've seen a couple of examples of some game balancing techniques in books yet they are not comprehensive and not particularly aimed at MMORPGs but I'm looking for practical examples of game balancing techniques for MMORPGs. I am interested to know if anyone has documented the techniques used in popular games with proven success in this area. Ideally, any resource would cover most common types of stats and include layman mathematical models or techniques used to balance game mechanics found in advanced MMORPGs (I know it's a cliché, but WoW style)

Any help would be great!

sentences:
How 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:
Rendering model with multiple tiling textures See edit:

How would I go about rendering a model with multiple tiling textures? I have a few ideas, but all of them have drawbacks, here are a few (by the way this is for an opengl game):

-Use a huge texture, but this comes at the cost of the texture being expensive

-Render diffrent objects for each textured object (eg: one model could be bricks for a house, another could by the roof, each with their own tiled texture), but this would become very messy, very quickly.

Here is an (amazing) image to help demonstrate what I'm trying to do.

The repeating "R" on the red area represents perhaps a repeating brick texture, while the green one represents a roof, maybe roof shingles. To add on to that, I've added a window texture.

My question is, how do most games deal with this? I can't seem to wrap my head around how I could fit this in one texture, but yet I see many other games do exactly what I want.

EDIT:

This should give a better visual demo. I want a large mesh (not very large in the demo) using one texture atlas. (Please keep in mind not all textures in the atlas will be the same size!)

Lets say this is my object, it uses each texture on the atlas, but not the same amount of repeats (brick repeats 3 times, when the smiley face repeats 9 or so times)

How do most games achieve something like this? Without using some huge file with repeating textures.

Example (from BOTW)
I assume they didn't just repeat this texture on the atlas, considering how large that would be (and expensive).

sentences:
Server-side physic simulations with hundreds of players I’m currently working on a singleplayer physics-orientated game where I would like the physics to be simulated server-side. This because the game will have leadersboards, persistant player progression, etcetera and I want to prevent any type of cheating – basically a pure client-server architecture, the client is “dumb” and only displays what the server wants you to display.

The problem however is that the game will most likely be played by hundreds (maybe thousands) of people at the same time. This concerns me, as it will most likely kill server-processing power if I have to do and maintain hundreds of states at the same time.

I would have no problems moving all of the physics simulations to the client-side, but then I would really need a way to validate if the result of a client simulation is valid. However, I can't figure out how.

I have thought about running the simulation server-side once in a while to validate if the client is still playing fair, but I really want the server to have as less strain as possible.

Physics will become about as complex as the GDC 2011 demo by Glenn Fiedler, maybe even simpler. However, a lot more always-colliding rigid-bodies will be in a single scene and they will all be visible at once.

I have a hard time getting an answer to this particular case, as most resources on the web - again, Glenn Fiedlers site being a great one - speak about small-scale networked physics (eg. a FPS with 30 players, like Halo).

Any advice, websites, papers or the like on the subject will be very appreciated.

A recap of the questions I would like an answer to:

How feasible is a client-server model? Is my server-processing power concern legit and grounded?
Is it possible to reliably validate a physic simulation run by the client on the server? If so, how?

sentences:
Directx 12 ultimate. What has changed? We have Windows 10 2004 with new sdk, we have new nvidia drivers with support wddm 2.7 and Dx12U but I still can't understand - how it should help to developers write one code for all platforms?
I don't see any new D3D_FEATURE_LEVEL_12_2, I don't see any new feature to help developers write one code to xbox and pc. Developers still need to check if user has support for all new features as they did before. So what is changed? For me it looks like it was made only for non-tech users who will ask seller give him only GPU with Directx 12 Ultimate sticker and that's all.
Microsoft docs doesn't have any information about directx 12 ultimate, only some blog posts.

sentences:
Convert gl_TexCoord[0].st to match version #330 I'm currently working on a sfml based library where I'm implementing widgets with shaders. I'm defining an quad with position and texcoord in sfml to make the shader apply to the object like this:

quad[0].position = sf::Vector2f(100, 100);
quad[0].texCoords = sf::Vector2f(0, 0);
quad[1].position = sf::Vector2f(410, 100);
quad[1].texCoords = sf::Vector2f(1, 0);
quad[2].position = sf::Vector2f(410, 410);
quad[2].texCoords = sf::Vector2f(1, 1);
quad[3].position = sf::Vector2f(100, 410);
quad[3].texCoords = sf::Vector2f(0, 1);

This way I'll make gl_TexCoord[0].st ready to use without dividing with resolution to make it in rage [0, 1]. But when I'm adding #version 330 I get a deprection error. Since I'm using OpenGL 3.3, I'm looking to stick with the moder shader methods and to avoid deprecated stuffs.

Here's how my shader looks like and works without version definition:

void main() {
     vec2 pos = gl_TexCoord[0].st; // deprecated since #120
     gl_FragColor = vec4(pos.y, pos.x, 1.0, 1.0); // also deprecated too
 }

sentences:
Why would a game developer write their own engine instead of using existing ones? I have observed that many big and well-known game developers often develop their own engines. Examples include Valve, Crytek, Ubisoft, Epic Games and Square-Enix.

Could it simply be because they can, or is it likely that existing engines do not meet enough requirements, so we would develop our own? I can hardly imagine a game that requires a specific engine. The likes of of Unity or Unreal are simply enough to make any kind of game; even if not, they have source code, which can be modified to satisfy even some extraordinary needs.

Why would a game developer write their own engine instead of using existing ones?

sentences:
Transmit map vs Transmit seed Given a map created with procedural generation algorithms, should the server transmit the seed used to generate this map (so client must contain the same algorithm) or maybe send all the information?.

I'm inclined to send the seed, i have in mind generating big maps. Right now, i have one seed to generate multiples seeds, and each one is used to generate a chunk, so this last seed would be transmited to each client everytime someone needs information about a new chunk.

sentences:
Implementing a 2d Selection Box I'm in the process of implementing a selection box for my simulation and am having difficulty with something which appears simple. At the moment, I can draw the selection box and accurately select the items under it, provided the box was dragged from the top-left-hand corner downwards:

If I start dragging the box from any other point the rectangle doesn't correspond to that of the viewport, as demonstrated by the negative width and height.

Here is my code:

// selectionBox is Rectangle

if (mouse.LeftButton == ButtonState.Pressed && prevMouse.LeftButton == ButtonState.Pressed)
{
    if (selecting)
    {
        selectionBox.Width = mouse.X - selectionBox.X;
        selectionBox.Height = mouse.Y - selectionBox.Y;
    }
    else
    {
        selecting = true;
        selectionBox.X = mouse.X;
        selectionBox.Y = mouse.Y;
    }
}

// Code to handle selection finished omitted

// Drawing code
if (selecting)
{
    DrawingHelper.DrawRectangle(selectionBox, Color.Yellow, false);
    DrawingHelper.DrawRectangle(new Rectangle(startPoint.X - 4, startPoint.Y - 4, 8, 8), Color.Red, true);
}

How can I adjust the X, Y, Width and Height of my selection box so that X and Y are always the top-left of the selection box no matter where the selection began?

sentences:
OpenGL RTT FrameBuffer question and Rendering to texture while sampling it What i need to do:

Blur the selected texture and pass the texture to another effect for postprocessing.
Notice that i want one texture passed all over.

How do i want to do this:

Bind the FBO ( with texture to be blurred attached as colorbuffer )
Change the FBO viewport size to match the texture size
Enable the shader
Bind the texture
Render viewport sized quad with the texture and output to that texture via FBO colorbuffer
Unbind texture
disable shader
Disable fbo
...
pass that texture to another effect..

What i have already done:

A FBO with ColorBuffer attached ( the texture i want to blur ),
The shader
All the other reqd stuff..

What's the problem?

When i want to blur texture and i bind that texture as a color buffer to my FBO, and then pass the texture via uniform to the shader while rendering to sample it (and blur), the results are not stored. Seems like FBO can't have the same texture stored as output and sample it at the same time ( kind of understandable ).

Question:

Is this normal behavior ? How do i approach 'blur a selected texture' so that i can pass one texture over to another effect to work on it ?

I can imagine a 'dummy' texture within the effect class to which FBO renders to and then it gets copied to a texture that was requested to be modified..
Any better option ?

Thanks for shedding a bit of light on this, i think i need some logic help in here.

sentences:
Target Tracking: When to accelerate and decelerate a rotating turret? Say I have a moving circular target defined as:

Vector2 position;
Vector2 velocity;
float radius;

And a rotating turret (mounted on a moving vehicle of some kind) defined as:

Vector2 position;
Vector2 velocity;
float angle; // radians
float angularVelocity; // radians per second
const float maxAngularVelocity; // radians per second
const float maxAngularAcceleration; // radians per second per second

(Or something along those lines. Note that position and velocity of both are controlled elsewhere - assume velocity is constant and position changes based on velocity.)

I am trying to write two related AI functions to determine, on a given frame:

What angular acceleration (and in which direction) to apply to the turret's angle to keep the turret pointing at the target?
If the target is currently in sight, can it (any part within its radius) be kept in sight for x seconds, where x is a fraction of a second? (Alternatly: is there another strategy to ensure the target is actually "locked on" and not simply flying across the sights?)

And I could use some help...

sentences:
What's the best way of drawing a glowing 3d line using LWJGL? Sort of like a strip-light effect; not actually a light source, but just a polygon with glowing edges.

Can this be done easily? Right now I'm contemplating drawing a line more than once with varying alpha/width values to achieve this, but I think that'll cause weird glowing points at the vertices, which is far from ideal.

sentences:
How do I calculate the motion of 2 massive bodies in space? I'm writing code simulating the 2-dimensional motion of two massive bodies with gravitational fields.

The bodies' masses are known and I have a gravitational force equation.
I know from that force I can get a differential equation for coordinates.
I know that I once I solve this equation I will get the coordinates.
I will need to make up some initial position and some initial velocity.

I'd like to end up with a numeric solver for the ordinal differential equation for coordinates to get the formulas that I can write in code. Could someone break down how from laws and initial conditions we get to the formulas that calculate x and y at time t?

sentences:
How do you get player to interact with level? I suffer from this problem where I have say a class called Player and a class called Level. Now the only way I can figure out how to say make the player interact with the level is if I do something like

player.input();

level.update(player);

I would have to do something like that, but then it gets even more complicated if I have monsters and I need to add them to the level e.t.c., so how do I get the monsters to interact with the player.

So I'm struggling with this basic concept. If I use C it gets rid of this problem as I use extern and I can get the data I want so all I think about is the flow. So in C I can do something like this

switch (terrain[u.y + dy][u.x + dx])
{
case WALL:
print_msg("You cannot go there.\n");
return 0;
case FLOOR:
case DOOR:
case STAIRS:
reloc_player(u.y + dy, u.x + dx);
return 1;
}

So in here we have Player u and your moving that player around only if it doesn't hit a wall. But, I can do this because I use extern on terrain[][].

I'm really struggling. I don't really want to use C as C++ is easier with SFML and I like classes. I suppose the answer is how do I manage interaction between level, mobs and players?

If I was going to do it now I would do this

Game::Game()
{
   level.init();
   player.init();
}

void Game::input()
{
  player.input(level.getLevel()); // so yucky
}

void Game::update()
{
  player.update();
  level.update(player); /// yuck
}

void Game::render()
{
 player.render();
 level.render();
}

I could do something like this, but it gets really complicated and everything becomes a mess of passing stuff around. In particularly I need to pass the player method to the level.update() so the level knows the player has moved. Everything gets messy and I feel I can't add into the game. Plus I would need to make the level static or something.

sentences:
libGDX game crashes on Android without any mention of crash in logs No mention of any issue in process logs, an application just turns off during loading assets (~3% of all assets loaded). It works fine on desktop.

Only thing that seems related in global logs is this:

09-01 15:15:25.261 824-22928/? W/ActivityManager: Force removing ActivityRecord{911979f u0 xxx.xxx.xxx/.AndroidLauncher t664}: app died, no saved state

I suspect there might not be enough of memory, but why there is nothing in logs? I tried limiting JVM memory on PC to 512MB and it runs fine. But I am not entirely sure if this limit covers also native memory. Could that be the reason why it runs with limit set and yet crashes on a mobile device with 2GB memory?

sentences:
Bringing over OpenGL code to unreal engine? So I've been developing games and apps in C++/OpenGL for a while, and am thinking of starting to use Unreal Engine for many things.

I've built up quite the huge libarry for UI / rendering related code, but they rely on OpenGL for rendering. Will I have no choice but to reimplement these / use unreal engine's, or is there some way to integrate them together?

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:
What is causing these visual artifacts on my OpenGL sprites? What could be the cause of the defects in my characters sprite? I am using OpenGL ES 2.0. I draw my sprites in a sprite batch that uses UV coordinates from one large texture atlas. If you look around the character' edges, you'll see two noticeable problems:

The invisible alpha background is not invisible, but shows a strange static-like background.
There are unwanted streaks  where the character nears the edge of the frame (but only in some frames of the animation, this happened to be one of them).

Any idea what could be causing these? I will provide related code if asked for, but I'll try to avoid just dumping the entire project and expecting someone to look through it all.

EDIT: Here's a bit of code:

This is how I generate my UV coordinates:

private float[] createFrameUV(int frameWidth, int frameHeight, int x, int y){

    float[] uv = new float[4];

    if(numberOfFrames>1){
        float width = (float)frameWidth / (float)mBitmap.getWidth();
        float height = (float)frameHeight / (float)mBitmap.getHeight();
        float u = (float)x / (float)mBitmap.getWidth();
        float v = (float)y / (float)mBitmap.getHeight();

        uv[0] = u;
        uv[1] = v;
        uv[2] = u + width;
        uv[3] = v + height;
    }else{
        uv[0] = 0f;
        uv[1] = 0f;
        uv[2] = 1f;
        uv[3] = 1f;
    }

    return uv;
}

These are some OpenGL settings:

GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);

sentences:
How to change the position of a dialog? I have created a dialog in Libgdx main menu screen.

I have tried

dialog.setPosition(300, 300);
dialog.show(stage);

It doesn't do anything. Is it a camera trick? Am I missing something?

sentences: How can I draw outlines around 3D models? How can I draw outlines around 3D models? I'm referring to something like the effects in a recent Pokemon game, which appear to have a single-pixel outline around them:

sentences:
Speed up the DirectX game - how else can I boost the fps with typical triangle drawing? I am writing my own c++/DirectX engine. I've made the basic framework and here comes the time for optimizations.

I don't want to focus on optimizing the resources themselves right now (meshes, textures) or on instancing. I've also commented out shadows and normal mapping for that test. So it's just a "flat" problem of "how to speed up rendering that vertices?".

The meshes are fully static, loaded from files (no terrain generation involved).

I just have about 120.000 triangles with textures on scene (one shader, few models). And on my laptop I get about 20-40fps. I was able to increase fps with vsync and back-face a bit (note that camera is rotating and fps falls when all 120.000 triangles are within its range):

Still, other engines (Unity, Unreal) can render the same meshes faster on the same hardware (and Unreal does it even faster then Unity which still is better then my DirecX11/c++ implementation). How they do that? I know there are many "pro programmers" behind that engines, but they are no magicians. And some solutions should be possible to apply in my engine too (vsync was easy to apply yet it gave me a nice speed boost).

I use DirectX 11, c++. I use Visual Studio if it's important. There is very little logic involved in application, no physics, no searches etc. that could slow down the render loop.

So far I made just few optimizations:

Dynamic/static vertex buffers where they are needed. Index buffer.
Back-face culling.
V-SYNC (more about removing bugs but also helped with fps a bit).
Near/far clipping.
Compressing textures into single texture atlas (I've not done it yet, but I am aware of that technique).
Lowering the AA (e.g. MSAA) and resolution (but it has an big impact on render quality).

I know my hardware is capable of rendering such amount of triangles. But how to help it? My problem is that I don't know all the tricks & methods that can be used here.

If any part of the source code would be useful, just comment me (I'm not sure which parts should I post and I don't want to paste meaningless code listings). I will post the results of fps increase/decrease as I manage to incorporate new optimizations.

sentences:
Any good pattern for managing user input in XNA I'm doing some experimentation on XNA, and unlike past experiences with XNA, I wanna do stuff right.

Are there any good patterns for managing user input?

Like... how do I manage what components get the input?

Is there anything like that? I feel like doing the normal - checking for state of a button and if-ing for every thing you need... It can't be that there isn't something more clever and well designed to do that.

I feel that the wheel has already been invented here, I just can't find it.

sentences:
Unity: How to import a SINGLE animation for an existing character? The Holy Grail of animation solutions (for me). Right now, if I want to append a new animation for an existing character, I don't immediately know what to do. I assume I need to bring the same FBX into the Assets folder with the new animation, copy the animation, drag that onto my previous prefab, and delete the new FBX.  But that is such a pain!

I already have a VERY complicated animation tree that is executed via a script and some animation events. How can I quickly save and import a new animation into Unity, made with Blender?

sentences:
Unity's pack 4 floats Linked to: GLSL pack floats into an RGBA texture

I found EncodeFloatRGBA/DecodeFloatRGBA shader functions in Unity https://gist.github.com/hecomi/9580605

Now I try to figure out how they work. So I try them on C++
http://coliru.stacked-crooked.com/a/345f8c403d4a78f9

But I got wrong results. Also I tried that with Mathematica, and got the same wrong results.  http://www.sendspace.com/file/qmlu8b

I tried to encode {0.1, 0.2, 0.3, 0.4} - but after encode/decode got {0.0980392,0.698039,0.79649,0.93266}

sentences: What's the minimum viable product to present a game to a publisher? I am currently working on a puzzle game. I am aiming in the future to ask a publisher to publish it. What do you think could be the minimum viable product to reach before sending it. I am talking about the completeness of the work (number of levels, graphic details etc)

sentences:
space map generation I am at the beginning of the creation of a space 4x and first of all i need to generate a galaxy of stars linked by connecting lines that changes in each new game, I'll add a few pictures to show what i want

So how can i have a simple 2d map with connected points like these images ? I thought to program each line with a random length and a random angle or program polygons by polygons but it is still unclear.

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:
How do I derive the angular movement for a craft I have the regular (linear) motion implemented like this:

class Craft{
...
Vector location, velocity, acceleration, angularVelocity, angularAcceleration;

...
//the move class responsible for linear motion
//this method works
 public void move(Vector target){
  Vector desired = target.sub(location);
  desired.normalise();
  accleration.set(desired.multipied(speed));
  velocity.add(acceleratio);
  location.add(velocity);
}

//the turn method
//I need help/tips

public void turn(float angle){
//I need the craft to gradually turn in a circular motion
// so that eventually maybe 10 secs, it makes 360 degrees turn

}

}

sentences:
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:
Drawing Farseer Fixtures Is there any way how to draw a Polygon / Fixture from Farseer Physics with XNA?
As I deform these polygons at runtime I can't take any texture from my Content folder, the texture must be generated at runtime too.

sentences:
Getting width and height of view of game well I have googled it and got some answers, asked many times, answered many times.
as I read viewport is the "inside window"
So I have 2 integers, height and width
and this code:

        heightofwindow = graphicsDevice.Viewport.Bounds.Height;
        widtthofwindow = graphicsDevice.Viewport.Bounds.Width;

However, I get the error. It doesnt matter if I put it under update or draw. This seems like a more of language problem due to my limited knowlodge.

Object reference not set to an instance of an object.

sentences:
Proper way to encapsulate components? I've tried my hand at writing component systems and entity systems.

What I haven't managed to solve is the problem of event collision.

Say, we have an components A,B and C. A triggers 'kill B' event. When B recieves it, it erases the message (doesn't propagate it further). When C recieves it, it erases B. The order of which component will get the event first is not defined.

When the order is 'A,B,C', B stays alive but with 'A,C,B' B is erased. In other words, side effects of the event are undefined. A,B and C need to know about each other (which I don't want) to handle the event properly.

I intend to use components for games so for a more substantial example: we have an arrow (Projectile component) which fires of a collision event upon striking Link (Collidable component). Link has shield (also Collidable) which stops damage from affecting Link's Health component.

Arrows and health were written without the shield in mind and my component architecture is supposed to be encapsulated, so Health processes the collision event without knowing about the arrow or shield. Whether or not the damage is stopped depends on the order of components, which is random.

The best I've came up with is keeping a 'cache' of actions the event will do at the end of processing but still this solution has the same problems, only delayed. I could ditch events and try entity component system with storing 'mutations' in systems but that's not much different from just using global data for everything.

EDIT:

Okay, my communication skills are terrible. Here's what I've done to make components working without knowing about each other:

Use 'pure' entity system (components are pure data, all logic in systems)
Components do not talk to each other. The systems talk to each other by adding system-exclusive components to entities
Systems for above situation are: Movement, HandleCollision, ApplyArrowDamage. Movemen t appends a Collision component to the 'reciever' of the collision (Link) when calculating movements. HandleCollision reacts to Collision component, appends ArrowDamage component to Link entity and removes Collision component from Link. ApplyArrowDamage does just that and removes ArrowDamage component and maybe appends Dead component to be handled elswere.
Now, to create the situation when the shield blocks arrows, I create an CheckShield system and place it between HandleCollision and ApplyArrowDamage. CheckShield works with ApplyArrowDamage, checks whenether the reciever (Link in this case) has a shield equiped and removes ArrowDamage component if so.
This way, my old code doesn't need to account for new code to work properly and vice versa.

For the 'ABC' situation I do the same: If I want C to erase B, I write a new system that works with C and fires off before the system that works with B.
The only sane way to solve this problems with event raising is to keep rethrowing the event whenether it's state changed, and keep rethrowing it until it doesn't changed in the last iteration.

sentences:
Using Perlin/Simplex noise in a 2d tile game for terrain generation I've been doing a bunch of research regarding procedural 2d terrain generation and have come to the conclusion that the use of perlin/simplex noise seems to be the way to go for most things.

I've copied the code from opensimplex noise and generated some noise, but I'm not really sure what to do with that? How can I take this noise and use it to create terrain similar to games like Diablo2 or Path of Exile? Things placing trees and rivers, etc.

Also, would it be possible to use this to create simple tiles for my game? Say I wanted to create a bunch of different grass tiles(Isometric), would I be able to do this?

EDIT:
So I've tried the following code to try and generate some natural looking rock placements and I'm not quite sure I understand how it's working. I've used the condition value < .1 for placing a rock, but the world seems to be full of rocks. Am I doing something wrong, or am I just not understanding how it's supposed to work?

    private void populateObjects(TileLoader tileLoader)
    {
        OpenSimplexNoise noise = new OpenSimplexNoise();

        for (int i = 0; i < layers[1].layerData.GetLength(0); i++)
        {
            for (int j = 0; j < layers[1].layerData.GetLength(1); j++)
            {
                double value = noise.Evaluate(j, i);
                if(value < .1)
                    layers[1].layerData[i, j] = tileLoader.getTileByName("grassrock");
            }
        }
    }

Here's a screenshot of something this produced:

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:
2D game engine for UI - suggestion needed I am planning on making a simple real-time strategy game from the series Stargate Universe. For those who don't know, in the series' center is a spaceship called Destiny. It has a nice control room, with a control interface, what has a holographic control screen. The game basically would run on this. That's what I want to do, easily.

Can you suggest me ANY free 2D engine, what has:
- A top-view area for combat and ship management

Many UI elements what can be used easily
a top-on GUI part, where the actual GUI can be put
a nice GUI for putting all together (a game development framework or workbench)

And written in:

C#
ActionScript (Flash)

It is a bit reverse-like, as at the bottom of the layers would be the UI, over it the buttons, and over them would be the actual playground (battlefields, ship elements, etc).

Can you please help me?

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:
DirectX 11 GenerateMips only works with premultiplied alpha? The GenerateMips method in the ID3D11DeviceContext allows generation of mipmaps at runtime, which is fine for fully opaque textures. However, when this method is used with transparent textures that do not have premultiplied alpha, the resulting mip levels tend to have black outlines at the transparency edges. For instance, this PNG texture, loaded through WIC and processed with GenerateMips, produces mipmaps with edge pixels that are way too dark:

My question: Is there any way to specify to that this texture uses non-premultiplied alpha, so that DirectX can generate more correct mip levels?

sentences:
why is glVertexAttribDivisor crashing? I am trying to render some trees with instancing. This is rather weird, but before sleeping yesterday night, I checked the code, and it was in a running state, when I got up this morning, it is crashing when I am calling glVertexAttribDivisor I haven't changed any code since yesterday.

Here is how I am sending data to GPU for instancing.

    glGenBuffers(1, &iVBO);
    glBindBuffer(GL_ARRAY_BUFFER, iVBO);
    glBufferData(GL_ARRAY_BUFFER, (ml_instance->i_positions.size()*sizeof(glm::vec4)) , NULL, GL_STATIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER, 0, (ml_instance->i_positions.size()*sizeof(glm::vec4)), &ml_instance->i_positions[0]);

And then in vertex specification--

    glBindBuffer(GL_ARRAY_BUFFER, iVBO);
    glVertexAttribPointer(i_positions, 4, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(i_positions);
    glVertexAttribDivisor(i_positions,1); // **THIS IS WHERE THE PROGRAM CRASHES**

    glDrawElementsInstanced(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0,TREES_INSTANCE_COUNT);

I have checked ml_instance->i_positions, it has all the data that needs to render.

I have checked the value of i_positions in vertex shader, it is the same as whatever I have defined there.

I am little out of ideas here, everything looks pretty much fine. What am I missing?

sentences:
Simple way to serialize save game data whilst allowing for future features Is there a simple way to 'serialize' the game data of my game, but protected it from being unloadable if I add new fields?  I have all the data in a single class, GameData.java, and I want to avoid having to manually read/write each field from it.  If I serialise it using standard java function, but add new fields to the class, it will render it unserializable.

I'd like to be able to save the class and the reload it from a file, and it use default values for any new fields that are missing from the save file.  XML may be a solution, but is there an existing library to automate the process?

Thanks!

sentences:
Event-driven Communication in a Game Engine: Yes or No? I am reading Game Coding Complete and the author recommends Event Driven communication among game objects and modules.

Basically, all living game actors should communicate with the key modules (Physics, AI, Game Logic, Game View, etc.) via an internal event messaging system. This means having to design an efficient event manager. A badly designed system eats CPU cycles, especially affecting mobile platforms.

Is this a proven and recommended approach? How should I decide whether to use it?

sentences:
Advice creating build process for medium sized game project I've been looking through the SCons build script for Doom3 and researching different approaches to build processes used by professional game developers/studios (C/C++) and I've come across a few questions:

When creating a build script (scons/make file etc.) is it used every build when coding within an IDE like say Visual Studio? In other words do you tend to just use the tools in Visual Studio (Project files etc.) when you want to test a small code change? Or do you step outside VS and run the scripts to get the project to a point that it can be run?
An extension of question 1, if you use VS entirely for these kinds of builds, how far do you take it? i.e. do you have it copy the game into a folder with all the assets or run any kind of install scripts?
If your feeling generous could anybody give me a quick overview of the kind of things you're including in your build steps? Asset creation/install scripts/folder structure creation etc.

Many thanks all.

sentences:
LibGDX - Drawing animation before specific tiled layer is drawn I'm using TildedMap to separate map layer, drawSprites layer and objects layer.I'm trying to draw the map, then the player animations and then the objects on the map. This way I'll be able to have the player walk behind an object. This works for single sprites but not for animations. When I run the game, it doesn't draw the animation and if I render the animation continuously, the object layer is never reached. What can I do to get around this?

public class PlayerRenderManager {
.....

//Animation for when the player is moving up
public Animation<TextureRegion> playerUp() {
    TextureRegion[][] tmp = TextureRegion.split(textureUp, 32,32);
    TextureRegion[] walkUpFrames = new TextureRegion[4];
    sprite = new Sprite(textureUp);
    int index = 0;
        for (int j = 0; j < 4; j++) {
            walkUpFrames[index++] = tmp[0][j];
        }
        animation = new Animation<TextureRegion>(1f/30f,walkUpFrames);
        return animation;
}

Rendering class

public class MapRenderManager extends OrthogonalTiledMapRenderer {
......

private float stateTime;
public void render(Player player, ArrayList<Actor> actors, ArrayList<Projectiles> projectiles, PlayerRenderManager playerrender) {

    stateTime += Gdx.graphics.getDeltaTime();
    beginRender();
    int currentLayer = 0;
    for (MapLayer layer : map.getLayers()) {
        if (layer.isVisible()) {
            if (layer instanceof TiledMapTileLayer) {
                renderTileLayer((TiledMapTileLayer) layer);
                currentLayer++;

                // draw sprites if ground layer has been rendered and object layer is yet to be rendered
                if (currentLayer == drawSpritesAfterLayer) {

                    batch.draw(playerrender.playerDown().getKeyFrame(stateTime, true),0,0);

                } else {
                    for (MapObject object : layer.getObjects()) {
                        renderObject(object);
                    }
                    for (int i = 0; i < projectiles.size(); i++) {
                        projectiles.get(i).getProjSprite().draw(this.getBatch());
                    }
                }
            }
        }
    }
    endRender();
}

sentences:
What is the easiest way to move towards and along the edge on a hex grid? I have a hexagonal grid with variable radius. My entity can move exactly two hexes per turn.

How should I calculate next step towards border and afterwards travelling clockwise around map?

Preferred movement at the boundary

Character should stay at the border while moving counter-clockwise every turn.

Example movement at the middle

Character should move 1 or 2 hexes towards edge every turn.

I can't figure out simple math to do this.

Edit:

This is how I did movement at the boundary:

  var x = pos.x;
  var y = pos.y;
  var z = -pos.x-pos.y;
  var dx =  0;
  var dy =  0;

  if      (x == -radius && z >   1) {          dy =  2; }
  else if (x == -radius && z ==  1) { dx =  1; dy =  1; }
  else if (y ==  radius && x <  -1) { dx =  2           }
  else if (y ==  radius && x == -1) { dx =  2; dy = -1; }
  else if (z == -radius && y >   1) { dx =  2; dy = -2; }
  else if (z == -radius && y ==  1) { dx =  1; dy = -2; }
  else if (x ==  radius && z <  -1) {          dy = -2; }
  else if (x ==  radius && z == -1) { dx = -1; dy = -1; }
  else if (y == -radius && x >   1) { dx = -2;          }
  else if (y == -radius && x ==  1) { dx = -2; dy =  1; }
  else if (z ==  radius && y <  -1) { dx = -2; dy =  2; }
  else if (z ==  radius && y == -1) { dx = -1; dy =  2; }

Any ideas how should I clean this up?

Shortest path to boundary is probably easiest to calculate from x, y and z.

sentences:
How do you create your levels containing curved slopes in Box2d? I have just started developing games for iPhone in Cocos2d and am currently working on a Box2D prototype. I know this is not an easy start, but I have experience in the AS3 port of the physics engine. And ... I am stubborn.

My question is:
How do you implement and create your levels in the project. Is there a good parser out there or maybe a nice approach you guys know of? I am looking for a way to create curved slopes and of course circles and rectangles.

I have read about LevelSVG but it seems to add a lot of functionality that I don't want. I am a Flash game developer and I am used to writing the game logic by myself. Is this product worth the money if all you need is the parser?

Thanks

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 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:
Making plane with quad I'm a beginner Unity 3d developer. I want to keep quads one aside another touching each other and use that as a road for making an endless runner game. The problem is each of the quads have their own box collider thus the car bounces a little bit sometimes.

Is there any way to get those stuff connected with each other and make the whole thing behave like a single plane?

I know using a big box collider covering all the quads in the repeating unit is gonna work but I don't want to use that.

sentences: In Hammer, how can I make a sound come from a physics object? In hammer, I want to make a functioning radio, as in the sound comes from the radio itself and when you pick it up and move it around the sound's origin moves with the object.

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 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:
Mapping noise to sphere surface I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea was to create a Perlin like "3D Noise Field" and sample density where each of the spheres vertices fall (as a height-map value). this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

pseudo example and result:

public void Terrain(float Scale)
{
    if (Scale < 0.01) return;

    List<Vector3> terrain = new List<Vector3>();
    for ( int i = 0; i < surface.vertices.Count; i++)
    {
        Vector3 vert = sphere.verts[i];
        Vector3 direction = vert.normalized;
        Vector3 newpoint = vert * Sample3DNoise(direction, Scale);
        terrain.Add(newpoint);
    }

    //this line replaces the original shape!
    surface.vertices = terrain;

    Debug.Log("terrain Update");
}

public float Sample3DNoise(Vector3 point, float scale)
{
    //Vector3 direction = point.normalized;

    float u = point.normalized.x * scale;
    float v = point.normalized.y * scale;
    float w = point.normalized.z * scale;

    //poor attempt at 3d noise field
    //PerlinNoise(float, float );
    float x = Mathf.PerlinNoise(u , 0f);
    float y = Mathf.PerlinNoise(0f, v);
    float z = Mathf.PerlinNoise(u , v);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3;
}

edit:

so while it appears i was able to achieve this, it's is clearly not the "terrain on surface of sphere" look I was aiming for. Any suggestions on how can I change the "noise field" so my surface is more planet like? or how else can i achieve this?

sentences:
OpenGL - Arcball camera rotation I'm implementing arcball camera rotation, whereby a camera is looking at a coordinate and rotates around it in the x-axis or the y-axis such that the camera is circulating around it; the y-axis will be capped to prevent flipping.

Suffice it to say it's not producing the output I want as it isn't rotating around the target. I'm not sure where the problem may lie, though my code:

void Camera::rotate(float x, float y)
{
    x *= pMouseSensitivity;
    y *= pMouseSensitivity;

    pYaw += x;
    pPitch += y;

    if (pPitch > 89.0f)
        pPitch = 89.0f;
    if (pPitch < -89.0f)
        pPitch = -89.0f;

    pPosition = glm::rotate(pPosition, -x, pUp);
    pPosition = glm::rotate(pPosition, -y, pRight);
}

The rotate function takes in x and y from where the mouse position is at. These values are then added to yaw and pitch respectively before the position of the camera is rotated based on the x and y. I update the camera as follows:

void Camera::update()
{
    pForward = pPosition - pTarget;
    pRight = glm::normalize(glm::cross(pForward, pWorldUp));
    pUp = glm::normalize(glm::cross(pForward, pRight));

    pViewMat = glm::lookAt(pPosition, pTarget, pUp);
    pProjMat = glm::perspective(pFieldView, pAspectRatio, pNearPlane, pFarPlane);
}

The world up vector is always vec3(0, 1, 0) and is unchanged throughout, for resetting the camera. I set the target of the camera with:

void Camera::orbitAround(glm::vec3 focus)
{
    pTarget = focus;
}

This function would then take in an arbitrary point or even the position of a 3D rendered model. I have been looking at a few tutorials regarding arcball rotation, and from what I can understand it involves pTarget being what's looked at, and the rotation revolving around it. What does strike me is that I'm not using pitch and yaw, so will have to look into what I should be doing with them. Producing the arcball rotation is what confuses me, and I require some help on it. Pseudocode would be great!

sentences:
How to create in game menu attached to unit I'm creating a game similar to Banner Saga, except my game will be in 3D, with a camera that can move around and zoom in and out. What I want is for a menu to appear after the user clicks on a unit. This menu must always be visible and facing the camera.

The menu that has the foot and sword symbols is what I want.

How can I get a similar result in 3D? The new Unity UI canvas isn't really suitable, since the camera will move around, and the menu must stay next to the unit. The menu elements can't be covered up by things in front of it, like other units. Thanks

sentences:
Dynamic items in Scrollable Vertical Layout overlap Unity I have followed steps from this tutorial site to create dynamic scrollable vertical layout. I am trying to show 10 prefab buttons in a scrollview dynamically. I can see buttons at runtime, but they are overlapped.

ScrollPanel:

Content Container

I am probably missing some components tweaks. Or problem is due to anchors? Please guide me to resolve this issue. Thanks.

sentences:
Input and output of a server side game using web sockets I am having a look at redeveloping an old flash based top-down zombie shooter game I made in highschool so that it supports multiplayer using socket.io. My experience over the last 5 years has been mostly writing server-side code, so writing the game logic itself on the server isn't a huge concern. The places I am having trouble with due to my very limited experience with sockets specifically is:

What the most appropriate input and output should be to and from the server in a game context.
How much data is appropriate to send.

Off the top of my head, I imagine the process would look something like:

The server runs the game (using NodeJS).
Clients that connect send their input to the server (key presses, clicks, etc).
Those inputs are queued against the client ID on the server and interpreted to move their character or whatever it does.
The server sends back the updated position of the client as well as everything else around the client in the "world".

The last point is where I have the most doubts. Assuming a reasonable collection of objects in the world, I am not confident that sending through the position of everything every ~30ms to every client would be sustainable (though I really don't know what is sustainable with web sockets). Then again, maybe it actually is perfectly fine to do this.

Obviously I can limit the amount of objects by only sending ones who have actually been updated (so static objects would never come through, etc) but I am not sure whether that is necessary at all or whether that is something extremely crucial. I also don't see this working if we implemented something like everyone being able to fire 100s of projectiles (or some other massive collection of constantly updating objects).

Are there any general guidelines or common knowledge around how much data you would expect to see come through a web socket and how frequently? Am I way off the mark or would this work okay for a moderate amount of clients?

I realize this all sounds very broad so to try tighten it up a bit I am specifically interested in how much data is realistic to send through web sockets and how frequently. Any auxiliary information based on the above is a great addition.

sentences:
How can I disable an Animator from the Animation in Unity? How can I disable an Animator from the Animation in Unity?
The Animator enablement checkbox seems to be highlighted, which makes me believe that the enablement of the Animator is an animatable property itself. But whenever I try to animate it the enablement toggling just does not get recorded onto the animation line.

It feels like I am missing something here. If someone notices me doing something wrong, could you, please, point it out.

sentences:
Is this a reliable method of parsing glGetShaderInfoLog()? I want to get a list of errors and their line numbers so I can display the error information differently from how it's formatted in the error string and also to show the line in the output.

It looks easy enough to just parse the result of glGetShaderInfoLog(), look for ERROR:, then read the next number up to :, and then the next, and finally the error description up to the next newline.

However, the OpenGL docs say:

  Application developers should not expect different OpenGL
  implementations to produce identical information logs.

This makes me worry that my code may behave incorrectly on different systems.
I don't need them to be identical, I just need them to follow the same format.

So is there a better way to get a list of errors with the line number separate, is it safe to assume that they'll always follow the "ERROR: 0:123:" format, or is there simply no reliable way to do this?

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:
Decompose a Mesh so that each piece can be watched by a Guard inside the piece The title pretty much explains it but I'm gonna go into more details.
We have 3D mesh object and we want to decompose it into separate objects so that each one of these objects can be seen completely if we place a point somewhere inside them. The point location will not be random. We just need to make sure that there is a place inside the objects where the point can see the object completely.

If we speak in 2D terms, we are trying to break down the mesh in star-shaped polyhedrons.

There is an algorithm on this by Keil for the 2 dimensions (Minimum star-shaped decomposition) but I haven't found anything on 3D.

There are,however, papers on convex decomposition and this works but it will lead into more parts than I would like .  Will I have to rely on these? How else should I approach this?

Extra notes:
We have to do with polyhedrons with no holes and the decomposition doesn't have to be the minimum one.

sentences:
Minecraft chunk file decompresssion First of all, hello everyone,

I'm currently making a program to read Minecraft region files (r.#.#.mca) for a server.
The problem I have is that I can't decompress them, I tried GZip and ZLib decompression but none of them worked. I already searched for solutions but there is little to no information online. It's really important that I find a solution to that issue.

Thanks in advance.

sentences:
How to pathfind over an obstacle? How to represent the following situation best - agent (@) needs to get to the goal($). The path is blocked by a moat(~~~). A rake (or some other device, like waterwalking boots) is available that will make it possible to cross the obstacle.

.....~~~...   . ground
...=.~~~...   = rake
.....~~~.$.   ~ water
.@...~~~...   @ agent
.....~~~...   $ goal

How to properly pathfind from @ to $ provided there is no immediately available path? Should my path have not only cost but also prerequisites?

UPD: The problem is the goal is not accessible and rake is just one of many possible objects on the map. Question then is "how to make the agent understand that it needs the rake?"

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:
Box2D how to implement a camera? By now i have this Camera class.

package GameObjects;

import main.Main;

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

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

public static final float PIXEL_TO_METER = 50f;

private float yFlip = -1.0f;

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

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

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

public void moveCam(int mx, int my)
{

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

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

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

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

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

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

}

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

sentences: How do I lower the resolution scale in DX11? I've tried a lot of things including lowering the backbuffer size but that causes terrible scaling that I can't really control. I've also tried rendering the scenes to a smaller texture then scaling it up but that requires me to change all my coordinates and I'm pretty sure there's a better way. I'm trying to scale 800x600 scenes down to 200x150 then scaling them back up.

sentences:
What concepts are there for interactive water? I want water to be a gameplay object in my game. The player should be able to take in in a bucket and tip it out somewhere in the world. Water should flow in some way so that it can be used to build rivers and transport game objects or to create particular apparatuses. It's comparable to the game Minecraft where you can build cool things involving water or just create just some small waterfalls. However, there my game isn't made out of blocks so there is smooth terrain.

In most games water is simply placed at a given height. That works well for lakes and Oceans, but for flowing rivers and usage in apparatuses this concept is to limited. In Minecraft water is implemented as a block which spreads inside the blocky grid, too. That approach is a bit more what I need to realize my idea but I don't use these blocks and therefore such water simulation would look very misplaced.

What concepts of representing water which the player can interact with in the mentioned manners are there? How can I realize oceans, rivers, buckets and so on with one general approach? There shouldn't be an infinite amount of water. If you fill your bucket, the volume of the lake the water was taken from should decrease unnoticeable. Moreover if the player would place water somewhere that volume of water should never go missing.

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:
uniform z slices in clip-space 1) Context
I'm using a regular OpenGL perspective projection matrix created with GLM (glm::perspective) and taking the inverse (glm::inverse) to transform clip-space back into view space (and world space ultimately). Now with z-values at the near and far plane it's easy to choose the x,y,z,w components of the clip-space cube corners and get the world space point of the frustum volume.

2) Question
Now, I want to harness the fact that clip space is a cube and generate a grid over the frustum. for x,y this works with the regular inverse projection matrix. For z, if I take uniform subdivisions of the range [-1.0, 1.0] with w=1.0, the view space z values will not be linear. I haven't got enough sleep recently to convince myself to do the math. What would be an inverse projection matrix to do this?

sentences:
What gamepad functionality can be assumed? When I offer gamepad support, the simplest solution seems to be to assume XBox controllers and use a library that maps the most frequent gamepads to a similar layout.

Now if I want to minimize customer complaints, can I just use all the buttons (in a sensible way), or are there some I should avoid because they are missing on some common controllers?

The question is primarily about PCs (Linux/Windows/Mac), but does the answer change if we consider gamepads for mobile devices?

The one thing I know about is that we cannot use any input scheme that requires the user to press LT and RT at the same time, but that limitation affects XBox controllers as well.

sentences:
CCsprite.flipX not working! Here is my function, it makes random point on the ground and makes my sprite go there. If the x position of location is less then position of my sprite, I flip my sprite so it looked left (it looks right by default). But this is not working at all. I tried different flip methods but none work!
Please help what is wrong?

- (void) wander
{
    CGPoint rand = CGPointMake(CCRANDOM_0_1() * 270 , CCRANDOM_0_1() * 140 );

    float distance = ccpDistance([currentSprite position], rand);
    float speed = distance / 2;
    ccTime time = distance / speed;
    CCAction *move = [CCMoveTo actionWithDuration:time position:rand];

    if (currentSprite.position.x > rand.x)
    {

       currentSprite.flipX = YES;
    }
    else {
        currentSprite.flipX = NO;
    }

    [self runAction:move];
}

There is no problem with this code. Problem was that I was trying to flip sprite that was a child of my Pet object. When I tried flipping sprite everything worked just fine. If anybody could explain that, would be great.

sentences:
How to create rotating mode selection knob on multimeter I want to create something looks similar to this for electrical and electronic troubleshooting simulationw.
I need to know how to program the drag interaction that and rotates the knob to select the mode of operation.
I checked several videos including this one, but this is not what I'm looking for. I am hoping to drag and rotate the knob in a circle.
I also need to know how to set the operating mode based on rotation. For instance, if the knob is pointing at 0-5 degrees (after drag and release), the knob position is set to 0, and the device is in off mode; if it is at 85-95 degrees then angle=90 degrees, and the device is set to resistance measurement mode.

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:
Level loading with threads runs sometimes and doesn't run sometimes I am trying to load a scene in the background while displaying a loading screen till the scene loads and then changing the scene to the loaded scene and I am using threads and ResourceLoader to do so. On my computer it runs sometimes and doesn't run other times. And, on android it never gets completed the loading screen comes up and then the game just hangs.
On pressing the play button:
func _on_play_pressed():
        $loading_screen.show()
        go_to_scene(level_to_load, true)

The gotoscene():
func go_to_scene(new_scene, loading):
    if (loading):
        loading_thread = Thread.new()
        loading_thread.start(self, 'prep_scene', ResourceLoader.load_interactive(new_scene), 2)

The prep_scene():
func prep_scene(interactive_ldr):
    while (true):
        var err = interactive_ldr.poll();
        if(err == ERR_FILE_EOF):
            call_deferred("_on_load_level_done");
            return interactive_ldr.get_resource();

The onloadleveldone():
func _on_load_level_done():
    var interactive_ldr = loading_thread.wait_to_finish()
    print('thread', loading_thread.is_active())
    if get_tree().change_scene_to(interactive_ldr) != OK:
        print('error')

sentences:
How to increase fighting stats of a player without increasing HP? I'm currently making a simple game that requires a fighting system. The game consists of many (more than 100) levels that the player needs to go through to get to the end. In each level you get to fight creatures and monsters, and you evolve your skills by doing so (there are also other ways to do that but they're not relevant for the purpose of this post). The problem I'm having is that when the player reaches the higher levels, the fights become very hard to balance:

To calculate the damage the player does to the enemy, I was basing it on the player's fighting skill (which goes up with each fight) and the opponent's fighting skill (which is based on the level). However, if I make it so the damage is proportional to the ratio of the skills, when both skills are high, neither of them will do much damage. On the other hand, if I base it on the difference of these skills, a player with less stats than a monster can't to any damage to it (which is not what I want, as some monsters may have more fighting skills but you have more health, and vice-versa).

My question is if there's any easy way to calculate the damage that would scale well when both parties are very strong.

sentences:
How can I to get an animation to be triggered by proximity of a mesh actor (an object)? So I'm making my first build in Unreal 4 using Blueprint. The "game" calls for the player character to grab a particular object (a static mesh actor) and bring it close to a door that will slide open if detects the item near.
I have the door slide animation and a trigger volume around the door but I can't get it to work with the mesh actor I want. So far I've managed to get it to open with by pressing a keyboard key while being inside the trigger volume. I believe the volume trigger can detect any actor that is within its border, right?
What nodes could I use to make this work?
UPDATE: Thanks to @Stephen I tried using the cast node solution but I still can't get it to work
If it helps, I've added an updated screenshot of my blueprint.
Cheers!

sentences:
What is the proper way to create a camera matrix? I am having issues when trying to create a camera transform. It seems to have odd distortions and it does not seem to rotate properly, though it will translate alright. While I have seen issues like this where the rotation does not work, I have not found any like my issue.
This is what I currently do to create the matrix:
Mat4 TransformLookAt(Vec3 from, Vec3 to, Vec3 world_up) {
    Mat4 view_matrix = Mat4New(1.0f);
    Mat4 rot_matrix = Mat4New(1.0f);

    Vec3 axis_n = Vec3Normalise(Vec3Subtract(to, from));
    Vec3 axis_v = Vec3Normalise(Vec3Cross(from, Vec3Cross(world_up, from)));
    Vec3 axis_u = Vec3Normalise(Vec3Cross(axis_n, axis_v));

    // Rotate on the X-axis
    rot_matrix.ax = axis_u.x;
    rot_matrix.ay = axis_u.y;
    rot_matrix.az = axis_u.z;

    // Rotate on the Y-axis
    rot_matrix.bx = axis_v.x;
    rot_matrix.by = axis_v.y;
    rot_matrix.bz = axis_v.z;

    // Rotate on the Z-axis
    rot_matrix.cx = axis_n.x;
    rot_matrix.cy = axis_n.y;
    rot_matrix.cz = axis_n.z;

    // Translate the camera
    view_matrix.aw = -from.x;
    view_matrix.bw = -from.y;
    view_matrix.cw = -from.z;

    view_matrix = Mat4ByMat4Multiply(view_matrix, rot_matrix);

    return view_matrix;
}

The camera is at (1.0, 0.0, 3.0) at is set to look at (0.0, 0.0, 0.0), which is where the centre of the cube is located. Here is what it looks like:

I would expect to see the left side and possibly top of the cube (since that is what this is supposed to do), but instead the cube has been distorted so that its left side cannot be seen.
That leads me to this question: If none of the methods like the one I've tried to implement works, then what is the proper way to create a camera matrix? What am I missing so that this does not work?
I understand how it should work, but I just can't get it to work. I feel like it might be something obvious, but I can't seem to figure it out.

sentences: Terrain deformation via mouse in real time using OpenGL The main problem I’m facing is how I can, given a spot on a terrain mesh (x and z coordinates) change the mesh so that the surrounding points also change height but will be less affected. What’s confusing me is how I could change the mesh when that spot is not a vertex within the mesh so that the mesh will accurately represent the given point changing height. Would I need to change the mesh entirely, changing the vertex points completely to accommodate for the new shape (so possibly making that point a new vertex in the mesh and thus changing the mesh entirely) or is there some other way to do it without having to restructure the mesh so that the vertices that are affected by the height change move which will then change the faces to be in accordance with the change in height

sentences:
Box2D physics editor for complex bodies Is there any editor out there that would allow me to define complex entities, with joins connecting their multiple bodies, instead of regular single body entities? For example, an editor that would allow me to 'define' a car as having a main body with two circles as wheels, connected through joints.

Clarification:

I realize I haven't been clear enough about what I need. I'd like to make my engine data-driven, so all entities (and therefore their Box2D bodies) should be defined externally, not in code.

I'm looking for a program like Code 'N' Web's PhysicsEditor, except that one only handles single body entities, no joints or anything like that. Like PhysicsEditor, the program should be configurable so that I can save the data in whatever format I want to. Does anyone know of any such software?

sentences:
How to centralize stat/feat/equipment related changes in an RPG? I have a game with an RPG system where derived stats, like HP,armor, etc depend on a variety of components: armor, stats and feats. I'm running into an issue where the code to change derived metrics gets spread throughout the game - some is in the inventory module, another in stats module, another in buffs module.

How can I centralize and ensure accuracy of all my stat/equipment related changes to the character?

I thought that I can just create a "mega method" within the character class that would recalculate everything any time I change anything within the formula, but I don't know if this recalculate everything is a good practice, or if there are potential pitfalls with this approach down the road.

One of the complications with the complete rebuild that I see is that I will have to keep track of the player's HP and properly restore it after rebuild is complete.

sentences:
Logic level representation that distinguishes "> and > the bridge" I have an logic level/map representation for a 3D game that uses vector<Area> where:

class Area{
    vector<Point2D> bounding; //determines the shape of the Area, its borders
    //bounding of Area is like borders of country
    //(it's easy to test if something is inside area)

    vector<Obstacle> obstacles; //general type for all static objects inside this Area
    //each Obstacle has boundingBox (center, halfSize, rotation)

    vector<Dynamic> dynamicObjects; //same as obstacles, but the use of separated vector
    //for dynamic objects helps with few things

    Player * player = 0; //like Obstacle, but it has special treatment

    vector<Area*> connectedAreas; //I won't went deeper into how Areas are connected.
    //For simplify, let's assume we are working on one Area.
    //Or that when Player leaves Area, all connectedAreas start a test if he entered
    //one of them (it's not the case, but work fine for purposes of that example).
    ...
};

It's quite simple and very low memory-consuming representation for large areas (grid representation would grow and grow with the size of area). I also find it quite good when it comes to some AI algorithms that my game uses. I don't have too advanced collisions in my game (so I don't need to care about them in the level representation). So generally, I'm happy with that representation.

Still, I have one problem: sometimes some parts of the map have "height-levels" - e.g. bridge: you can be either under the bridge or above it (and you can go above only from certain fragments of map). How can I represent that?

For caves or multi-floor buildings I can just use vector<Area> instead of single Area/Area's fragment. That vector<Area> could hold separated Area for each floor.

But when the mesh has kind of "smooth" transitions between levels (bridges, some parts of mountains and any non-separable fragments of map) - it doesn't looks like good solution anymore.

For example, here player is able to go either under the tree or above the trunk:

P.s. I am not asking for the graphic representation. I've separated the game logic and graphic engine as much as possible. The 3D engine uses triangles of course, with much more details then game logic need or want (less data => faster processing).

sentences:
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:
How does Blizzard manage to support Mac OS and Windows in their games? I've always thought that using Direct X for Windows was the most powerful, easy and modern method to create games with modern graphics, nowadays. Knowing that it's only Windows, I thinks it's pretty difficult to make something similar on other platforms; Mac OS, to be exact. However, Blizzard somehow managed to deliver Starcraft 2 for Mac OS, and Diablo 3 will be available for Mac, too.

So what I'm interested in is information about:

what technologies are they using for their game engines?
are they using one engine for both games (Starcraft 2 and Diablo 3), or do they develop custom engines for each game?
what are they paying, in terms of time and money, for Mac OS support?

sentences: How to create a looping or spherical world? I wish to create a 3D first person world, in which the player, once they reach one end of the map are unknowingly transported back to the opposite end, or a spherical world with a surface where the player can walk on while still experiencing gravity like normal. Unfortunately I couldn't find a good solution for doing that in either unity or ue. Any ideas would be appreciated.

sentences:
Morph a sphere to a cube and a cube to a sphere with GLSL I'm getting started with GLSL with quartz composer.
I have a patch with a particle system in which each particle is mapped into a sphere with a blend value. With blend=0 particles are in random positions, blend=1 particles are in the sphere. The code is here:

vec3 sphere(vec2 domain)
{
    vec3 range;
    range.x = radius * cos(domain.y) * sin(domain.x);
    range.y = radius * sin(domain.y) * sin(domain.x);
    range.z = radius * cos(domain.x);
    return range;
}

// in main:

vec2 p0 = gl_Vertex.xy * twopi;
vec3 normal = sphere(p0);;
vec3 r0 = radius * normal;
vec3 vertex = r0;

normal = normal * blend + gl_Normal * (1.0 - blend);
vertex = vertex * blend + gl_Vertex.xyz * (1.0 - blend);

I'd like the particle to be on a cube if blend=0

I've tried to find but I can't figure out some parametric equation for the cube.
Maybe it is not the right way?

sentences:
Background Sprite Setting For my 2d game, I want to set background image. So that I am using multiple background images for that purpose.

But it can't set correctly on screen that illustrated in following image.

Also for setting background correctly, I am calculating camera orthographic size based current resolution and loading that sprite dynamically.

My camera inspector setting illustrated in following image.

My basic target is to display my background image in full screen without any bar. For example, If I have resolution of 600x1024 resolution and I am loading same resolution image then it should be display in full screen.

But you see that I can't able to get this result. So please some one help me to come out of this. If you want any more detail then I will provide at any time.

sentences:
How to prepare a sprite for a game? For example, I created my character drawing on Paint.NET using the Pencil tool and now it's a sprite like asset.

If I want him to move do I need to create many different poses for him and render them according a timer? Or do I need to have each pose side by side in a single image, then render the rectangle I need, thus loading the picture only once?

Thanks.

sentences:
How do I make a fiery particle system? I added a particle system to the flame-emitting object in my Unity scene. But it's just little white balls, and I can't figure out how to make it fiery.

Anyone?

Everything I see on the internet involves buying some asset pack that somebody put together. Does Unity really not have any built in flames stuff?

sentences:
Load single texture atlas for multiple sprite Recently, I am developing sudoku game. For this, I have created multiple grid 9x9,12x12 and 15x15.

For this numbers are repeated so multiple sprite renderer are created and it load same number texture multiple time.

So I want single number loaded single time only no repetition texture occur in graphical memory.

Because of this problem I am facing following problem that I already posted.

Android Device Screen Flicker

I want suggestions to overcome this problem from your side.

sentences:
Direct3D11 and SharpDX - How to pass a model instance's world matrix as an input to a vertex shader Using Direct3D11, I'm trying to pass a matrix into my vertex shader from the instance buffer that is associated with a given model's vertices and I can't seem to construct my InputLayout without throwing an exception.

The shader looks like this:

cbuffer ConstantBuffer : register(b0)
{
    matrix World;
    matrix View;
    matrix Projection;
}

struct VIn
{
    float4 position: POSITION;
    matrix instance: INSTANCE;
    float4 color: COLOR;
};

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(VIn input)
{
    VOut output;
    output.position = mul(input.position, input.instance);
    output.position = mul(output.position, View);
    output.position = mul(output.position, Projection);
    output.color = input.color;
    return output;
}

The input layout looks like this:

var elements = new[]
{
    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
    new InputElement("INSTANCE", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerInstanceData, 1),
    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0)
};
InputLayout = new InputLayout(device, signature, elements);

The buffer initialization looks like this:

public ModelDeviceData(Model model, Device device)
{
    Model = model;
    var vertices = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, model.Vertices);
    var instances = Helpers.CreateBuffer(device, BindFlags.VertexBuffer, Model.Instances.Select(m => m.WorldMatrix).ToArray());
    VerticesBufferBinding = new VertexBufferBinding(vertices, Utilities.SizeOf<ColoredVertex>(), 0);
    InstancesBufferBinding = new VertexBufferBinding(instances, Utilities.SizeOf<Matrix>(), 0);
    IndicesBuffer = Helpers.CreateBuffer(device, BindFlags.IndexBuffer, model.Triangles);
}

The buffer creation helper method looks like this:

public static Buffer CreateBuffer<T>(Device device, BindFlags bindFlags, params T[] items)
    where T : struct
{
    var len = Utilities.SizeOf(items);
    var stream = new DataStream(len, true, true);
    foreach (var item in items)
        stream.Write(item);
    stream.Position = 0;
    var buffer = new Buffer(device, stream, len, ResourceUsage.Default,
        bindFlags, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
    return buffer;
}

The line that instantiates the InputLayout object throws this exception:

*HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.*

Note that the data for each model instance is simply an instance of SharpDX.Matrix.

EDIT

Based on Tordin's answer, it sems like I have to modify my code like so:

var elements = new[]
{
new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0),
new InputElement("INSTANCE0", 0, Format.R32G32B32A32_Float, 0, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE1", 1, Format.R32G32B32A32_Float, 16, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE2", 2, Format.R32G32B32A32_Float, 32, 1, InputClassification.PerInstanceData, 1),
new InputElement("INSTANCE3", 3, Format.R32G32B32A32_Float, 48, 1, InputClassification.PerInstanceData, 1),
};

and in the shader:

struct VIn
{
    float3 position: POSITION;
    float4 color: COLOR;
    matrix instance: INSTANCE;
};

VOut VShader(VIn input)
{
    VOut output;
    output.position = mul(input.position, input.instance);
    output.position = mul(output.position, View);
    output.position = mul(output.position, Projection);
    output.color = input.color;
    return output;
}

However I still get an exception.

sentences:
How 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: What is framerate-independent motion? What is the definition of framerate-independent motion and why is important to have it in games?

sentences:
GLSL - Stretched vertices after translating I'm trying to translate 3D object in my game engine.
I copied all formulas from my old, working game engine, where translation was working.

When I set position and rotation to 0, everything looks to be fine, but when I try to change position of my 3D object, something strange happens.
I'm not sure if it is projection matrix issue, or maybe transform matrix issue.

Position: x = 0, y = 0, z = 0
Rotation: x = 0, y = 0, z = 0

Position: x = 0, y = 0, z = 0
Rotation: x = 0, y = 45.0, z = 0

Position: x = 1.5, y = 0, z = 0
Rotation: x = 0, y = 0, z = 0

Position: x = 3.5, y = 0, z = 0
Rotation: x = 0, y = 0, z = 0

I checked all formulas once again, checked transformation matrix output, projection matrix output, and everything seems to be fine.

Here is my vertex shader:

#version 400

in vec3 position;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

void main(void)
{
  gl_Position = projectionMatrix * viewMatrix * transformationMatrix * vec4(position,1.0);
}

and fragment shader:

#version 400

uniform vec2 textureVec;

layout(location = 0) out vec3 out_Diffuse;
layout(location = 1) out vec3 out_Texture;

void main(void)
{
  out_Diffuse = vec3(0.5, 0.5, 0.5);
  out_Texture = vec3(textureVec, 0.0);
}

Projection matrix formula:

  float aspectRatio = static_cast<float>(windowSize.x) / static_cast<float>(windowSize.y);
  float yScale = static_cast<float>((1.0f / tanf(MathUtil::degToRad(fov / 2.0f))));
  float xScale = yScale / aspectRatio;
  float frustumLen = farPlane - nearPlane;

  projectionMatrix.m00 = xScale;
  projectionMatrix.m11 = yScale;
  projectionMatrix.m22 = -((farPlane + nearPlane) / frustumLen);
  projectionMatrix.m23 = -1.0f;
  projectionMatrix.m32 = -((2.0f * nearPlane * farPlane) / frustumLen);
  projectionMatrix.m33 = 0.0f;

View matrix formula:

  viewMatrix.setIdentity();
  viewMatrix.rotate(Vector3(1.0f, 0.0f, 0.0f), MathUtil::degToRad(transformComponent->rotation.x));
  viewMatrix.rotate(Vector3(0.0f, 1.0f, 0.0f), MathUtil::degToRad(transformComponent->rotation.y));
  viewMatrix.scale(Vector3(1.0f, -1.0f, 1.0f));

  Vector3 negativeCam = Vector3::negate(transformComponent->position);

  viewMatrix.translate(negativeCam);

And transformation matrix formula:

  transformationMatrix.setIdentity();

  transformationMatrix.translate(position);
  transformationMatrix.rotate(Vector3(1.0f, 0.0f, 0.0f), MathUtil::degToRad(rotation.x));
  transformationMatrix.rotate(Vector3(0.0f, 1.0f, 0.0f), MathUtil::degToRad(rotation.y));
  transformationMatrix.rotate(Vector3(0.0f, 0.0f, 1.0f), MathUtil::degToRad(rotation.z));
  transformationMatrix.scale(scale);

Same happens for "y" and "z" position axis, but object "rotates" in different axis.

I also checked my VAO loader, vertices, uniform values loader, and everything else.
If you need more code, let me know.

sentences:
How to prevent players from using save/load tactics in Roguelike games? Players can achieve the expected results through continuous saving and loading in rogue-like games.

I am try to reduce this method as much as possible, but don't want to keep players from trial and error at all, which makes the game more difficult.

Anybody could give me some advice in this respect?

sentences:
Applying Animation to specific parts of a humanoid model I have imported a humanoid character from AutoDesk Character Generator into Unity. Once you specify that you want the character for Unity, a humanoid skeleton in integrated, in order to use MecAnim.

I also have a plug-in that applies the user's motion data to this character and animates it. Because the plug-in is free and open-source, I am trying to apply the motion data to different MecAnim bones, to see if I can do so.

By the way, by "motion data" I am referring to 2 arrays: one that contains positions and one that contains orientations of a number of joints and bones. So, I can access these Vector3 and Quaternion data...

Is it enough to just apply, for example, the left foot's orientations to the right foot, or do I need to also do it with positions, in order to inter-change the animations/motions/movements of these 2 limbs?

This is the method I have written so far:

public void swapLimbsPosRot(Vector3[] positionsArray, Quaternion[] rotationsArray)
{
            Vector3 tempPos = positionsArray[16];
            positionsArray[16] = positionsArray[20];
            positionsArray[20] = tempPos;

            Quaternion tempRot = rotationsArray[16];
            rotationsArray[16] = rotationsArray[20];
            rotationsArray[20] = tempRot;
}

But it doesn't work, because when I apply it to my array of transforms before updating, severe jitters show there is a fighting going on between MecAnim and my motion capture device' incoming motion data, but for now I am just wondering:

If you wanted to swap the animations/movements/motions of 2 similar MecAnim parts, what would you do? What would you swap? How would you go about it?

p.s. Of course, first I tried swapping the mecanim bones (right & left feet) but that turned out silly, as the "actual" feet of my MecAnim character had been swapped!

Some code, showing how the swapping and updating are done now, hoping someone could please help me find the cause of the jitters.

    void Update()
    {
        Vector3[] latestPositions;
        Quaternion[] latestOrientations;

        if (mvnActors.getLatestPose(out latestPositions, out latestOrientations))
        {
                // If this variable is set to true, then do the swapping.
                if (swapLimbs)
                {
                    swapLimbsPosRot(latestOrientations);
                }

                // Update both the pose and the model, using the delayed data.
                updateMvnActor(currentPose, latestPositions, latestOrientations);
                updateModel(currentPose, targetModel);
        }
    }

    /// Swap the rotations of different mimicking limbs; e.g. LeftHand = 16 & RightHand = 20
    public void swapLimbsPosRot(Quaternion[] rotationsArray)
    {
        float tempRotY = rotationsArray[16].y;
        rotationsArray[16].y = rotationsArray[20].y;
        rotationsArray[20].y = tempRotY;

        float tempRotZ = rotationsArray[16].z;
        rotationsArray[16].z = rotationsArray[20].z;
        rotationsArray[20].z = tempRotZ;
    }

The motion data that comes in is always the latest positions and orientations from the device, so Update modify them and then apply them to the character to animate it. So, for example, in my Update, I get the latest pose (i.e. the latest positions and orientations) and then I swap the orientations of left and right hands, but the jitters are severe...

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:
Collision detection enhancement I am developping a spaceinvader-like game. There comes the problem of how to handle collision detection.

At first I was doing like that :

forEach(fireBall : fireBalls) {
    forEach(stormTrooper : stormTroopers) {
        if (collides(fireBall, stormTrooper)) {
             // Explode

But then when playing I had the feeling the game was slowing down at some point, and I tought it had something to do with the multiple elements and the double loop.

So I tried to break the loops whenever I had the chance, changing the forEach loops to for loops at the same time :

for (var i = 0; i < fireBalls.length; i++) {
     if (stormTroopers.length > 0 && fireBalls[i].y > stormTroopers[0].y) {
          break;
     }
     for (var j = 0; j < stormTroopers.length; j++) {
         if (fireBalls[i].y > (stormTroopers[j].y + 31)) {
             break;
         }

If the fireball isn't on the same "y" as any stormtrooper, the fireballs following are not going to be either, so no need to check. Same for the stormtroopers loop.
This works only if the list is ordered, meaning the first stormTrooper of the list has the highest "y" value.

The problem in my game is that all stormTroopers don't have the same speed, so I need to sort the list each time.

This leads to my question : in order to enhance the performance, I tried to break the loops, but for that I had to add a new operation : sort the list of the stormTrooper. Is it worth it?

sentences:
Why would one bind several textures to the same OpenGL texture unit? This OpenGL documentation article says you can bind 4 (=several) textures to texture units 0, 1, etc. This OpenGL documentation article too.
I found in this Stack Overflow answer an example of why it could be useful to use several texture units (each bound to a different texture).
However I do not understand in which case one would need to bind several textures to the same texture unit, and how one could use them then.

sentences:
Why wont the LibGDX's main class Initialize on Android Launcher? So I was searching for different ways that could suit me in programming and came across LibGDX.  Naturally I looked at the tutorial.  As I was doing it, I was following the steps word for word, except naming the classes.  In the end, I was able to create the desktop launcher for the game but not the android launcher.

The following error is my error: Cannot instantiate the type Game
(Game is the name of the class)

I got the tutorial from
http://steigert.blogspot.com.au/2012/02/1-libgdx-tutorial-introduction.html
The link in the tutorial is the original but it uses jogl instead of lwjgl.

sentences:
Fixed vs Fixed Collision on ImpactJS I'm trying to implement a collision on ImpactJS entities that both will be stopped when collided and being pushed.

This will be exactly similar to player to player collision on top down games such as Battle City where you can't push the other player and vice versa.

All collision type combination does not seem to work on this case. It still pushes the other and FIXED vs FIXED is being ignored.

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:
Building triangle adjacency data Given a list of triangle indices, how exactly does one go about converting that to a list of indices with adjacency for a geometry shader?

Note that we're strictly talking about indices here - vertices are present, but we're going to focus solely on indices, because we can use them to match duplicate vertices without having to get into floating-point comparisons and epsilons - that work has already been done.

I know that for any given triangle in the list, indices {0, 1}, {1, 2} and {2, 0} (or {n, n+1}, {n+1, n+2}, {n+2, n} if you prefer) of it form it's edges; the index list is well-formed and respects winding order correctly.

I know that for any given such edge, we can search the entire list for another triangle that uses two of those indices, and the third index of that triangle is the one to use for completing the adjacent triangle for that edge.

I know that in the adjacency list each original triangle is represented by 6 indices, the original indices go into slots 0, 2, 4; the new indices to complete the adjacency go into slots 1, 3, 5.  The index to complete for edge {0, 1} goes into slot 1, the index to complete for edge {1, 2} goes into slot 3, the index to complete for edge {2, 1} goes into slot 5.

What have I tried?

I've tried brute-forcing it, and yes, that will work, but I'm after a more elegant approach.

I've tried Eric Lengyel's edge list builder, but (1) it doesn't seem to respect the original triangle order, (2) it doesn't seem to respect winding order, (3) it's as clear as mud where to go next after you've built the edge list, and (4) I've a suspicion of sample code that has such obvious glaring errors as "triangleIndex" versus "faceIndex" - did the author even compile the code, never mind run it to verify it?

So -- any suggestions or pointers from here on?

sentences:
SpriteBatch.Draw has Padding on Monogame.Android I am using Monogame to create a small Android game.
I am trying to draw a sprite to the Android screen but it seems to have a padding of some pixels. The same game works fine on desktop.

How can I remove the padding?
The graphic itself has no borders etc; the problem is also reproducible with any other sprite.

I have created a new project in VS2019 with the Monogame templates for VS2017 and tried to reproduce this behavior in a new project.

It seems that the problem has something to do with the notch of my emulator.
In an emulator without a notch the problem seems to be non existent.
I found this thread on the Monogame community but it hasn't got any answers.

My source code looks in its simplest form now as follows:

    private Texture2D _texture;

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        _texture = Content.Load<Texture2D>("BasicTV");
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();

        spriteBatch.Draw(_texture, Vector2.Zero, Color.White);

        spriteBatch.End();
        base.Draw(gameTime);
    }

The result of this code is this:

The Game is compiled for Android 8.1 and I use the Monogame framework 3.7.1.

sentences:
Frustum Culling: How to calculate if an angle is between another two angles I am trying to implement frustum culling but got stuck on how to determine if the angle that the object is from the player is in the FOV of the player. So basically I have the following information:

FOV
Player's 3D position (x1, y1, z1)
Object's 3D position (x2, y2, z2)
Player's turning angle with turning left being positive and right negative

How do I determine if the player should be rendered (in the player's field of view) or not?

I tried using this, but it will cull at certain player turn angle and not work in other player turn angle. Ex, work at 0 - 90, but doesn't work at 90 - 180.

    float turn = player.getTurn();
    float FOV = this.FOV;
    if (square(entity.getPosition(), player.getPosition()) < FAR_PLANE / 6) {
        double playerz = player.getPosition().z * -1;
        double playerx = player.getPosition().x;
        double entityz = entity.getPosition().z * -1;
        double entityx = entity.getPosition().x;
        double degrees = Math.toDegrees(Math.atan((playerz - entityz)
                / (playerx - entityx)));
        double sinfz = Math.asin((playerz - entityz)
                / square(player.getPosition(), entity.getPosition()));
        double cosfx = Math.acos((playerx - entityx)
                / square(player.getPosition(), entity.getPosition()));
        /*
         * if(sinfz > 0 && cosfx > 0) degrees = degrees; else
         */
        if ((entityz - playerz) > 0 && (entityx - playerx) < 0)
            degrees = 180 - Math.abs(degrees);
        else if ((entityz - playerz) < 0 && (entityx - playerx) < 0)
            degrees = Math.abs(degrees) + 180;
        else if ((entityz - playerz) < 0 && (entityx - playerx) > 0)
            degrees = 360 - Math.abs(degrees);
        if(betweenAngle(90 + turn - FOV / 2, (float) degrees, 90 + turn + FOV / 2))
            return true;
    }
    return false;

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 to modify the Unity sprite renderer (or create a custom one) that can display the sprites on the X-Z plane? Prefix: I am NOT trying to rotate a sprite 90 degrees by it's transform, this changes what is up/down and forward/backwards for the object. I need the sprite displayed on the X-Z plane in comparison to the default X-Y plane in it's natural state in the game world with rotation transforms of 0.

I'm trying to use 2D sprites on the X-Z plane, how do I go about either modifying the built in sprite renderer to do this, or creating my own custom sprite renderer component?

sentences:
Aiming direction using mouse I'm using the following code to rotate my object using mouse, for aiming direction. The only problem with this is that it only rotates between 0 to 180 and not full 360 degrees. Can any help me locate the problem?

void Update()
{
  var pos = Camera.main.WorldToScreenPoint(this.gameObject.transform.position);
  var dir = (Input.mousePosition - pos).normalized;
  var angle = (Mathf.Atan2(dir.z, dir.x) * Mathf.Rad2Deg + 270) % 360;
  this.gameObject.transform.rotation = Quaternion.AngleAxis(angle, Vector3.down);

  if (Input.GetMouseButtonDown(0))
  {
    GetComponent<Rigidbody>().AddForce(dir.x * Force, 0, dir.y * Force, ForceMode.Impulse);
}

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:
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:
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:
What is wrong with my smooth shading code? I am having trouble getting smooth lighting to work in Java Monkey Engine.

My terrain is voxel-based, with an iso-surface generated via Marching Cubes over the data field.

Up until now, I have been simply calculating the triangle-face normals, and using only those when creating the mesh for each chunk. This produces the faceted look typical of this approach.

Now, I am iterating over each triangle in the chunk, and adding the triangle-face-normal to each vertex normal in the triangle. Vertices are shared between triangles. As I understand it, this should smooth out the lighting, and reduce the faceted look. I am not seeing these results.

Here is a snippet which illustrates the vertex normal processing:

        for( UUID blockId : chunk.blockIds )
        {
            Block block = BlockStore.getInstance().getBlock( blockId );

            FastTable<Triangle> blockTris = block.getTris();
            if( blockTris == null )
                continue;

            for( Triangle tri : blockTris )
            {
                javax.vecmath.Vector3f triFaceNormal = (javax.vecmath.Vector3f)( tri.norm.clone() );

                tri.getVert0().norm.add( triFaceNormal );
                tri.getVert1().norm.add( triFaceNormal );
                tri.getVert2().norm.add( triFaceNormal );
            }

            for( Triangle tri : blockTris )
            {
                tri.getVert0().norm.normalize();
                tri.getVert1().norm.normalize();
                tri.getVert2().norm.normalize();
            }
        }

Then the blocks/triangles for this chunk are iterated over again, and the component values of all the vertex normals are added sequentially to the "normal buffer", which is fed into the mesh creation.

Here is what the mesh data looks like, using the JME ShowNormals material, which color-codes things according to normal direction. You can clearly see the facets:

And here is the code which builds the chunk mesh, after the buffers have been populated:

        chunkMesh.setBuffer( VertexBuffer.Type.Index, 1, BufferUtils.createIntBuffer( uberIntBuf ) );
        chunkMesh.setBuffer( VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer( uberVertBuf ) );
        chunkMesh.setBuffer( VertexBuffer.Type.TexCoord, 2, BufferUtils.createFloatBuffer( texBuffer ) );
        chunkMesh.setBuffer( VertexBuffer.Type.Normal, 3, BufferUtils.createFloatBuffer( uberVertNormBuf ) );

        TangentBinormalGenerator.generate( chunkMesh );

        chunkMesh.updateBound();

You can see in this screenshot, that the individual triangles do have some blending, indicating that the summation of a vertex's surrounding triangle-face normals, into the vertex normal, is having some effect.

I'm not sure what I am doing wrong.

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:
Should unbind buffers? I'm making some tests with OpenGL ES 2 and got some questions, my current program is like that:

Init
-------
-> create index buffer
-> fill index buffer glBufferData …
-> create vertex buffer
-> fill vertex buffer glBufferData …

Draw
-------
 1. Apply vertex buffer

    -> Bind VAO
       -> bind vertex buffer
          - enable attributs (glVertexPointer, …)
       -> unbind vertex buffer
    -> Unbind VAO
    -> Bind VAO

 3. Apply index buffer
 4. Draw

The problem

The given code crash, after some researches, I've understood why: I need to unbind my index buffer in init part (after "fill index buffer glBufferData") or unbind it before the first "Bind VAO"

My questions are:

Can I put my index buffer in VAO (VAO stock index buffer?)?
Did I have to unbind buffers after each update (glBufferData)?

In my application I've got some buffers who are updated on each frame (Exemple: Particles) so I've got an OpenGL stack like that:

-> bind buffer 1
-> update buffer 1
-> close buffer 1
-> bind buffer 1
-> draw

First 3 lines update the Vertex buffer, the two last draw object, that should be something like that:

-> bind buffer 1
-> update buffer 1
-> draw

Thanks

sentences:
Rectangle touch sides of another rectangle I am making a platformer game and im trying to make the player collide with all the blocks, here's a picture:

The blocks is stored in List and im trying to get the side's of the block usin

static class RectangleHelper
{
    public static bool TouchTopOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Bottom >= r2.Top &&
                r1.Bottom <= r2.Top + (r2.Height / 2) &&
                r1.Right >= r2.Left + r2.Width / 4 &&
                r1.Left <= r2.Right - r2.Width / 4);
    }

    public static bool TouchBottomOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Top >= r2.Bottom &&
                r1.Top <= r2.Bottom + (r2.Height / 2) &&
                r1.Right >= r2.Left + (r2.Width / 4) &&
                r1.Left <= r2.Right - (r2.Width / 4));
    }

    public static bool TouchLeftOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Right <= r2.Right &&
                r1.Right >= r2.Right - r2.Width  &&
                r1.Top <= r2.Bottom - (r2.Width / 4) &&
                r1.Bottom >= r2.Top + (r2.Width / 4));
    }

    public static bool TouchRightOf(this Rectangle r1, Rectangle r2)
    {

        return (r1.Right >= r2.Right &&
               r1.Right <= r2.Right + r2.Width &&
               r1.Top <= r2.Bottom - (r2.Width / 4) &&
               r1.Bottom >= r2.Top + (r2.Width / 4));
    }
}

I got this code from a Youtube video and i changed it a little bit.. (the original code didnt work well)

the problem im having is:
the TouchBottomOf & TouchRightOf functions doesn't work well...(The collision occur randomly, sometimes on top of the block, sometimes little below it (TouchBottomOf), same with TouchRightOf)

Is there a better way to check it?
thanks.

sentences:
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:
How reimport a package in UDK with command line? sometimes ago, I saw a command to re-import a UDK package content without opening the UDK Editor.
(Especially, it was used for reimporting a Flash package in a scaleform tutorial, but it doesn't matter now )

It's very useful, because every time I change my .swf file, I should open the heavy UDK and just press re-import.

So, can anyone give me that solution again  ?

sentences:
terrain not properly rendering I'm extending the terrain quad with resources from various tutorials and have the following code:

public class WorldTerrain extends TerrainQuad {

    public static final String NAME = "terrain";
    public static final int PATCH_SIZE = 9;
    public static final int TOTAL_SIZE = 33;
    private static Vector3f spawnLocation = new Vector3f(13, 3, 16);
    private Material mat_terrain;

    private void loadText(AssetManager assetManager) {
        /**
         * 1. Create terrain material and load four textures into it.
         */
        mat_terrain = new Material(assetManager,
                "Common/MatDefs/Terrain/Terrain.j3md");

        /**
         * 1.1) Add ALPHA map (for red-blue-green coded splat textures)
         */
        mat_terrain.setTexture("Alpha", assetManager.loadTexture(
                "Textures/Terrain/splat/alphamap.png"));

        /**
         * 1.2) Add GRASS texture into the red layer (Tex1).
         */
        Texture grass = assetManager.loadTexture(
                "Textures/Terrain/splat/grass.jpg");
        grass.setWrap(WrapMode.Repeat);
        mat_terrain.setTexture("Tex1", grass);
        mat_terrain.setFloat("Tex1Scale", 64f);

        /**
         * 1.3) Add DIRT texture into the green layer (Tex2)
         */
        Texture dirt = assetManager.loadTexture(
                "Textures/GrassRocky.png");
        dirt.setWrap(WrapMode.Repeat);
        mat_terrain.setTexture("Tex2", dirt);
        mat_terrain.setFloat("Tex2Scale", 32f);

        /**
         * 1.4) Add ROAD texture into the blue layer (Tex3)
         */
        Texture rock = assetManager.loadTexture(
                "Textures/Terrain/splat/road.jpg");
        rock.setWrap(WrapMode.Repeat);
        mat_terrain.setTexture("Tex3", rock);
        mat_terrain.setFloat("Tex3Scale", 128f);
    }

    private static float[] generateHeightMap(AssetManager assetManager) {
        AbstractHeightMap heightmap = null;
        try {
            heightmap = new HillHeightMap(1024, 100, 2, 10, 1);
        } catch (Exception ex) {
            Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
        }
        return heightmap.getHeightMap();
    }

    public static Vector3f getSpawnLocation() {
        return spawnLocation;
    }

    public WorldTerrain(Interface app) {
        super(NAME, PATCH_SIZE, TOTAL_SIZE, generateHeightMap(app.getAssetManager()));
        loadText(app.getAssetManager());
        setMaterial(mat_terrain);

        setModelBound(new BoundingBox());
        setLocalTranslation(32f, 0f, 32f);

        List<Camera> cameras = new ArrayList<Camera>();
        cameras.add(app.getCamera());

        RigidBodyControl landscape = new RigidBodyControl(0.0f);
        addControl(landscape);

and the interface:

public class Interface extends SimpleApplication {

  private TerrainQuad terrain;
  Material mat_terrain;

  public static void main(String[] args) {
    Interface app = new Interface();
    app.start();
  }

  @Override
  public void simpleInitApp() {
    flyCam.setMoveSpeed(50);

    terrain = new WorldTerrain(this);
    rootNode.attachChild(terrain);
  }

This gives the following result:

as you can see large parts of the terrain are not rendering (ignore the weird mountains those are only tests). If I move the camera around these holes move around suggesting it's a rendering problem in the terrain. Anybody who knows how to fix?

sentences:
Why the state of the duration is all the time 7 even if updating the state inside the while in the ienumerator? I want to get the current coroutine state.

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

public class DepthOfField : MonoBehaviour
{
    public UnityEngine.GameObject player;
    public PostProcessingProfile postProcessingProfile;
    public bool dephOfFieldFinished = false;
    public LockSystem playerLockMode;

    private Animator playerAnimator;
    private float clipLength;
    private Coroutine depthOfFieldRoutineRef;
    private DepthOfFieldModel.Settings depthOfField;
    private DepthField state;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent<Animator>();

        AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        DepthOfFieldInit(clipLength);

        state = new DepthField();
    }

    public void DepthOfFieldInit(float duration)
    {
        depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    public IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            state.duration = duration;
            state.focalLength = val;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }

    public struct DepthField
    {
        public float focalLength;
        public float duration;
    }

    public void Save()
    {
        SaveGame.Save("depthoffieldstate", state);
    }

    public void Load()
    {
        Time.timeScale = 1f;
        depthOfField = postProcessingProfile.depthOfField.settings;
        DepthField state = SaveGame.Load<DepthField>("depthoffieldstate");
        depthOfField.focalLength = state.focalLength;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, state.duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }
}

Inside the while loop I'm doing :

state.duration = duration;
state.focalLength = val;

The focalLength value does change if for example I save onethe game start the focalLength value will be 299 and if I will save after the coroutine has finished the focalLength value is 1.

But the coroutine duration value is not changing it keep staying on 7 when saving even if the coroutine has finished and should be 0 it still 7.

The value 7 of the duration is coming from the clipLength.

I can't get the current duration time of the coroutine.
In the Load function I'm starting the coroutine over again but since I'm using the loaded focalLength value and duration value it should look like the coroutine is continue from the last saved point. But I can't get the correct duration value when saving.

sentences:
Who owns content which creation was outsourced? What license or contract type is normally used by independent developers, when outsourcing game resources like graphics or sounds? Is there something like a template floating around? How much ownership of the work can I demand?

I'm alone, so the contract is only between me and another person who's doing graphics, sounds or so on.

sentences:
Objective-C SpriteKit – How to make a circle of buttons I have some code in a project already, but I'd like to change it up a bit. Currently, my code creates an empty node called _buttonLayer and then create some buttons to add to it. My buttons start from the top-left corner of the _buttonLayer and then get added all the way to the bottom-right corner.

// Set up button layer.
_buttonLayer = [SKNode node];
_buttonLayer.position = CGPointMake(_centerOfScreen.x - (_buttonSize.width * 1.5) - 5.0,
                                    self.size.height - ((self.size.height * 0.375) + (_buttonSize.height) - 50.0) + 5.0);
[self addChild:_buttonLayer];

// Set up button array.
_buttonArray = [NSMutableArray array];

// Add some buttons.
for (char row = 0; row < 4; row++) {
    for (char col = 0; col < 4; col++) {

        // Buttons.
        SKSpriteNode *button = [SKSpriteNode spriteNodeWithImageNamed:@"LightGreyButton"];
        button.name = @"LightGreyButton"; // Initially set it to grey, because they all start off that way.
        button.size = _buttonSize;
        button.position = CGPointMake(2.0 + ((button.size.width + 3.0) * col),
                                      -(2.0 + ((button.size.height + 3.0) * row)));
        [_buttonLayer addChild:button];
        [_buttonArray addObject:button];

    }
}

So what I need to do now is create the buttons in a circle – instead of in a square. I'd like to somehow add the buttons into an outline of a circle, and then take the whole _buttonLayer and rotate it. Of course, the way I have it right now, it rotates on the top-left corner of the square. I want the middle of the circle to rotate.

How would I go about doing this?

sentences:
LibGDX FileHandle does not delete file I'm using this line of code to delete a file:

if(Gdx.files.local("/files/ids.json").exists()) {
   Gdx.files.local("/files/ids.json").delete();
}

The same code works for all previous levels except the last one. The file does exist, but the delete() method returns false.

Any help would be greatly appreciated as it has exhausted me. I've seen similar topics in Java but nothing has worked for me. It's really weird that the same code works in some cases.

Edit

Also, in case this provides any information, when I step through the program with the debugger, the delete() returns true.

sentences:
Type of 3D Rotation Animation used in this video http://youtu.be/IUZqinlhono

I have referred to an application for interactive rotation in 3D space. The same is uploaded on youtube for your reference.
I am having difficulty in understanding the rotation of the axis. In the reference app, axis of model moves in bernoulli's lemniscate path. When we swipe horizontal or vertical, it rotates complete 360 degrees
however when the angle of swipe is changed (not exactly parallel to X-axis or Y-axis) model's axis moves in lemniscate path and comes back to starting position.

I am not abel to understand the concept and functioning behind this action. I am really stuck and have tried really hard to understand but failed. I will be obliged if anyone helps me understand this.

http://youtu.be/IUZqinlhono

sentences:
Unity3D: Simple animations ending with a bit of offset I'm trying to make a simple game with some cubes rotating 90º when the user clicks on them.

I've setup an empty game object, a simple cube nested, an animator, and two animations: RotateClockWise, RotateCounterClockwise.

The idea is: User clicks, the nested cube rotates 90 degrees, then comunicates the new translate component to the wrapper and the wrapper updates its transform (I'm doing this so I can have only two animations). So far, so good.

The thing is that I've noticed that, even though the animation is "90º", once I've clicked enough times, a small offset begins to accumulate and ends up, yeah, rotating 90ºm but starting on 20º, so I got a not aligned cube.

The "dirty" trick I've thought is doing a manual round to the closest quarter on each turn, but that seems something I shouldn't be doing, given how advanced is supossed to be this system.

Any idea of what's going on?

EDIT: This is the math on teh "endAnimation()" function that updates the parent object with the rotation of the child:

        float newX = _rootGameObject.transform.rotation.eulerAngles.x + gameObject.transform.localRotation.eulerAngles.x;
        float newY = _rootGameObject.transform.rotation.eulerAngles.y + gameObject.transform.localRotation.eulerAngles.y;
        float newZ = _rootGameObject.transform.rotation.eulerAngles.z + gameObject.transform.localRotation.eulerAngles.z;
        _rootGameObject.transform.rotation = Quaternion.Euler(new Vector3(newX, newY, newZ));

sentences:
My unity game fails to open in my mobile I'm new to Unity, and want to make a android game. I made a very simple scene:

A sphere
A cube (floor)
A simple script that moves the sphere by touch.

I tried it with unity remote and it works fine. But the problem manifests when I build it to test it. When I run it on my mobile, it opens and suddenly gets closed. I don't know what is the actual problem. what should i do?

sentences:
Fighting Game Camera Positioning in SDL I'm working on a 2D fighting game (using SDL) much like the original Killer Instinct on SNES. I want the camera to keep both players an equal distance from the left and right sides of the viewport. When either player moves, the camera adjusts to keep this equal distance and both players in view, except for when both players are at either end of the stage, during which the camera remains still. Here is an example of how the original KI camera works: http://youtu.be/eFgfaP7f7Rs?t=8m22s

I will provide a diagram of what I am trying to achieve.

The red box is the viewport (camera) which slides over the background image file to display the portion of the stage the players are currently in.

Goal: Each frame the player positions are checked and an algorithm is used to calculate the src.x clipping position for the camera. The midpoint, I believe, in addition with the distance between the players can be used to calculate this value. The viewport width and image width are stored in memory and can also be used. If one player moves, the camera moves at the same velocity, and if both are moving in the same direction, the camera should double its velocity to keep up, all whilst keeping both player's distances from the left and right sides in sync.

Currently, I am using integer math for all positions. I specify the clipping width on the image file using configuration files, so for example, my current background is 768 pixels wide and I clip it to 425 pixels wide, which is displayed in the viewport. The fighters have basic acceleration and max velocity. I use a Camera class to logically represent its x value from 0 to the right edge. The camera's x position is subtracted from the player's x position before rendering. Before rendering the background, I add the camera's x value to the clipping x value (src.x).

I have tried many silly things such as using the ratios of the image and clipping widths to get weird x values. I've tried simply using the midpoint and modifying it with whatever I could think of using the distance, but no luck. I do have semi correct movement by setting the camera x position to the midpoint - (image width - clipping width). However this of course does not keep the players at equal distances.

I've been trying to figure this out for a while and it seems so simple, yet the solution continues to elude me (I'm probably exhausted at the moment). It is possible there are some strange architectural decisions in my code that are making this needlessly difficult. If someone could help me figure out an algorithm, that would be all I need. I can provide more information as needed.

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:
What is an efficient method of collision detection for handling lots of objects? In my game, I have plenty of objects that can collide. Literally, most of them can collide with each other. The problem I'm facing is that I can't come up with some good collision detection. How can I resolve collisions for lots of objects in such way that I don't end up with class that has more than 1000 lines of code with enormous conditional constructs like this?

    if (firstBodyUserData == "rocket"
            && secondBodyUserData == "car_body") {
        resolveRocketAndCarBodyCollision(firstBody, secondBody, contactData);
    } else if (firstBodyUserData == "rocket"
            && secondBodyUserData == "gas_tank")
        resolveRocketAndGasTankCollision(firstBody, secondBody, contactData);
    //...many more dumb lines of code for every particular object in my game

And don't forget about all these "resolving methods" after if statements.

To make question more specific, I use Box2D  with its ContactListener and Artemis-odb entity-component-system framework so I don't really have classes for my entities and that kind of exacerbates the problem but main question is in resolving bunch of different types of collisions.

sentences:
How do I convert a panorama image into a skybox? I have two panoramas (1, 2) that are the same but are shaped a little different.

I don't care which one, but how should I go about converting them into a Skybox? I was looking for something like this:

(Image source here.)

How can I do this? I will use an image editing software if I have to.

sentences:
zoom, scale, pan etc in an application and printing I have a C# windows application where I display photos for editing. The displayed
image is scaled to fit the screen. I allow pan, zoom, rotate, crop operations. Once
the editing is done, I would like to print. Now since the displayed image is scaled
before any of these operations, how can I print the photo correctly?

one option is to do the operations on the original image and then scale it and display it.

Is it what is normally done?

sentences:
LibGdx - Move sprite in the direction of other sprite I'm kind new to LibGdx and I'm still learning. I'm working on a small game project to learn this nice framework. However, I'm having some issues with my game. My game is a top down shooter. There is a human character(space marine) that has to shoot an alien, which will be always moving in his direction until it  dies. My code doesn't have any bullets yet.I was able to make the shooter rotate in the direction of the cursor, as well, the alien rotate in the direction of the shooter, but I can't make the alien move in his direction. I'm pretty sure that my method that does that is completely wrong. I've tried a lot to fix it , but I can't get it fixed ! I appreciate your attention guys !
You can find the full code of the main class here:
 https://github.com/Igor-Lopes/LibGdx/blob/master/Splash.java#L125

public void moveAlien() {
    float mX = 0;
    float mY = 0;
    int velocity = 50;
    vAlien = new Vector2(-1 * (float) Math.sin(Alienbody.getAngle()) * velocity,
            (float) Math.cos(Alienbody.getAngle() * velocity));

    mX = (float) Math.cos(Math.toRadians(spacemarine.getRotation()));
    mY = (float) Math.sin(Math.toRadians(spacemarine.getRotation()));

    vAlien.x = mX;
    vAlien.y = mY;
    if (vAlien.len() > 0) {
        vAlien = vAlien.nor();
    }
    vAlien.x = vAlien.x * velocity;
    vAlien.y = vAlien.y * velocity;
    vAlien.x += vAlien.x * Gdx.graphics.getDeltaTime();
    vAlien.y += vAlien.x * Gdx.graphics.getDeltaTime();
}

public float rotateMarine() {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = Gdx.input.getX();
    mouseY = 677 - Gdx.input.getY();
    angle = (float) Math.toDegrees(Math.atan2(mouseX - spacemarine.getX(),
            mouseY - spacemarine.getY()));
    if (angle < 0)
        angle += 360;
    spacemarine.setRotation(angle * -1);
    return angle;
}

public float rotateAlien(Sprite s, float posX, float posY) {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = posX;
    mouseY = posY;
    angle = (float) Math.toDegrees(Math.atan2(mouseX - s.getX(), mouseY - s.getY()));
    if (angle < 0)
        angle += 360;
    s.setRotation(angle * -1);
    return angle;
}

@Override
public void render(float delta) {
    float angle;
    moveAlien();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    angle = rotateMarine();
    rotateAlien(alien, spacemarine.getX(),
            spacemarine.getY());
    if (Gdx.input.isKeyPressed(Input.Keys.W) == true
            && spacemarine.getY() < 560) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() + 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.S) == true
            && spacemarine.getY() > 0) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() - 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.D) == true
            && spacemarine.getX() < 920) {
        Marinebody.setTransform(spacemarine.getX() + 4, spacemarine.getY(),
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.A) == true
            & spacemarine.getX() > 8) {
        Marinebody.setTransform(spacemarine.getX() - 4, spacemarine.getY(),
                angle);
    }
    alien.setPosition(Alienbody.getPosition().x, Alienbody.getPosition().y);
    spacemarine.setPosition(Marinebody.getPosition().x, Marinebody.getPosition().y);
    batch.begin();
    spacemarine.draw(batch);
    alien.draw(batch);
    batch.end();
    // stage.act();
    // stage.draw();
}

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:
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:
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:
LibGDX - SpriteBatch's .draw() method requiring float[] Please excuse my lack of knowledge with LibGDX, as I have just started learning it.
I am going through some simple tutorials, and in one of them, I draw a string onto the screen like so:

// the following code is in the main file in the core project folder:

// this is in the create() method:
private SpriteBatch batch;
batch = new SpriteBatch();

// this is in the render() method:
batch.draw(batch, "Hello world", 200, 200);

I am getting an error saying: The method draw(texture, float[], int, int) in the type SpriteBatch is not applicable for the arguments (SpriteBatch, int, int)

So, LibGDX wants a float array to draw instead of a string?

Thanks in advance.

sentences:
Designing MMORPG with secret quests that can remain secret for a while First of all, I know how difficult it is to design and build MMORPG game. I do not plan to do it anytime soon, this is more of an exercise to stretch my design muscles. Just a thought experiment exploring how this game mechanic could be implemented. It's not about why it's good/bad idea or why it can't work, but about how to go about implementing it.

Imagine your run of the mill MMO a'la WoW. They have a ton of quests and even more guides on how to find them, how to finish them, what's the loot and all the stuff. I would like to introduce secret quests that function pretty much in same way as normal quests do, with the exception that you can't see them highlighted in any way and you need to do specific action/talk to specific NPC at specific place/time or something along those lines to to trigger them. Let's forgo for a moment if this is good idea from gameplay point of view, I am more interested in knowing if it is possible to keep them secret so that first few people who find them won't run to internet and tell everybody and their grandpa and ruin the experience for everybody else.

I came up with only two solutions so far and neither is good or feasible.

First, the bad one, is to randomly disable/enable them so even if somebody hears about them, they won't be likely to find it doing same steps. This has a huge downside of frustrating players and doesn't really fulfil secret-ness requirement.

Second, complicated one. Generate tons of one-time quests  (or limit how many people can get it to some very small number (dozens, perhaps)), with reasonably random triggers. This has boatload of difficulties (making sure they are interesting, completable, and rewards are intriguing) and probably impossible to do in a way that wouldn't look broken very quickly. On the other hand, it would do exactly what I want it to do.

I have my experience with designing games, so I have an idea about how things work, what players want and what makes them come back and have fun. The idea might be bad from this point of view, but I find it very intriguing and worth investigating bit further. What I am looking for is some out of the box ideas how to deliver sense of great reward when finding such secret quest but not make it frustrating to people that don't find them

sentences:
Textures do not render on ATI graphics cards? I'm rendering textured quads to an orthographic view in XNA through hardware instancing. On Nvidia graphics cards, this all works, tested on 3 machines. On ATI cards, it doesn't work at all, tested on 2 machines.

How come? Culling perhaps?

My orthographic view is set up like this:

Matrix projection = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, -graphicsDevice.Viewport.Height, 0, 0, 1);

And my elements are rendered with the Z-coordinate 0.

Edit:

I just figured out something weird.

If I do not call this spritebatch code above doing my textured quad rendering code, then it won't work on Nvidia cards either. Could that be due to culling information or something like that?

        Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
        ...
        spriteBatch.End();

Edit 2:

Here's the full code for my instancing call.

    public void DrawTextures()
    {

        Batch.Instance.SpriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, textureEffect);
        while (texturesToDraw.Count > 0)
        {
            TextureJob texture = texturesToDraw.Dequeue();
            spriteBatch.Draw(texture.Texture, texture.DestinationRectangle, texture.TintingColor);
        }
        spriteBatch.End();

#if !NOTEXTUREINSTANCING
        // no work to do
        if (positionInBufferTextured > 0)
        {

            device.BlendState = BlendState.Opaque;

            textureEffect.CurrentTechnique = textureEffect.Techniques["Technique1"];
            textureEffect.Parameters["Texture"].SetValue(darkTexture);
            textureEffect.CurrentTechnique.Passes[0].Apply();

            if ((textureInstanceBuffer == null) ||
                (positionInBufferTextured > textureInstanceBuffer.VertexCount))
            {
                if (textureInstanceBuffer != null)
                    textureInstanceBuffer.Dispose();

                textureInstanceBuffer = new DynamicVertexBuffer(device, texturedInstanceVertexDeclaration, positionInBufferTextured, BufferUsage.WriteOnly);
            }

            if (positionInBufferTextured > 0)
            {
                textureInstanceBuffer.SetData(texturedInstances, 0, positionInBufferTextured, SetDataOptions.Discard);
            }

            device.Indices = textureIndexBuffer;
            device.SetVertexBuffers(textureGeometryBuffer, new VertexBufferBinding(textureInstanceBuffer, 0, 1));

            device.DrawInstancedPrimitives(PrimitiveType.TriangleStrip, 0, 0, textureGeometryBuffer.VertexCount, 0, 2, positionInBufferTextured);

            // now that we've drawn, it's ok to reset positionInBuffer back to zero,
            // and write over any vertices that may have been set previously.
            positionInBufferTextured = 0;

        }
#endif
    }

sentences: Using UDP vs Websockets I am running a Unity Game on a PC (for development purposes) and then on an Android phone (for production). I need to send data to the Game continuously from a WiFi enabled microcontroller (Esp32). Is it better for me to use UDP or Websockets for data transfer? What are the pros and cons of each method? In this scenario, the game device will act as a mobile hotspot while the esp32 will connect to this hotspot.

sentences:
How to create a regular grid of triangles correctly? I am trying to create an terrain using opentk/opengl.

I have a problem with the VBO/IBO.
I think a picture of the problem is the best way to show it:

I dont understand why the last triangle of a row connects to the first vertices of the row.

Here is the code:

int mapSize = 7;
    void CreateVertexBuffer()
    {
        Vector3[] vertices = new Vector3[(mapSize + 1) * (mapSize + 1)];
        short[] indices = new short[ ((mapSize)*(mapSize)) * 6];

        for (int x = 0; x < mapSize + 1 ; x++)
        {
            for (int y = 0; y < mapSize + 1 ; y++)
            {
                int li_offset = x * (mapSize + 1) + y;
                vertices[li_offset] = new Vector3(x / 4.0f, 0 , y / 4.0f);
            }
        }
        int index = 0;
        for (int x = 0; x < mapSize ; x++)
        {
            for (int y = 0; y < mapSize ; y++)
            {
                indices[index + 0] = (short)( x * (mapSize + 1) + y);
                indices[index + 1] = (short)(indices[index + 0] + mapSize + 2);
                indices[index + 2] = (short)(indices[index + 0] + mapSize + 1);

                indices[index + 3] = (short)(indices[index + 0]);
                indices[index + 4] = (short)(indices[index + 0] + 1);
                indices[index + 5] = (short)(indices[index + 0] + 2);

                index += 6;
            }
        }
        GL.GenBuffers(1, out vbo);
        GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
        GL.BufferData<Vector3>(BufferTarget.ArrayBuffer,
                               new IntPtr(vertices.Length * Vector3.SizeInBytes),
                               vertices, BufferUsageHint.StaticDraw);
        GL.GenBuffers(1, out ibo);
        GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo);
        GL.BufferData<short>(BufferTarget.ElementArrayBuffer,
                               new IntPtr(indices.Length * sizeof(short) ),
                               indices, BufferUsageHint.StaticDraw);
    }

How can I make the last row of triangles properly formed like all the others?

sentences:
How to share Lua script between instances? I'm doing an agent based framework with C++ and Lua. I want to use Lua to code the Agent behaviour having an AgentClass class that have the name and source code and an AgentInstance class that have the lua_State. I want to have a few AgentClass instances during execution but hundreds or thousands of AgentInstance objects.

Is there any way to share the same lua script with different lua_State? Or Is there a better way to get hundreds of agents without too much performance penalty?

¿Options?:

Having compiled Lua code in AgentClass.
Having lua_State only on AgentClass, setting a self variable in every AgentInstance update.
Other.

sentences:
How can I expose material parameters in the Unreal level editor? Is there a way to expose material parameters in Unreal 4 so that they are accessible from the level editor?

As far as I know, I can only do this through the Material Editor, but I wish to do it more fluently.

E.g. to edit a color for the currently selected object in a level:

sentences:
Game loops using Hard realtime systems vs Soft realtime systems I have read the article here about realtime systems and am looking for examples specific to game loops.

Am I correct in saying:

Hard realtime systems will lag and slow down gameplay causing slow motion if processing of AI, collision detection, or user input is delayed past the rendering deadline set by the realtime system. Example, must render every 1/30 sec but processing caused delay to 1/20 sec.

Soft realtime systems will render at 30 FPS regardless of the other subsystems processing but if there is a delay in AI, collision detection, or user inputs, the game will be presented in stop motion instead of slow motion every 1/30 sec.

sentences:
Unity - How to set IK position of Left Hand with an offset? I have a character holding a stick with left hand. I am using IK to make the stick hit a target position. When I position left hand at target position, it works fine. But, I need to offset the hand such that the end of the stick hits the target position. For this, I have put an empty game object as a child at the end of the stick, and offset it like in the code below, but the hand just keeps jittering like crazy. I know it is quite possible to do, but somehow I seem to be missing something. Please help me!
[SerializeField] private GameObject target;
 private Vector3 leftHandPosition;
 private Vector3 hitChildPosition;

 private void OnAnimatorIK(int layerIndex)
 {
         Vector3 t = target.transform.position - (hitChildPosition - leftHandPosition);
         animator.SetIKPosition(AvatarIKGoal.LeftHand, t);
         animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
 }

 private void LateUpdate()
 {
         hitChildPosition = BatHit.transform.position;
         leftHandPosition = animator.GetBoneTransform(HumanBodyBones.LeftHand).position;
 }

Here's an image to visualise what I'm trying to solve -

sentences:
Unet, client is unable to control spawned units I am trying to create a simple table top game with Unet. Right now I am just trying to get simple spawn mechanics working. The issue I am having is that the host computer can spawn and control objects correctly. The object gets instantiated, it gets added as a child to the armylist gameObject correctly. The client is able to see the object move around. Etc. Everything is working correctly it appears from the host side.

The client however, can only instantiate a game object then they lose all reference to it. Also when it gets instantiated it does not become a child of the correct object, it is just its own object in the scene without a parent. The host computer can see the object be spawned.

I am not sure what I am doing wrong, I have tried reading the documentation but to no avail. Any help would be greatly appreciated.

public class PlayerManager : NetworkBehaviour {

[SerializeField]
GameObject tank;
[SerializeField]
Camera PlayerCamera;

[SerializeField]
GameObject[] ArmyList = new GameObject[50];

private Vector3 placePos;
GameObject currentUnit;

void Start () {

}

void Update () {
    if (Input.GetKeyDown (KeyCode.A)) {
        Cmd_place_initial_units ();
    }
    Rpc_PlaceUnit ();
}

[Command]
void Cmd_place_initial_units(){
    currentUnit = Instantiate(tank, placePos, Quaternion.identity) as GameObject;
    currentUnit.transform.parent = transform.GetChild(0);
    ArmyList [0] = transform.GetChild (0).GetChild (0).gameObject;
    NetworkServer.SpawnWithClientAuthority (currentUnit, connectionToClient);
}

void Rpc_PlaceUnit(){
    if (ArmyList[0] != null) {
        RaycastHit hit;
        if (Physics.Raycast (PlayerCamera.ScreenPointToRay (Input.mousePosition), out hit)) {
            if (ArmyList[0].tag == "ground") {
                placePos = new Vector3 (hit.point.x, 1f, hit.point.z);
            } else {
                placePos = new Vector3 (hit.point.x, 1.2f, hit.point.z);
            }
            ArmyList[0] .transform.position = placePos;
        }
    }
}
}

sentences:
How to pick a 3D object with known mouse coordinates if the camera is rotated 60 degrees? I am making a simple game engine for a simple RTS game and would like to be able to pick a cube and move it around with the mouse coordinates. The problem is that my camera is rotated 60 degrees just like any RTS game and I am not sure how to use gluUnProject..

Thanks in advance!!

sentences:
How to Properly Type My Curve's Formula I'm creating an RPG game (using C# in Unity API) that uses a leveling system. I went to the Desomos Online Graphing Calculator and created the following curve representing the levels based on experience: https://www.desmos.com/calculator/bsvkba4qg1. Note that the Y-intercept is at approximately (0, 1).

My Character class has the following fields representing the experience curve from above:

public float experience { get; set; }

public int level {
    get
    {
        float level = experience / 120;
        level += 1.123f;
        level = Mathf.Log(level);
        level *= 20;
        return Mathf.FloorToInt(level);
    }
}

However, when the game begins and experience defaults to 0 as floats do, level returns 2. When experience is 100, level returns 13. Clearly there is some error on my part. Have I entered my formula wrong? If so, how can I fix it, and if not, what else might be the problem?

sentences:
Does indexing arrays with temporary objects leak memory? For example, if I have something like this:

Array = {}
RemoteEvent.OnServerEvent:Connect(function(Player)
    local Part = Instance.new("Part", workspace)
    Array[Part] = Player.UserId
    wait(10)
    Part:Destroy()
end)

Will that leak memory? Will it automatically remove the index for that part once it detects that it's been removed? Or do I need to manually set it to nil when removing it?

sentences:
NullReferenceException when accessing variables in a 2D array in Unity I have made a class including variables in Monodevelop which is:

public class GridInfo : MonoBehaviour {

    public float initPosX;
    public float initPosY;
    public bool inUse;
    public int f;
    public int g;
    public int h;
    public GridInfo parent;
    public int  y,x;
}

Now I am using its class variable in another class, Map.cs which is:

public class Map : MonoBehaviour {

    public static GridInfo[,] Tile = new GridInfo[17, 23];

    void Start() {

        Tile[0,0].initPosX = initPosX;  //Line 49
    }
}

I am not getting any error on runtime, but when I play in unity it is giving me error

NullReferenceException: Object reference not set to an instance of an object
Map.Start () (at Assets/Scripts/Map.cs:49)

I am not inserting this script in any gameobject, as Map.cs will make a GridInfo type array, I have also tried using variables using GetComponent, where is the problem ?

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:
Platform jumping problems with AABB collisions See the diagram first:

When my AABB physics engine resolves an intersection, it does so by finding the axis where the penetration is smaller, then "push out" the entity on that axis.

Considering the "jumping moving left" example:

If velocityX is bigger than velocityY, AABB pushes the entity out on the Y axis, effectively stopping the jump (result: the player stops in mid-air).
If velocityX is smaller than velocitY (not shown in diagram), the program works as intended, because AABB pushes the entity out on the X axis.

How can I solve this problem?

Source code:

public void Update()
{
    Position += Velocity;
    Velocity += World.Gravity;

    List<SSSPBody> toCheck = World.SpatialHash.GetNearbyItems(this);

    for (int i = 0; i < toCheck.Count; i++)
    {
        SSSPBody body = toCheck[i];
        body.Test.Color = Color.White;

        if (body != this && body.Static)
        {
            float left = (body.CornerMin.X - CornerMax.X);
            float right = (body.CornerMax.X - CornerMin.X);
            float top = (body.CornerMin.Y - CornerMax.Y);
            float bottom = (body.CornerMax.Y - CornerMin.Y);

            if (SSSPUtils.AABBIsOverlapping(this, body))
            {
                body.Test.Color = Color.Yellow;

                Vector2 overlapVector = SSSPUtils.AABBGetOverlapVector(left, right, top, bottom);

                Position += overlapVector;
            }

            if (SSSPUtils.AABBIsCollidingTop(this, body))
            {
                if ((Position.X >= body.CornerMin.X && Position.X <= body.CornerMax.X) &&
                    (Position.Y + Height/2f == body.Position.Y - body.Height/2f))
                {
                    body.Test.Color = Color.Red;
                    Velocity = new Vector2(Velocity.X, 0);

                }
            }
        }
    }
}

public static bool AABBIsOverlapping(SSSPBody mBody1, SSSPBody mBody2)
{
    if(mBody1.CornerMax.X <= mBody2.CornerMin.X || mBody1.CornerMin.X >= mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y <= mBody2.CornerMin.Y || mBody1.CornerMin.Y >= mBody2.CornerMax.Y)
        return false;

    return true;
}
public static bool AABBIsColliding(SSSPBody mBody1, SSSPBody mBody2)
{
    if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y)
        return false;

    return true;
}
public static bool AABBIsCollidingTop(SSSPBody mBody1, SSSPBody mBody2)
{
    if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y)
        return false;

    if(mBody1.CornerMax.Y == mBody2.CornerMin.Y)
        return true;

    return false;
}
public static Vector2 AABBGetOverlapVector(float mLeft, float mRight, float mTop, float mBottom)
{
    Vector2 result = new Vector2(0, 0);

    if ((mLeft > 0 || mRight < 0) || (mTop > 0 || mBottom < 0))
        return result;

    if (Math.Abs(mLeft) < mRight)
        result.X = mLeft;
    else
        result.X = mRight;

    if (Math.Abs(mTop) < mBottom)
        result.Y = mTop;
    else
        result.Y = mBottom;

    if (Math.Abs(result.X) < Math.Abs(result.Y))
        result.Y = 0;
    else
        result.X = 0;

    return result;
}

sentences:
isometric tile - How would I apply effect on only specific part of a sprite? How would I apply a mask for pixel shading effect to restrict it only to some part of image? For example I have a height tile:

Now I want to apply the effect only on the tile-shape of this height-tile with some sort of masking:

Therefore, how would I restrict the pixel shading function boundary using masking?

sentences:
Reused Avatar moves mesh I have a humanoid avatar and it's animation controller.
I also have two different human meshes, they're quite similar.
When I use the generic avatar and it's controller in the animator the meshes
shot out into the sky and perform their animation correctly.
The animations run normal they just move in weird directions and don't stay in their original locations.
How to fix it so the mesh doesn't move far away and retain original position?

sentences:
Problem with Ogre::Camera lookAt function when target is directly below I am trying to make a class which controls a camera. It's pretty basic right now, it looks like this:

class HoveringCameraController
{
public:

   void init(Ogre::Camera & camera, AnimatedBody & target, Ogre::Real height);
   void update(Ogre::Real time_delta);
private:
   Ogre::Camera * camera_;
   AnimatedBody * target_;
   Ogre::Real height_;
};

HoveringCameraController.cpp

void HoveringCameraController::init(Ogre::Camera & camera, AnimatedBody & target, Ogre::Real height)
{
   camera_ = &camera;
   target_ = &target;
   height_ = height;

   update(0.0);
}

void HoveringCameraController::update(Ogre::Real time_delta)
{
   auto position = target_->getPosition();
   position.y += height_;
   camera_->setPosition(position);
   camera_->lookAt(target_->getPosition());
}

AnimatedBody is just a class that encapsulates an entity, it's animations and a scene node. The getPosition function is simply forwarded to it's scene node.

What I want(for now) is for the camera to simply follow the AnimatedBody overhead at the distance given(the height parameter), and look down at it. It follows the object around, but it doesn't look straight down, it's tilted quite a bit in the positive Z direction. Does anybody have any idea why it would do that?

If I change this line:

position.y += height_;

to this:

position.x += height_;

or this:

position.z += height_;

it does exactly what I would expect. It follows the object from the side or front, and looks directly at it.

sentences:
Unity Javascript GUI.Button shows up twice Hi I have created a simple menu in Unity but I wanted to create my own style for colour/fonts.

However for some reason it prints each button twice to the screen, once with my custom style, and once without.

this is the code I have used:

if(menu){

if (GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2, 100, 30), "Start Game", customGuiStyle)){

Application.LoadLevel ("Level 1");
}

if (GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2 + 30, 100, 30), "Options", customGuiStyle)){

menu = false;
options = true;
}

if (GUI.Button(Rect(Screen.width/2 - 50, Screen.height/2 + 90, 100, 30), "Quit", customGuiStyle)){

Application.Quit();
}
}

I have no idea why it is showing two texts, heres a screen shot of exactly what I mean...

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:
Unity - How to match camera bounds to width While stretching camera bounds, changing width adds black offset while changing height stretches image.
How can I achieve opposite behavior and match the bounds to the width instead of height ?

sentences:
Which will be faster? Switching shaders or ignore that some cases don't need full code? I have two types of 2d objects:

In first case (for about 70% of objects), I need that code in the shader:

float2 texCoord = input.TexCoord + textureCoord.xy

But in the second case I have to use:

float2 texCoord = fmod(input.TexCoord, texCoordM.xy - textureCoord.xy) + textureCoord.xy

I can use second code also for first case, but it will be a little slower (fmod is useless here, input.TexCoord will be always lower than textureCoord.xy - textureCoord.xy for sure).

My question is, which way will be faster:

Making two independent shaders for both types of rectangles, group rectangles by types and switch shaders during rendering.
Make one shader and use some if statement.
Make one shader and ignore that sometimes (70% of cases) I don't need to use fmod.

sentences: SharpDX Texture to Image in C# I currently have an image processing application that outputs processed images post pixel shaders have been applied. However, using the examples I've found on the internet, the colors are flip to BGRA when RGBA is expected. I currently work around this with by post export processing to get the desired RGBA format. I was hoping someone else has dealt with this and has a solution that does not require post processing to correct the format.

sentences:
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:
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:
How to join two cubes? If I want to make a character (in Blender) made of cubes, to export it to unity later, should I leave these cubes and all the other body parts as separate objects, or join them all into one mesh?

And, If I should join them - is it a good idea to leave the cubes elements inside of each other?

Or I should remove them, add some loops and connect the vertexes?

In the last case it will be difficult to keep the cubes surfaces flat, because of the vertex shifting during joining.

sentences:
Frame rate slowing down after publishing XNA game in VB.NET I will get to the main question later but I just want to give the backstory here first.
I program a game in XNA using VB.NET. As I'm testing the game in debug it works at a certain speed (spritemovement, animations etc.). After I publish the game and install it on my other computer (which is newer), the game slows down considerably.
To investigate that problem I used FPS code. It showed 75 on debug and 60 after installed. I have thus programmed the entire game for running at 75. To try to solve that problem I incorporated this:

TargetElapsedTime = TimeSpan.FromSeconds(1.0F / 75.0F)
IsFixedTimeStep = True

Now after trying to publish again the game actually ran smoothly at 75fps on the newer computer, but there was a catch: when I turn to fullscreen the game again slows down. However now without showing the lower fps. So the fps is still showing 75 but the game apparently runs at 60.

I've looked around for answers and find that I can possibly maximize the window (borderless) without making it fullscreen, and could perhaps solve the problem that way. However all the code suggested are in C# and I can't get it to work.

How can I either get a borderless maximized window to work with VB.NET, or in any other way solve my FPS issue?

Thank's for any help on this issue!

sentences: DirectX 9.0c Lights? I'm still learning DirectX from a book. It says that a graphiccards can only handle 15 lights. I'm just a bit confused , there are a lot of games using more lights, or are this just some alpha blending  tricks or what ever?

sentences:
Issues using NetworkServer.Spawn with Unity and Mirror-Networking I am using Mirror to handle the networking aspect

When I spawn an object on the network, I Instantiate it on the server and then use NetworkServer.Spawn to notify all clients to spawn the object.

However, when this object is eventually spawned on the client side, it seems to be spawned at the wrong position for a few seconds and then corrected itself and move to the correct position as is reflected by the server. Is there something I am not doing? Is this normal?

Also I noticed if I changed the Network Sync Mode to 0, then it will only spawn in the wrong spot for a split second.

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

public class EnemySpawner : NetworkBehaviour
{
    public uint theId;
    public int maxNumEnemies;
    public int spawnDelay;
    public GameObject enemyToSpawn;
    float curSpawnTime;
    BoxCollider2D boxColl;
    // Start is called before the first frame update
    public override void OnStartServer()
    {
        curSpawnTime = spawnDelay;
        boxColl = GetComponent<BoxCollider2D>();
    }

    void Start()
    {
        if (!isServer) return;
        theId = netId;
    }

    // Update is called once per frame
    void Update()
    {
        if (!isServer) return;
        if (transform.childCount < maxNumEnemies && curSpawnTime <= 0.0f)
        {
            Vector2 spawnPoint = new Vector2(Random.Range(boxColl.bounds.min.x, boxColl.bounds.max.x),Random.Range(boxColl.bounds.min.y, boxColl.bounds.max.y));
            curSpawnTime = spawnDelay;
            SpawnEnemies(spawnPoint,netId);
        } else
        {
            curSpawnTime -= Time.deltaTime;
        }
    }

    [Server]
    void SpawnEnemies(Vector2 spawnPoint, uint theId)
    {
        GameObject gobj = Instantiate(enemyToSpawn, new Vector2(60.7f,1.3f), Quaternion.identity);
        gobj.GetComponent<EnemyController>().parentNetId = netId;
        NetworkServer.Spawn(gobj);
    }
}

The way I've organized things, in the hierarchy I have:

Enemies
   Area1
      Spider(Clone)
      Spider(Clone)

Area1 has the EnemySpawner script.  The spider is registered a spawnable prefab.
Both Area1 and the Spider have a NetworkIdentity with no boxes checked.
Additionally, the Spider has a NetworkTransform and NetworkAnimator.

sentences:
How to balance spawn system with multiple objects? I'm trying to make a top-down endless runner.

I have divided my screen into 3 columns. Right now I have some objects spawned from the bottom of the screen that go up towards the top. I have 3 different types and each of them has a random speed between 4 and 8 and can be spawned at intervals that vary from 0.2f to 2f.

I've noticed though that it may happen that these objects are spawned in a way that it is impossible for the player to dodge them (all the 3 columns are occupied by these obstacles on the same line).

Is there a way to check if this scenario is going to happen in the next wave and to, for instance, destroy one obstacle out of those. How could this be done?

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: Wrong object is being detected on OnMouseUpAsButton In my 2d game project I have an object A moving above map. Both object and map have colliders (circle collider and polygon collider respectively), as well as actions to be performed on OnMouseUpAsButton. Objects are displayer properly in the game, however, when I click on the object it usually detects map (usually as in sometimes it detects the object if I press in the very centre of the object). How to ensure that my objects of type A are always checked first for MouceUp?

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:
How do I manage multiplayer login? How is the typical login, loading the level and spawning handled?
For example:

Client sends "iwanttologinwithcharacterx"
Server does some validity checks and instantiates characterx
Server sends back "loadlevelx"
Client sends "iaminloadingscreen", when finished sends "finishedloading"
Server sends "spawnyourcharacterx"

OR just after the "iwanttologinwithcharacterx" the server tells the client to handle steps 3, 4, and 5 without interaction?

I'm confused about what would be the ideal approach with the least room for errors.

Some info: The level in which players begin is always the same. Players can have multiple characters and during the game they often switch levels (this would be linked to my first question, how would I handle that cleanly? Don't destroy the playerobject between level load and just change their positions accordingly?)

sentences:
Game architecture for someone with a background in LOB Apps I've got a background that is almost entirely based around business applications - Web services, schedulers, desktop and web front-ends to CRM systems, etc...

Now with almost all of the above projects, the basic principles are the same:

Some sort of data access layer, business logic layer and a UI.

Obviously some scenario require something a little unique but in general it's N-Tier all the way.

I'd like to do some game development as a hobby. I'm not expecting anything impressive as I don't have the resources to dedicate to it, but something to challenge me a bit would be good.

What lessons (if any) should I be taking from my current experience and what do I need to learn again?

I'm assuming that as with all my experience, different types of games will have different architectures but are they all based around the same core principles? For the sake of argument, let's say I'm  building a simple MUD (maybe a top-down UI like the older Zelda games) - This seemed like something that I could have my 3-Tier logic for - A server with the BLL and DAL and a client UI - But I'm not quite sure if this is right - certainly using the Entity Framework doesn't seem appropriate as there's an awful lot of overhead in accessing lots of stuff in the Db and I'd imagine performance will be an issue - eg I'm assuming I wouldn't want to constantly use the Db to store player locations if they're changing 20+ times/second...

Are there patterns and practices specifically for game scenarios?

Is it feasible to develop the back-end system before creating a UI (eg plugging a console app in instead to allow me to develop the functionality I'd like before adding the UI). Is this good/bad practice?

In short, I don't know where to start and would appreciate some advice - especially from those with experience.

About the only thing that's set in stone is that I'd like a multi-user game with a central server. Game suggestions welcome.

[This was originally asked on SO but it was suggested that this would be a better forum. Apologies if this breaks any rules but I don't know how to link across sites. If someone can advise me of the appropriate action, I'll take it. Many thanks]

sentences:
Twitchy sprite movement I'm having an issue with sprite movement, and I'm not sure how to deal with it.

When I set a destination for my player sprite (by clicking the screen), it sets the player moving in that direction. Unfortunately, the player sort of oscillates. He sort of shivers along the path.

I've set up a test project using just graphics primitives (graphics.fillRect(x,y,w,h)), and it's really easy to see. Here's an example:

My code looks like this

public void tick() {

    if (InputHandler.leftClick.heldDown) {
        dest.setLocation(InputHandler.leftClick.xPos, InputHandler.leftClick.yPos);
    }

    direction.setLocation(dest.getX() - position.x, dest.getY() - position.y);
    direction.normalize();
    position.add(direction.multiply(velocity));
}

This is a really really basic movement system because I'm having the same issues elsewhere and I wanted to work on them in a more controlled environment.

The weirdest part about this is that when the player arrives, he still just sits on one point, shivering madly.

Can anyone help?

sentences:
Unity: DontDestroyOnLoad I'm viewing tutorial of Unity. In this tutorial, I see this piece of code:

public class GameControl : MonoBehaviour {
    public static GameControl control;

    public void Awake() {
        if (control == null) {
            DontDestroyOnLoad(gameObject);
            control = this;
        } else if (control != this) {
            Destroy(gameObject);
        }
    }
}

I don't understand above code very much. I just understand the first if. it means: when we first use this class, we will initialize control object and set attribute dontdestroyonload for this. But I don't understand second if, when will it meet condition control != this ?

Thanks :)

sentences:
Formula for converting ratio of current device to target device I am designing my (Android/OpenGL ES 2.0) app on one device and want it to run all all other devices while keeping the screen ratio of the development device (so the image doesn't stretch / squash), by altering the GLViewport ratio of the current device to match the development device, thus having either pillarboxing or letterboxing.

The only values I know for sure, are the physical screen ratio of the development device (in landscape) and the current device (regardless of orientation).

Please refer to my other question (which was regarding centering the viewport once I'd set it's size here: Centering GLViewport position within physical screen ) - on further study I see that my maths is somewhat incorrect (maybe too simplistic?) and the  viewport doesn't seem to be getting sized correctly on all targets.

Is there a 'formula' for doing what I'm trying to do?

I get my ratio by doing the following:

float ratio = width / height;

Then I simply want to set my viewport like so:

GLES20.glViewport(0+offsetX, 0-offsetY, widthToUse, heightToUse);

The offsetX and Y values I think I'm OK with as per my previous Q.  It's the 'widthToUse' and 'HeightToUse' that I can't seem to work out properly.

You can see from my other question, that I'm working out the 'widthToUse' value my multiplying the current device's height by the [development devices] ratio.  However, this doesn't work on all devices as the resulting figure could actually be larger (wider) than the physical screen.

Here are some examples of what I'm trying to achieve, for illustration (ratio's much exaggerated here)

In the pics, the black outter-box is the physical screen of the devices and the blue square is the viewport.

Side note: I realise that my game will most likely be locked to a particular orientation (the one I'm currently developing will, eventually be locked to landscape mode) so I probably don't need to handle orientation changes, however, I would like to know, if possible, how to display at a particular ratio in either orientation in case this is required in the future.  So in other words, I may develop an app for landscape, but 'allow' it to run in portrait (albeit with large letterboxing).

Also I know there are similar questions on here, but I've read them over and over and they either don't apply to my situation (or way of doing things), or I'm otherwise not able to get my answer from them.

sentences:
How to add a sound that an enemy AI can hear? Given:

a 2D top down game
Tiles are stored just in a 2D array
Every tile has a property - dampen (so bricks might be -50db, air might be -1)

From this I want to add it so a sound is generated at point x1, y1 and it "ripples out". The image below kind of outlines it better. Obviously the end goal is that the AI enemy can "hear" the sound - but if a wall is blocking it, the sound doesn't travel as far.

Red is the wall, which has a dampen of 50db.

I think in the 3rd game tick I am confusing my maths.

What would be the best way of implementing this?

sentences:
How do I set up a depth buffer in SharpDX? I draw some instanced cubes, but when i rotate the camera (or the world) some cubes that should be behind other cubes are drawn before the cubes.

I already had this issue a long time before and i remembered that is was because the depth buffer.

I don't know how to set up a depth buffer in SharpDX.

My current trial:

DepthStencilView depthStencilView;

Init

var zBufferTextureDescription = new Texture2DDescription
        {
            Format = Format.D16_UNorm,
            ArraySize = 1,
            MipLevels = 1,
            Width = this.RenderWindow.ClientSize.Width,
            Height = this.RenderWindow.ClientSize.Height,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
            BindFlags = BindFlags.DepthStencil,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.None
        };
using (var zBufferTexture = new Texture2D(Device, zBufferTextureDescription))
  depthStencilView = new DepthStencilView(Device, zBufferTexture);

DeviceContext.OutputMerger.SetTargets(depthStencilView, RenderTargetView);

Draw

//ClearRenderTargetView
DeviceContext.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1f, 0);
//DrawInstanced(...);

My question: what steps do i have to do, to set up a depth buffer correctly?

(I don't use SharpDX.Toolkit)

sentences: LibBDX create a tail when the object is moved I am looking for a way to implement in my game a kind of shadow/tail which will be displayed after the object is moved. Should I use animation? If yes how? Here an example:

sentences:
Framerate is affecting speed of object I'm experimenting with building a game engine from scratch in Java, and I have a couple questions. My main game loop looks like this:

        int FPS = 60;
        while(isRunning){
            /* Current time, before frame update */
            long time = System.currentTimeMillis();
            update();
            draw();
            /* How long each frame should last - time it took for one frame */
            long delay = (1000 / FPS) - (System.currentTimeMillis() - time);
            if(delay > 0){
                try{
                    Thread.sleep(delay);
                }catch(Exception e){};
            }
        }

As you can see, I've set the framerate at 60FPS, which is used in the delay calculation. The delay makes sure that each frame takes the same amount of time before rendering the next. In my update() function I do x++ which increases the horizontal value of a graphics object I draw with the following:

bbg.drawOval(x,40,20,20);

What confuses me is the speed. when I set FPS to 150, the rendered circle goes across the speed really fast, while setting the FPS to 30 moves across the screen at half the speed. Doesn't framerate just affect the "smoothness" of the rendering and not the speed  of objects being rendered? I think I'm missing a big part, I'd love some clarification.

sentences:
Making an RTS game- how to handle player-created units interacting with each other I'm making an RTS game in Unity with C#. However, the interaction I'm going to have with player-created units interacting with other player-created units is what has me stumped. The player and his opponent can purchase units when they have the resources, and it instantiates them in the game. The main thing is checking whether an opponent's unit is within range to attack. Obviously, you can't have every unit asking every other unit what its position is, or it would get exponentially more CPU-consuming the more units are built, right? I'm trying to figure out how I'm going to go about this.

I figured I could have every unit report its position to a sort of master 'tracker', and then every unit could ask the tracker if any opponents' units have a position within X of their own. How I would actually implement this in Unity, though, I'm not sure about.

Moreover, I'm trying to get my head around Instantiated objects. If every unit is telling its position to the master 'tracker', what does it call itself? And let's say a unit asks the tracker if an enemy is in range and one is, what does the tracker tell it so it can locate the right GameObject and attack it? Sorry if I'm talking about it all wrong, I'm sure there's a simple methodology that exists on how to do it, but I can't think of any. Thank you.

sentences:
Creating jar file for SFS2X is making issue I created a test script to explore Smartfoxserver 2X(SFS 2X). In Eclipse I created 2 classes for math Handler with the SFS plugin. and I export the project as a .jar file. Then I place the jar file in this path \SmartFoxServer_2X\SFS2X\extensions\myExt, then started the server. The server is getting close, It's not working. I checked a lot of tutorials all are using the same method. I don't know what was the issue. If anyone knows please help.
Class 1:
package com.smartFoxServerPracticeOne;
import com.smartfoxserver.v2.extensions.SFSExtension;

public class GameManagerReq extends SFSExtension {
    @Override
    public void init() {
        // TODO Auto-generated method stub
        this.addRequestHandler("math", MathHandler.class);
    }
}

Class 2:
package com.smartFoxServerPracticeOne;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.entities.data.SFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;

public class MathHandler extends BaseClientRequestHandler {

    @Override
    public void handleClientRequest(User player, ISFSObject params) {
        int n1 = params.getInt("n1");
        int n2 = params.getInt("n2");

        ISFSObject rtn = new SFSObject();
        rtn.putInt("sum", n1 + n2);

        GameManagerReq parentEx = (GameManagerReq) getParentExtension();
        parentEx.send("math", rtn, player);
    }
}

sentences:
Should I use OGRE3D or start from scratch with OpenGL for a large, procedural, open world game? This question has probably been asked quite a few times, or something similar to it, but I'd like to get some better information on OGRE, since I felt that any descriptions I found weren't very comprehensive as to what it truly does.

I've been dabbling in OpenGL for a while now, and am currently doing my best to tackle shaders, with varying levels of success. Now the reason I'm learning OpenGL is ultimately to be able to develop a game, of course, but I was wondering if I could get started faster if I began using OGRE instead of programming the graphics engine from scratch.

So I looked into it, but nothing really seemed to inform me what kind of development the engine is actually good for. The game I have in mind will have a large open world, partially using procedural terrain generation, so I'm wondering how feasible is something like that in OGRE? Can it be used effectively to generate vertices in real time? Or am I better off skipping OGRE and building from scratch...

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:
Pre-existing voxel tools/libraries for Java I want to do some development using voxel data as well as rendering it. My interest is more in the project its self, rather then things like working out rendering optimization techniques and working efficiently with large data sets, which I know have been done a billion times by other people.

However, all the existing libraries I can find seem to be for other languages. I have found PolyVox, which seems great, but I'd really much rather use Java for this.

Are there any fleshed out libraries? If not,I'm assuming I'm stuck using LWJGL and building something from scratch. Can anyone recommend some thorough tutorials on the subject?

Thanks so much.

sentences:
Calculation correct position of object after collision (2d) I have a circle, that bounces of walls. The circle is traveling at the speed defined by px/s for x and y. I have collision detection implemented and I use vectors to calculate the new x/y speed (and direction) after the collision. My problem is, that is some cases the circle gets stuck in or is consumed by the wall.

The reason for this is, that when the collision occurs, the circle is actually x pixels inside the wall (as illustrated by the image below) and not just at the "border" of the wall. This occurs because the circle might move multiple pixels on each redraw (tick). The circle doesn't move enough pixels during the next redraw in order to get loose from the wall, thus triggering a new collision. Direction changes again towards the wall leading to a shaking motion of the circle, either finally getting loose of the wall or being consumed by the wall.

The solution for this is to reposition the circle so that it is loose from the wall after the collision has occurred. My problem is, that with my rusty mathematics, I can't figure out how to calculate the correct position of the circle and that's where I need your help.

I also wonder, how exact I need to be with the position, I mean, I know the minimum distance of the middle of the circle to the wall (and thus also know how much the circle has penetrated the wall), let's call this value d. I could of course move the circle d pixels perpendicular to the wall, this might be a close enough approximation of the position, although not 100% accurate. If you guys think this is a good enough solution, is there a way to achieve this with vectors or do I need to calculate the angles and new position "manually" using cos and sin?

Side note: I'm not using SAT for collision detection because I have concave polygons.

sentences:
Draw character silhouette when not visible I have a mesh representing my character. I want to give it a partially transparent greyish silhouette when other objects are blocking it from view of the camera.

I'm using Ogre3D, and GLSL as a shading language, but this is a pretty technology/language agnostic question.

sentences:
Why is my Mesh reference being marked (Clone) after I add a new component? I have a script that creates a quad mesh, saves the mesh as an asset, and assembles a game object based on some parameters. If I add another component to the GameObject after, the mesh is marked "(Clone)".
gif for reference. This all happens in code but results are the same when doing it manually.

-
When I drag the object to the project view to make it a prefab, the Mesh Filter loses it's Mesh reference. It's fine if I manually assign the mesh afterwards but that defeats the purpose of doing it this way.
To be clear, if I don't add this (or any) component, it works fine and can be made into a prefab without issue.

sentences:
Google Cardboard XR Settings Is there a way to access settings for Google XR Cardboard? I've got a project straight from Google Cardboard for Unity with examples. After building it and running on a phone it shows X and Gear icons in corners of the screen. X exits the application, Gear shows some settings. Can I modify these settings?
Loading up the package creates XR Settings scriptable object, which has nothing in it. I think maybe I should extend the class, fill it with custom settings (by some key that will be then recognized by Google XR) and replace instance of generic XR Settings with my custom ones?

sentences:
How to Convert DirectX Texture2D to a DXGI Surface for WPF Rendering? I have an image in my WPF application that uses a D3DImage to render DirectX content. On the DirectX side I render everything to a Texture2D using SharpDX (a C# DirectX wrapper), but I'm not sure how to convert the rendered texture to a D3DImage.

I found the D3DImage.SetBackBuffer(D3DResourceType backBufferType, IntPtr backBuffer) method, but that requires the texture to be a DXGI Surface. Here's the code I'm working with:

// renderTexture is a Texture2D that serves as the renderTarget for the DirectX content
// d3dimg is the D3DImage that WPF uses

d3dimg.Lock()
d3dimg.SetBackBuffer(D3DResourceType.IDirect3DSurface9,
                     renderTexture.QueryInterface<Surface>().NativePointer);
d3dimg.Unlock();

But for some reason, the SetBackBuffer function call throws an exception saying that the "specified cast is not valid," even though I'm not doing any casts here (as far as I can see). What am I doing wrong?

sentences: multiply matrix by vector: what to do if need to change y-up to z-up? I multiply a matrix with a position vector to get a new position, however, now I need to change my matrix from y-up coordinate space to z-up. Changing only the matrix won't work: how to apply the change to the vector (change position vector from y-up to z-up)?

sentences:
Trademarks - a couple of questions I got a couple of questions about game trademarks.

When should I submit a trademark for my game if I see that this is a serious project?
Where do I submit a trademark request? Does it have to be local (In my country)?
What do I need to be ready to submit a trademark request?

Thanks!

sentences:
How do I ignore 1 axis on vector 3 reset to 0,0,0? coding noob 3D artist here. I'm trying to create a scrolling parallax background with 3D objects, I have it set so that when it scrolls off screen, it resets it's position off screen on the opposite side so it repeats. However, If I want to have multiple depths to these background objects, it needs to not reset that objects position in the Z axis, or when it loops once it'll just overlap the other objects. How can I tell it to ignore the Z axis on resets? Here's what I have so far.

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

public class BGSLIDE : MonoBehaviour
{
    public float speed = 2.0f;
    public Transform cube;
    public CC player;

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

    }

    // Update is called once per frame
    void Update()
    {
        cube.position += new Vector3(speed*player.velocity.x, 0, 0);
       if (cube.position.x > 10)
        {
            cube.position = new Vector3(-10,0,0);
        }
       if (cube.position.x < -10)
        {
            cube.position = new Vector3(10,0,0);
        }

    }

}

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:
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:
How can I rotate a cylinder so the top points at specific transform? I have a GameObject (goA) with a LineRenderer that has a single line drawn, on which I'd like to place cylinders so the top of the cylinder points to each end of the straight line that the cylinder sits on, (similar to a cylindrical bead on a straight piece of string, or a Candlestick chart).

The cylinder GameObject (goB) is a child of the goA which the LineRenderer is sat on (goB.transform.parent == goA.transform).

goA is not rotated itself, and the Line drawn could be any angle relative to the GameObject, and it would be a bit of a hassle to refactor so that the Line is always vertical and instead rotate goA, and it seems this should be an easily solvable problem!

I'm attempting to use either LookRotation or LookAt on the cylinder but for whatever reason all permutations I can think of simply are not working.

Thanks for any advice!

sentences: What is the purpose of mesh optimization functions? I remember there is a specific function in Direct3D which optimizes a mesh or a 3D object in some way. What is the purpose of this function? How does it reorganize vertices to make it better?

sentences:
Why is my perspective layer is painted over ortho layer? The entire game takes place in ortho with the exception of the background layer which is drawn on a perspective camera.

Everything seems to be working well except that the background is displaying over the orthographic layer. I've tried fidgeting with the layers, orders and depth of cameras but I'm coming up dry.

Take a look at the pics and you may see what I mean.

sentences:
Create BoundingBoxes on a Model I am trying to create multiple BoundingBoxes on a Model by following this tutorial:

https://electronicmeteor.wordpress.com/2011/10/25/bounding-boxes-for-your-model-meshes/

However, I keep getting this error: Requested range extends past the end of the array. on this line:

part.VertexBuffer.GetData(part.VertexOffset * stride, vertexData, 0, part.NumVertices, stride);

I can't figure out why it is giving me that. I load my model and try to create the boxes like this:

Model model = this.Content.Load<Model>("Cube");
MeshModel box = new MeshModel(model);

Instead of passing a String path of the model, I just pass the Model itself (I changed the constructor to accept Model model).

Any help would be appreciated!

Here's what the debugger says (the vertexStride and VertexBuffer has 24 which is the same size as the vertexData so it should be ok):

sentences:
What is actually done by the deferred rendering pipeline in this context? I have been reading a student's thesis regarding deferred rendering and have stumbled across a piece of his work that I couldn't quite understand.

The thesis; in chapter 1.3 it says:

  Stalker (see Figure 02) for example is using only deferred lighting
  to calculate their light accumulation due to complex lighting conditions in the environment, while the rest of
  the engine still runs in forward rendering

Could someone possibly explain what he means by this? What is the deferred pipeline actually being used for?

sentences:
How can I find the offset rotation and position between two objects in 3D? I have two objects in 3 dimensions, one of them (Child) is attached to the other one (Parent) using the offset between them (XYZ - position and rotation).
Using the Vector3 library, how can I find that Child offsets from the Parent?

Further explanation: let's say we have the parent at position X:0 Y:0 Z:0 with rotations RX:0 RY:0 RZ:0, and there is an attached Child to it with the offset X:10 Y:10 Z:10, RX:90 RY:45 RZ:90 (which is what I want to know). Supposedly, I had the Parent with a different position and rotation, how can I get the offset between it and the Child (which in this case, it should be X:10 Y:10 Z:10, RX:90 RY:45 RZ:90) (in another word, I want the Child position and rotation as the Parent is the center of the map)

I've tried simple math and some other ways on the internet but with no success, since I'm pretty bad at calculating rotations (since vector3 libraries are pretty identical, so as Math libraries, any language should be fine).

sentences:
Help comparing Cocos2d and Unity3d for this project I will not go into details, but I would like to hear your opinions about this:

Essentially, my project will be a 2d game, with lots of complex levels, where some might be simple and others might be a bit more deep, with physics, etc. We want to implement our very own online structure: logging in, leaderboards, achievements, friends etc with our own servers. This means no OpenFeint nor GameCenter at all. We expect this game to be very large in both graphics and audio. We wish to use in-app purchases.

Now, we considered two options. Cocos2d and Unity3d.

We need help deciding using the factors I mentioned before (networking, good performance even for a large game in terms of graphics and audio like this, in-app purchases, etc) which option would fit better this?

Technically, both options can create 2d games. I'd like to hear your opinion.

sentences:
Trying to set up a planting and harvesting system, but it only works in one trigger area? What I want to happen is when the player presses alt, some time passes and an object is instantiated there. I also want it so that the player can't instantiate another object there until they've collecting the one they've planted there already. This is working when I only have one planting area, but once I have more than one planting area it no longer works- for some reason I'm only able to keep planting and collecting in just one of the trigger areas instead of all of them. What am I doing wrong?

public bool instantiated;
public bool inside;
public bool collected;
private IEnumerator coroutine;
public GameObject powerorb;
public Material[] material;
Renderer rend;

void OnTriggerStay2D(Collider2D Collider2D)
{
    if (Collider2D.gameObject.tag == "Player")
    {
        if (instantiated == false)
        {
            inside = true;
        }

        if (collected == true)
        {
            instantiated = false;
            collected = false;
            rend.sharedMaterial = material[0];
        }
    }
}

void OnTriggerExit2D(Collider2D Collider2D)
{
    inside = false;
}

    // Use this for initialization
void Start () {

    rend = GetComponent<Renderer>();
    rend.enabled = true;
}

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

    if (inside && Input.GetKeyDown(KeyCode.LeftAlt))
    {
        StartCoroutine("spawning");
    }

    if (instantiated == true)
    {
        StopCoroutine("spawning");
    }
}

IEnumerator spawning()
{
    rend.sharedMaterial = material[1];

    yield return new WaitForSeconds(8);
    Instantiate(powerorb, transform.position, transform.rotation);
    instantiated = true;
    inside = false;

    yield return null;

}

I reference if the object has been collected in another script with this:

 if (collecting)
        {
            GameObject.FindWithTag("PowerFarm").GetComponent<PowerFarmCoroutine>().collected =
        true;
            Destroy(gameObject);
        }

sentences:
HTML5 point and click adventure game code structure with CreateJS I'm a programming beginner.

I made a tiny one scene point and click adventure game to try to understand simple game logic and came up with this:
CreateJS features prototypes for creating bitmap images, sprites and sounds objects. I create them and define their properties in a corresponding function (for example images(); spritesheets(), sounds()...). I then create functions for each animation sequence and "game level" functions, which handle user interactions and play the according animations and sounds for a certain event (when the level is complete, the current level function calls the next level function). And I end up with quite the mess.

What would be the "standard (if something like that exists)" OOP approach to structure simple game data and interactions like that?

I thought about making game.images, game.sprites, game.sounds objects, which contain all the game data with its properties using CreateJS constructors. game.spriteAnimations and game.tweenAnimations objects for sprite animations and tweens and a game.levelN object, which communicates with a game.interaction object, processing user interaction. Does this make any sense?

How do you structure your simple game code?
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:
Libgdx detect when player is outside of screen Im trying to learn libGDX (coming from XNA/MonoDevelop), and I'm making a super simple test game to get to know it better. I was wondering how to detect if the player sprite is outside of the screen and make it so it is impossible to go outside of the screen edges.

In XNA you could do something like this:

// Prevent player from moving off the left edge of the screen
if (player.Position.X < 0)
    player.Position = new Vector2(0, player.Position.Y);

How is this achieved in libgdx? I think it's the Stage that handles the 2D viewport in libgdx?

This is my code so far:

private Texture texture;
private SpriteBatch batch;
private Sprite sprite;

@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();
    batch = new SpriteBatch();

    texture = new Texture(Gdx.files.internal("player.png"));
    sprite = new Sprite(texture);
    sprite.setPosition(w/2 -sprite.getWidth()/2, h/2 - sprite.getHeight()/2);
}

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

    if(Gdx.input.isKeyPressed(Input.Keys.LEFT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(-1f);
        else
            sprite.translateX(-10.0f);
    }
    if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)){
        if(Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
            sprite.translateX(1f);
        else
            sprite.translateX(10f);
    }

    batch.begin();
    sprite.draw(batch);
    batch.end();
}

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:
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:
minecraft mapping from tibia OTBM file I am new to minecraft modding but i program for a living and it looks quite simple to get around. I have this fantasy and a quick internet search shows im not the only one. For those of you who do not know tibia is an MMORPG first released in 1997. It is a 2d tile based game and i would like to see it in 3D. since it is a tile based game it fits nicely with the minecraft architecture. Tibia is a close sourced game but there is TibiaOT which is developed by the community and the map file format is OTBM (open tibia binary map). This is a set of 15 2D grids where each grid represents a floor or the height of the grid, the file comes with two more files with monster spawns and default item locations like chests.

There is a tibia texture pack for minecraft called "Tibian texture pack", so we got the materials covered.

all in all we have the following: a native tibia map and a minecraft texture pack

people have been building tibia maps manually for years now, it seems stupid because we have a binary file for the real map. what we need is a way to map the OTBM file to a minecraft map. i am looking for tools and any other tips a on how to digest the files into a minecraft map file. an explanation of minecraft map file format would also be very helpful.

sentences:
rotating objects in a double orbit I have a object at the center. Other set of objects rotating around center in first orbit. Now i want other objects to rotate around the objects in 1st orbit.

In the above fig, set of triangles are rotating around the square and circles are rotating around the triangle.
I have the code which works for 1st orbit, but i am  not able to render that second orbit.

I am calling display in loop. i is static global variable.
which transformations will do the second orbit?

sentences:
Pathfinding in hex grid based game I'm making a TBS using a hex grid. Player can move units from one hex to another using bridges, which will be randomly generated. I'm using cubic and axial coordinate system for my grid, it's well described in Red Blob Games' Hexagonal Grids.

I don't know how to make a hex understand connection with another one and then calculate best path for units.

I'm not sure how to approach the issue - should I make six slots for bridges in my hex class and then calculate path or should I make movement system somehow and then use absence of bridge as a "blocker"?

sentences:
Handling Back Button in Android without implementing InputProcessor Please advice/clarifyon below issue in libgdx while handling back button in Screens.

I have already gone through these 2 threads,

https://stackoverflow.com/questions/7223723/in-libgdx-how-do-i-get-input-from-the-back-button

Is there a way to capture back button twice in same activity libgdx game

As per suggestion in above two threads, I have done something like this in 2 Screen of my Game,

public class MainMenuScreen implements Screen{
    //omitted unnecessary code
    @Override
    public void render(float delta) {
    if (Gdx.input.justTouched()) {
        game.setScreen(game.STS);   //Setting 2nd Screen
    } else if (Gdx.input.isKeyPressed(Keys.BACK)) {
        System.out.println("mms back");
        //if(Gdx.input.isKeyJustPressed(Keys.BACK))
        Gdx.app.exit();            // Exiting
    }
}

public class StageScreen implements Screen{
    //omitted unnecessary code
    @Override
    public void render(float delta) {
        if (Gdx.input.isKeyPressed(Keys.BACK)) {
        System.out.println("backed to mms in android");
        //if(Gdx.input.isKeyJustPressed(Keys.BACK))
        game.setScreen(game.MMS);  //going back to Main screen
    }
}

Above code works fine, when I press BACK in Stage Screen to call Main Screen, it exits the app immediately, without stopping in my Main screen, which is as per my expectations because I am using Gdx.input.isKeyPressed(Keys.BACK) instead of Gdx.input.isKeyJustPressed(Keys.BACK).

But my problem is, when I use Gdx.input.isKeyJustPressed(Keys.BACK) method in my Screens, it does not (return true) catch BACK key.

I have already set Gdx.input.setCatchBackKey(true) for my Game.

Any idea, why does isKeyJustPressed not responds while isKeyPressed does?

Thanks in Advance.

sentences:
How do I make an arrow line up with a bow when rotating them? I am trying to create a bow and arrow animation in which the player can drag downwards to increase the bow strength (see the image) and release it to hit a target. I can't get the arrow to align with the bow when the arrow's height is changed (third image). I am rotating both the bow and arrow around their respective origins (w/2, h/2).

What is the correct way to do it?

sentences:
Having the player face themselves after the mid-game I am writing a game, in the vein of a jRPG, in which you begin playing as the main villain. You don't know it. You think you are playing the hero and the more successful you are and the stronger you make them the harder they will be to defeat at the very end of the game.

My main concern is anyone who puts in a significant effort early game could feel punished for it. It is also troublesome if the player finds the challenge of the final boss insurmountable because of actions from very early in the game. Is there a way I can signal early on in the second act that if they over-powered the villain it may haunt them? And there is also the possibility the twist will get out and people will just game it from the beginning. It is my intent to get some replay value out of it by having people do multiple runs based on different villain playthroughs. But is it a distraction if everyone learns the twist. Or conversely is it better if I reveal it myself in-game so everyone knows what they are working at from the start?

How do I make my potentially disengaging design hold up without turning people away?

sentences:
GL_DEPTH_COMPONENT vs GL_DEPTH_COMPONENT32 I googled like crazy and checked the OpenGL documentations but I couldn't find out how the precision of a depth buffer created using GL_DEPTH_COMPONENT is chosen.

As far as I know the precision is implementation dependent. But how will the precision be chosen? Will it always use the highest precision possible or rather the fastest one? Or is no general answer possible?

Shoud I always go with GL_DEPTH_COMPONENT32 instead?

sentences: In HaxeFlixel, how do I avoid hard-coding dialogue? I'm planning to develop a visual novel in Haxe Flixel and wanted to know if there is a easier way to add dialogue than to hardcode them in every square. I don't know if I can import a txt file with the dialogues or something like that so I can simple change the txt file instead of have to check the code for every typo.

sentences:
Counting down a number of coins in the same total time duration, no matter the amount Math has never been my strong suit and so I'm having trouble figuring out how to write this formula.

When you buy something in my game, the amount it costs to purchase that item will be taken off from your total coin amount one by one. It's a loop that repeats itself till the amount that needs to be taken off is 0.
I have that system set in place, but I need to figure out a way to calculate the speed of decrease, or the time between each coin, making sure that each purchase will last the same amount of time, regardless of how much it costs.

What I figured out is that I need to come up with a formula in which the time it takes between each coins should become smaller/shorter the more coins it costs.

e.g. 10 coins taken from your total coin amount should take as long 200 coins.
10 coins  -> 0.1   seconds between coins -> 1 second total
200 coins -> 0.005 seconds between coins -> 1 second total
500 coins -> 0.002 seconds between coins -> 1 second total
And etc.

It would be greatly appreciated if anyone could push me in the right direction and/or give a little explanation to whether this is possible or not.

Thank you

sentences:
Multiple errors on brand new C++ project I've just started a brand new project and created a created a new C++ Character class. However Visual Studio 2017 shows 140 errors. The project still builds fine, however the syntax highlighting and errors are very intrusive.

Here are some examples of the errors:

on the BaseCharacter.cpp class I just created:
class "UObject" has no member "BeginPlay"
class "UObject" has no member "Tick"
class "UObject" has no member "SetUpPlayerInputComponent"

on multiple '.h' files:
this declaration has no storage class or type specifier

for all '*.generated.h' files:
cannot open source file "[ClassName].generated.h"

Is this a problem with my intellisence or the project itself? I haven't changed any of the code that was generated by Unreal.

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: 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:
What is the best method to serve a real time game on websockets? The game consists of a world with just one force, gravity. All the players can do is jump and set their velocities with arrow keys. Physical AABBs and sphere's are used for collision.

What is the best method to serve this game on websockets? Dead-reckoning? Sending positions only for play back?

sentences:
XNA Content Pipeline With Map Creation Utility I've been looking into how to use the XNA Content pipeline appropriately for a game I am working on. I have however been having a hard time wrapping my head around it and am not sure on the best way to proceed.

The specific example is, I have a top down 2-d RPG style game. I want to create a utility (probably Windows Forms) that will allow me to easily create and edit maps. Each map consists of 1 or more graphic layers, each layer containing a N x N grid of tiles. In turn each tile starts out as a bitmap.

Given the above information I see a few ways to proceed:

Store the map info in an XML file compatible with the Content Pipeline XML loader. Each tile is stored as a string reference to the corresponding texture asset. Texture assets are added in the game project.
Store the map info in an XML file compatible with the Content Pipeline XML loader.
Each tile is stored as the path to the corresponding .bmp/.png files.

Now there are things that I really don't like about both approaches. The main issue with approach one is that the map creation and the .xnb texture asset creation are completely separate. The .xml map file is created by the utility, while the texture asset is added to my content in my game. This becomes an issue trying to make sure the .xml map file and all the texture assets in the project stay in sync.

Approach two would allow me to keep all the appropriate image file next to the map files using the map utility. However, it seems like I shouldn't have to do something like this. Also I would need to be more intelligent about loading the maps so that I am not rapidly loading the same image off disc for each tile.

So my question is: If you want to add a content generation utility (like a map editor), what is the best way to make sure that the custom content (map file) stays in sync with the texture assets. Also, keep in mind that in my map editor I would need the ability to load and display the texture assets.

Any input is much appreciated.

sentences: JAVA -- Should I use a float or double for 1.5 speed for my player's speed? What should I use in general for positions, etc.? The title says it all, but I would like to know if I should use a double 1.5 for my velX and velY factor, or a float 1.5 for my velX and velY factor. Also, I would like to know if I should use a double or float for everything such as positions of entities, etc.. Thanks in advance!

sentences:
How relevant is PHP today for browser games? I was the lead developer of 2 moderately successful browser games quite a few years back, and plan on working on a new game soon. At the time, I wrote them in pure PHP (no template engine or anything of the sort).

I'd like to start working on a new game, but have been out of the web development world for a while. Reading around, I hear a lot of good about Rails, Django, Node.js, etc., with which I have no experience (although I know my way around Python, Javascript, and the others quite well).

So my question is the following- if I were to go in my old ways and go with PHP again, would I be making things hard for myself? Would picking something more "trendy" have a real impact on my development?

In addition, does anyone have any pointers relating to specifically developing browser games with these more modern tools?

sentences:
Unity AddExplosionForce not doing anything Recently I've started learning Unity3D. I'm working on a game as an exercise in which you control a space ship and have to dodge asteroids. If you feel like it's getting a bit too much you can hit the space bar, emitting a blast in all directions that repulses nearby asteroids. To create this blast I have the following code:

public class PlayerBlastScript : MonoBehaviour {

public ParticleSystem BlastEffect;

// Update is called once per frame
void Update () {
    if (Input.GetKeyUp(KeyCode.Space)) {
        Fire();
    }
}

public void Fire() {
    ParticleEmitter effect = (ParticleEmitter) Instantiate (BlastEffect, transform.position, Quaternion.identity);
    effect.Emit();

    Vector3 explosionPos = transform.position;
    Collider[] colliders = Physics.OverlapSphere(explosionPos, 25.0f);

    foreach(Collider hit in colliders) {
        if (!hit) {
            continue;
        }

        if (hit.rigidbody) {
            hit.rigidbody.AddExplosionForce(5000.0f, explosionPos, 100.0f);
        }
    }
}
}

Even though the blast effect appears, the asteroids are not affected at all. The asteroids are all rigid bodies so what's the problem?

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:
Handling increasing numbers of users (server) For this post, we'll assume my game is multiplayer chess as it essentially requires the same functions. User logs in to the server and requests a game - the server provides a simple matching service and once done, they start the game. They get 30 seconds timed by the server per turn with 6 players in each game and however many spectators (probably very limited).

I would like to know how you would scale this.

I've considered two options:

Option 1

1) Main server to handle login / match making (which regardless of user numbers should be a fairly easy task)

2) Start new Node servers for each game that close when the game ends.

I'm not entirely sure how this could be implemented yet. (i.e. would the user connect to the main server still and the requests just be passed to the new server or would the user change connection to the new server and then back again when done? changing connection would reduce the load even further and as the two servers won't require communication between them, should be fairly simple)

Option 2

Have 1 Node server and somehow scale it.

--

Suggestions / input?

I'm planning on hosting on Amazon AWS and am well aware that the chances of my game even warranting this level of detail are probably nil but I'm taking this as a learning opportunity.

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:
Implementing pausing functionality I'm working in LWJGL and trying to implement pausing when the user presses the 'P' key. Thus far I have this:

boolean gamePaused = false;
    while(!Display.isCloseRequested()){

        if(Keyboard.isKeyDown(Keyboard.KEY_P) && !gamePaused)
            gamePaused = true;
        if(Keyboard.isKeyDown(Keyboard.KEY_P) && gamePaused)
            gamePaused = false;

        if(gamePaused){
            while(true){
                System.out.println("Game paused.");
                if(Keyboard.isKeyDown(Keyboard.KEY_P)){
                    gamePaused = false;
                    break;
                }
            }
        }
        //...game logic
    }

My problem is that it continues playing even when I press the P key.

sentences:
Should I initialize a Box2D World per Level? I'm using a LevelManager to load Tiled maps in my libGDX game, which stores:

Static:

final Size of map in Tiles
final Size of map in Pixels
final Size of an individual tile
TiledMap ACTIVE_MAP
World WORLD

When the map is loaded, it creates a new World and stores it in the static WORLD, later populating it with static bodies based on objects found in the map's Collision layer.

My reasoning for using static is down to the fact that logically, only one map will be playable at any one time, however I've got it in my head that only constants and singletons should be static, so this feels strange for me. Is there a better, more efficient way of handling this?

Should I have one World per Level, or a global World independent of what TiledMap is active?

In other words, should I initialize WORLD once and leave it as is, making it final, or continue what I am doing and initialize it as a new World whenever a new TiledMap is loaded?

How do I correctly dispose of all bodies within the World, essentially clearing it?

I'm going to have to do this every time I load a new map, regardless of whether or not WORLD is global.

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 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 would you generate details like trees, water or caves in a 2D terrain? Yesterday I made a post about generating a 2D planet, which resulted in this:

I did it by subtracting a radial gradient from simplex noise (explained in my other post).

Now of course thats a bit boring, what technique should I use to add details like trees, lakes or caves? Would be able to do something like this (but of course across the whole planet):

I know doing it on a planet would make it a bit harder, because you would have to know if f.E. the tree is on the north of the planet or the south. To make it easier, if you want, just assume a flat 2D surface like this:

sentences:
Tree of objects in 2D space - children relative to parent Question

How do we track the position of child objects, relative to a parent?

Context

I have a simple structure that keeps track of a point in space, along with zero or more children:

function Point(x, y){
  this.x = x;
  this.y = y;
  this.children = [];
}

Given the relationship:

const a = new Point(100, 100);
const b = new Point(10, 10);
a.children.push(b);

When these are rendered, I want point b to render at world location [110, 110].

After moving a and only a:

a.x += 10;

Both points move and the distance between the two must remain the same.

After moving b and only b:

b.x += 10;

Only b moves and the distance between both points must now be different.

In other words, a child's (x, y) is the same as its offset from its parent.

sentences: HUD Text not displaying/drawing I am trying to use blueprints to display my character's speed using a HUD, but for some reason the text is not displaying. What am I doing wrong? I am using the First Person template.

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:
OpenGL terrain rendering I have written my own 3D engine and want to improve some of my render systems. Right now I've got a terrain system including the shaders). I can add 4 different textures which can be blended at any given place.

This leads to my first question:

What is the default way for using the blending data? A "blend map"
that stores the blending data or should I assign the blend data to each vertex? The second option makes rendering faster and I do not have to bind as many textures but the blending value is only being interpolated between the vertices. (Loss of information ?)

Furthermore, I've seen other games where they added some normal maps. It is not difficult for me to implement that but I've also seen that the normal effect only happens if the fragment has a specific range of the camera. Everything beyond the normal calculations does not happen.

What happens if I am outside of the (normal range), what texture is
being rendered?
This question comes up with the question no. 2: It can be seen that that
if (e.g mountains) are beeing rendered in the far the default "rock"
texture is not being used to which I would usually apply my normal map (because it is outside the range). Is there some kind of an overlay map for the whole terrain?

I would be very happy if someone could give me some advice on how to make my terrain look better :)

Greetings, Finn

sentences:
Collision Managers and bitmaps I am rewriting a game I made to use a (custom) collision manager that uses the minimum displacement method. As of now, my simple manager can only recognize and act on a couple of shapes - Circles and AABB's. Those were pretty simple to implement, but I've run into a problem: My game also needs to be able to have bitmaps that the player (represented by an AABB) can interact with, such as the one below:

I have a couple of questions:

1) Does it make sense to have a shape BitmapShape, which does collision detection at the pixel level and searches outward in the bitmap for a place to move intersecting objects to? In the image above, it would make sense to check the players bottom-center coordinates against the bitmap of the hill, but you can imagine that this would provide odd results for an intersection from the top of the player.

2) How could any system like this allow for a rectangle to move up a hill? Wouldn't an minimum-displacement based method always move the rectangle backwards down a hill?

Thanks

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:
Designing Drops system - How and where chance of drops are defined? Just found a related topic but I have different/extended questions

I was wondering how the implement the drop system. I have to start designing the DB model for this so I was wondering whether what I am thinking is a good practice or not.

My game is like "City building" kind of browser based game (Flex/Flash app) with PHP and MySQL in the backend. In my game, like in any other games, there are chance based drop rate. I want to design the drop system such a way that I can easily configure

What item(s) can be dropped from which game element
What is the percent chance (probability) of getting a drop (a 100% meaning there will be some drop always)
What percent chance of getting a specific drop. Here I define for each item (if can drop various items) what is the chace of drop, 90% to very frequent, 5% to very rare

I am wondering how the probability is determined? It might sound very noobish but just want to confirm does it mean roll a random number and compare with the odds we defined?
If I am not wrong this is good for determining "how much to drop" but not for "what to drop"

Example: If we say drop 1-10 coins or 20-50 coins. I will simply call a random() function and generate a random numbed from the desired range.

Now for other example: Drop one of Bullets (95%), Empty Gun (4%), Loaded Gun (1%)

If I roll a random number range from 1-100 and compare with probability I defined

so, a number between 1-95 drops bullet, and a number between 96-99 drops empty gun and a loaded gun when it generates 100?

Is this how it has to be done? or is there a better way?

Update:

Removed 2nd question about hack safety

sentences:
Agent avoidance in 3D I am currently trying to find some alogorithm for agent avoidance in 3D (or for simplicity, 2.5D could be enough).

So far, I have been using variation of RVO - "Reciprocal Collision Avoidance" (C++ implementation from http://gamma.cs.unc.edu/RVO2/). They have 2D and 3D version. However, 3D is designed for planes, so agents are kind of "flowing" in the air during avoidance.

2D version is working correctly, but only in a plane. If I elevate agent to copy terrain (set its Z-position manually), the avoidance looks sometimes weird, because the actual distance is big, but the projected distance in XY plane is small and thus result in collision.

Other algorithm derivates from RVO are similar, designed only for 2D. Before I start to "editing" my current solution, is there something created directly for purposes of 2.5D (or 3D)?

sentences:
What is a good strategy to recruit test players for a chess app? We developed a chess app for iMessage and we would like to have people try it out and tell us their opinions.

Do you know a good strategy to give away free promo codes for the pro version of our new game?

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: Game Design vs Game Development What is the difference between a video game developer and a video game designer?

sentences:
Why projection window is between -1 and 1 Is it a convetion ? What we achieve with this ?

I am reading about how the perspective and orthographic matrix is getting calculated and everyone is trying to normalize the homogenous coordinates to [-1,1]

Thank you !

Orthographic Projection

sentences:
Can a Component.gameObject be null in Unity? Can a Component.gameObject be null in Unity? If it can what can cause it to be null?

The context for the question is a NullReferenceException I got from the users, which specifies only method, but not line in which it occurred.

So, I suspect that there may were conditions which cause Component.gameObject to be null.

sentences:
Unity's Android Notification system works on my Xiaomi, but on a Huawei every notification has an "Unknown" status? When my app starts I check whether there is a notification or not

if there isn't I create one via SendNotification(...)
if there is, I check their status:

var status = CheckScheduledNotificationStatus(notificationId);
On my Xiaomi their status is Scheduled, so I update them:

SendNotificationWithExplicitID(...)

But on a Huwaei it's always Unknown, in that case I create a new:

SendNotification(...)
And replace the old ID in the PlayerPrefs.
But on the next startup it's unknown again.

Maybe I should use SendNotificationWithExplicitID(...) as well when the status is Unknown so I can keep the ID?

Here is the code:

var notification = CreateNotification(jsonWrapper.Name, fireTime, title, text);
if (PlayerPrefs.HasKey(jsonWrapper.Name))
{
    var notificationId = PlayerPrefs.GetInt(jsonWrapper.Name);
    var status = AndroidNotificationCenter.CheckScheduledNotificationStatus(notificationId);
    if (status == NotificationStatus.Scheduled)
    {
        AndroidNotificationCenter.SendNotificationWithExplicitID(notification, "default", notificationId);
        Logger.Log($"Updated a notification: {jsonWrapper.Name} at {fireTime}.");
    }
    else if (status == NotificationStatus.Unknown)
    {
        var id = AndroidNotificationCenter.SendNotification(notification, "default");
        PlayerPrefs.SetInt(jsonWrapper.Name, id);
        PlayerPrefs.Save();
        Logger.Log($"UnknownStatus | Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
    }
}
else
{
    var id = AndroidNotificationCenter.SendNotification(notification, "default");
    PlayerPrefs.SetInt(jsonWrapper.Name, id);
    PlayerPrefs.Save();
    Logger.Log($"Registered a new notification: {jsonWrapper.Name} at {fireTime}.");
}

sentences:
How are profiling- and tracing -techniques used in Game Development? I feel that in order to create realistic real-life games, game developers need some ways to monitor the system itself i.e. players' moves, other events and the state of the system itself. I know that creation of profiling/tracing -systems is not that easy, look how many people have tried to do better coverage -program in Python and fell far away from the original coverage.py.

I may be associating profiling/tracing wrongly to this game-development phase of dynamic monitoring but I am interested to know where/how profiling and tracing -techniques such as pythonic sys.settrace() are used in game development?
What is their purpose and what are the dynamic event monitoring systems really called? Game engines?
Are there some ready systems to advance/investigate profiling/tracing -areas in game development?

sentences:
Gamemaker Multiplayer Game I'm trying to implement multiplayer into my game using the server client model. What is the best method of synchronozing the game between the clients? What I'm thinking is that the game runs on the client, where the clients send the inputs (keyboard input for example) to the server, and the server then passes that on to the other clients, which then process that information. To make this system more robust the game would also run on the server, and the server would send synchronization packets to synchronize all the instances in the room. I can already see some potential flaws in this design, so that's why I'm asking for a better implementation. Both the server and client run in gamemaker.

To give you some context: my game is a relatively simple rpg platformer, where you have an inventory and items, player stats like armor and physical damage (the stats are almost identical to those of league of legends). You move with the arrow keys or wasd, like a regular platform game. For now I want to implement pvp, but would like to set up networking in a way that allows for npcs. I want to have a maximum of say 4 or 5 players connected at a time.

I have read up on client prediction, server reconciliation, entity interpolation and lag compensation, but it seems overkill for my application (it might not be I'm not sure).

I guess there it is somewhat acceptable to have a pure authoritative server, other than the fact that the player movement will become unresponsive, which is a big issue. Also using items and switching between then will become less responsive, which will make pvp less intense, but I can't think of a reasonable workaround for that.

Also, I am not worried about cheating as I am making this game just to have fun with friends.

Thanks.

sentences:
Is there a problem with using a 2D square grid for your world map? I'm making a game with a 2D square grid for my world map. It wraps around, so when you reach all the way north you start out in the south again, and when you go all the way east you wind up in the west, etc.

Would this method have any flaws? I'm under the impression there might be flaws around e.g. fast travel.

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

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

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

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

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

        // Loads game data
        LoadDataIfNeeded();
    }

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

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

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

sentences:
How to update indices for dynamic mesh in OpenGL? So I am making a 3D batchrenderer for my engine, and the basic concept is that we make large enough VBO and IBO to accompany all the vertex data(positions, normals, uv etc.) and update the VBO using glMapBuffer or using glbuffersubdata everyframe if we want to make any changes, but in this case the pattern of the IBO (Index Buffer) is predefined (i.e. we assume we have quads and fill it with 012230 for the entirety of the IBO size) but when using 3D models this won't be the case the IBOs data would be different, so how do I change the IBO data if I instantiate a new model or suppose if I am generating a UV sphere and want to change it's subdivisions?
I have no idea how to deal with dynamically changing(need not be frequent) indices data when using VAOs,  VBOs and Index Buffers.
As per OpenGL 4.5, core profile, reading from client memory is unsupported (§10.3.10 OpenGL 4.5 core spec):

DrawElements, DrawRangeElements, and DrawElementsInstanced source their  indices  from the  buffer  object  whose  name  is  bound  to
ELEMENT_ARRAY_BUFFER, using  their indices parameters  as  offsets  into  the  buffer  object  in  the  same  fashion  as  described  in  section  10.3.9. [...] If zero is bound to ELEMENT_ARRAY_BUFFER, the result of these drawing commands is undefined.

so we cannot map the ELEMENT_ARRAY_BUFFER using glMapBuffer or glBufferSubData (or can we?), and glDrawElements does accept a pointer to indices data but only when we are not using VAOs and VBOs, if we are using them it takes the last argument as a pointer offset in the currently bound ELEMENT_ARRAY_BUFFER.
So what's the best way to deal with dynamic indices?

sentences:
How to do pixel perfect movement with Unity3D? How would you be able to make sprites move pixel by pixel in Unity3D? I've tried the following things.

int x = (int) transform.position.x;
int x = Mathf.FloorToInt(transform.position.x);
int x = Mathf.RoundToInt(transform.position.x);

I don't know what else to try

Because I'm making an SNES looking game, and when things move, there is very bad pixel crawl in the sprites.

sentences:
LibGDX. How to fill background with shader? I want to make background of my game like lava via perlin noise.
I've read some tutorials but they were too old and some api calls aren't exist already.
If I understand right in libgdx I need to create a runtime-generated texture (FrameBuffer) on x=0 and y=0 with width=Screen width and height=Screen height and apply shader to it.

I tried to do:

class A extends ApplicationAdapter {
    FrameBuffer   background;
    ShaderProgram shaderProgram;

    public void create() {
       background = new FrameBuffer(
           Pixmap.Format.RGBA8888,
           Gdx.graphics.getWidth(),
           Gdx.graphics.getHeight(),
           false
       );
       shaderProgram = /* stuff to pickup .vert and .frag */
    }

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

        background.begin();
        batch.setProjectionMatrix(
          new Matrix4().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight())
        );
        batch.begin();
        batch.setShader(shaderProgram);
        batch.end();
        background.end();
    }
}

My shaders are simple red fill programs:

//Vertex
attribute vec4 a_position;

uniform mat4 u_projTrans;

varying vec2 v_Pos;

void main() {
    gl_Position = u_projTrans * a_position;

    v_Pos = gl_Position;
}

//Fragment
#ifdef GL_ES
    precision mediump float;
#endif

uniform mat4 u_projTrans;

varying vec2 v_Pos;

void main() {
    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

Nothing has been drawn. I expect that all my viewport become red

Function that picks up shaders is working, i tested at sprites

sentences: What is the "TangentsW" attribute inside the FBX file format for? sometimes it is -1, sometimes is +1. Do I need it for the rendering of the normal maps?

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:
Is GPU locality of reference worth worrying about? Does locality of reference make as much of a difference to GPU performance as it does CPU performance?

For example, if I send 200 draw commands to the GPU, will I see a (potentially) noticeable difference if the data for each command is contiguous in memory instead of jumping around the buffers/texture maps?

Side question: I'm assuming the GPU ensures against false sharing issues by having most resources immutable. But in the case where they're not, is that why threads always do four fragments' worth of work?

sentences:
Creating a toggle button in unity3d Scene vs Scripting I am making my first GUI in unity, and I am not sure if should create the toggle buttons in the game scene by creating new UI elements or by scripting.

Creating them in the game scene gives me more options but I have trouble to manipulate the input.

Because of this I am scripting them in the monodeveloper but it seems more difficult to work the visual side (I am using a texture but can't get rid of the little box (that shows f the button is clicked or not).

How do you make your toggle buttons and how do you develop your GUI?

Any help appreciated.

sentences:
Arbitrary projection matrix from 6 arbitrary frustum planes A projection matrix represent a tranformation from the camera view space to the rendering system clip space. In other words, it defines the transormation between a 6-sided frustum to the clip cube.

The glOrtho and glFrustum use only 6 parameter to define such a projection, but impose several constraints on the frustum that will get projected to the clip cube: the near and far planes are parallel, the left and right planes intersect on a vertical line, and the top and bottom planes intersect on a horizontal lines, both lines being parallel to the near and far planes.

I'd like to lift these restrictions. So, from the definition of the 6 frustum side planes (in whatever representation you see fit), how can I compute a general projection matrix?

sentences:
Multiple buffers and calling glBufferSubData Originally asked this on Computer Graphics, but it might fit in better here.

In my project, for convenience I would like to use many buffers.
Many buffers in my case means 50-100 terrain patches represented by buffers with vertex coordinates, normals, indices and maybe color. The magnitude of data would be, let's say 10^4 floats per buffer. Some of this data can be shared between each terrain patch, f.ex. xz-coordinates and indices.

During the rendering loop, some terrain patches will be updated. Which means that for certain buffers I call glBufferSubData() for the whole buffer.

My question is; are there any pros/cons, performance wise between these two methods:

1) Controlling my data in many buffers (50-100), thus letting me call glBufferSubData on a complete buffer when needed.

2) Controlling my data in fewer (5-20) buffers, with more data in each. But then having to set up a system where I need to call glBufferSubData on smaller portion of a buffer. (Which leads to a more complex design in my case).

sentences:
Making random spawn points fair? If all players are spawned at random positions the same distance from adjacent players, the number of players will be proportional to the likelihood of their spawn positions being unfair.  The closer players spawn to the centre of the map, the more likely they are to encounter other players and the less likely they are to survive, compared with players on the edge of the map.  Assume all players are spawned at the same time.

Is there a way to shape spawn points, or change the map, so that:

All players have a limited number of adjacent foes.
All players have equal chance of encountering adjacent foes.
Map size does not have to increase proportional to the number of players.
These limitations are not enforced with arbitrary impassable spaces.

The answer does not have to be perfect, just obviously better than the alternative.  Out of the box thinking welcome.

sentences:
Enemy class architecture I'm developing a game for Android in Java. I would like to know how a good Enemy class architecture could be implemented.

I've created an abstract class called Enemy. It stores common properties like Health and Animation data. It has methods like LoadContent, Update and Draw.

I want to inherit this class and implement different enemy classes. I want to be able to store all my active enemies in some sort of collection. Then in my Update function of my game loop, I'll do something like:

for each Enemy in Enemies
{
Enemy.Update()
}

And the Update method of the correct child class would be called.

How can this be achieved?

sentences:
Destroying the instance that instantiated the prefab What I have so far:

A fuel that has Fuel script attached to it.
The fuel prefab is first instantiated from another script in its Start() method.

problem:
The Fuel script is such that it results in instantiation of prefab fuel repeatedly at some intervals of time and keeps destroying the earlier ones.
But

the prefab that was instantiated from the other script stays there always. I want this prefab to be destroyed as well(or atleast made invisible) while the process of instantiation and destruction of of fuel prefabs continues to go on.

How do I achieve this?

sentences:
unity3d-Find angle between 3 vector3 points obtained from swipe I was trying to find the angle between 3 vector3 points obtained from the screen swipe. The first vector3 point is the first touch position fp, the second is some intermediate touch ip and the third, the final touch position lp.

I tried the unity's Vector3.angle to get the angle but I was getting some angle even if I swiped in a straight line.
Here is what I tried

AB = ip-fp

BC= lp-ip

Then I applied Vector3.angle(AB, BC) but the result is not what I'm looking for.
Any solutions?

sentences:
How can I get the borderSize/s of a plane? public Texture2D gridImage;
public GameObject floor;

    private int borderSize;

    private void Start()
    {

        GenerateGrid();
    }

    void GenerateGrid()
    {
        Color gridColor = Color.cyan;
        Color borderColor = Color.black;
        Collider floorCollider = floor.GetComponent<Collider>();
        MeshRenderer floorRenderer = floor.GetComponent<MeshRenderer>();
        floorRenderer.material.mainTexture = gridImage;
        floorRenderer.material.mainTextureScale = new Vector2(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        floorRenderer.material.mainTextureOffset = new Vector2(.5f, .5f);

        Vector3 foorSize = new Vector3(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        for (int x = 0; x < gridImage.width; x++)
        {
            for (int y = 0; y < gridImage.height; y++)
            {
                if (x < borderSize || x > gridImage.width - borderSize || y < borderSize || y > gridImage.height - borderSize)
                {
                    gridImage.SetPixel(x, y, new Color(borderColor.r, borderColor.g, borderColor.b, 50));
                }
                else gridImage.SetPixel(x, y, new Color(gridColor.r, gridColor.g, gridColor.b, 50));
            }
            gridImage.Apply();
        }
    }

In the end I want to create something like this on a 3D Plane UI :

sentences:
TiledMap renders but gets duplicated when I move the camera I've created a map (TMX file) using Tiled, imported it and it shows great but when I move the camera, it duplicates itself and the whole screen flickers.
In Tiled, I didn't use a spritesheet but rather a collection of images as they have different sizes.

See attached image:

Here is my game class:

public class MyGdxGame extends ApplicationAdapter {

    private IsometricTiledMapRenderer renderer;
    private OrthographicCamera camera;
    private TiledMap map;
    private Vector2 dragOld, dragNew;

    @Override
    public void create() {

        map = new TmxMapLoader().load("isometric_map.tmx");
        renderer = new IsometricTiledMapRenderer(map);

        camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);

        Gdx.input.setInputProcessor(new InputAdapter() {
            public boolean touchDown(int screenX, int screenY, int pointer, int button) {
                if (button == Input.Buttons.LEFT) {
                    dragNew = new Vector2(Gdx.input.getX(), Gdx.input.getY());
                    dragOld = dragNew;
                    return true;
                }

                return false;
            }
        });
    }

    @Override
    public void render() {
        super.render();

        camera.update();

        renderer.setView(camera);
        renderer.render();

        if (Gdx.input.isTouched()) {
            dragNew = new Vector2(Gdx.input.getX(), Gdx.input.getY());
            if (dragOld != null && !dragNew.equals(dragOld)) {
                camera.translate(((int) dragOld.x - dragNew.x), ((int) dragNew.y - dragOld.y)); //Translate by subtracting the vectors
                camera.update();
                dragOld = dragNew; //Drag old becomes drag new.
            }
        }
    }

    @Override
    public void resize(int width, int height) {
        super.resize(width, height);

        camera.viewportWidth = width;
        camera.viewportHeight = height;
        camera.update();
    }

    @Override
    public void dispose() {
        super.dispose();

        map.dispose();
    }
}

What am I missing?

sentences:
Turn based multiplayer, Google services or Parse or.. I have a turn based game on Google play already (paid with around 2000 users and free with around 50k).i am thinking of adding multiplier option to it. I am unable to progress because I don't know which path to take (given its my first multiplier game). I need your help

Like any turn based app, you have the concept of players joining in, rooms, scores and ranking (linking it with fb is preferred)
For my backend server, which option should I go with? Google play game services, Parse, AppWrap.. Etc or simply me use my website server and do the server code?

I am leaning towards Google Game services just because the infrastructure is there and it's free. But I don't find it to provide flexibility and control (such as using nicknames, listing rooms.. Etc)

I just heard about Parse so no experience

Any help or recommendations? Plzzzz need your advice

sentences:
Is it wrong to be creating new objects in Update()? I'm using Unity and sometimes I'm using th new keyword in Update, like new Vector3() etc...

I wonder is this causes memory leak? I mean in every frame a new Vector3 is created. If this is the way of working that means there are thousands of Vectors created in memory. Is it true or do I think wrong?

sentences:
With what projection matrix should I render a portal to a texture? I'm using OpenGL. I have problem with my engine's portal implementation. To create the first portal I do:

create a virtual camera with the position of the second portal and the correct orientation
render whole scene from virtual camera to the texture using FBO
render the first portal using the texture created before.

The problem: The virtual camera is rendering to the texture with the main projection view, so when I use this texture to render the first portal, everything is rescaled. The virtual camera should only render some part of the view to prevent scaling.

The problem could perhaps be solved by changing the virtual camera's projection matrix, but I don't know how to calculate such a matrix.

Here's how it looks:

This picture shows one portal (the texture is a little bit deformed on bottom and top, but that's not important now) and some other objects. The second portal is behind the camera, and the camera is in the middle between the two portals.

We can clearly see that the portal texture is rescaled down to the portal size. As I said before, I think the virtual camera should have another projection matrix, but how do I calculate it? Or is there a better way?

sentences:
Transformed Vertices have wrong Z Axis For quite some time I've been working on my open 3D game engine, to learn how this stuff works. You can see the full codebase relating to my problem here on GitHub.

I'm using an OpenGL 3.3 Core Profile Context on Mac OS X 10.10.3 and a GeForce GTX 760, if this matters.

Everything seems to work fine when submitting my vertices and MVP matrix to the Pipeline. But at two different points I try to transform vertices on my CPU, which leads to problems.

To simplify rendering the debug bounding boxes in a single frame, I transform the vertices by their MVP matrix and later submit them all to OpenGL with an identity matrix as transformation matrix:

for (auto& c : corner) {
    glm::vec4 t = VP * glm::vec4(c, 1.0f);
    vertices.emplace_back(glm::vec3(t) / t.w);
}
// ...
Shader::drawGL(vertices, colorsLine, indicesLine, glm::mat4(1.0f), gl::GL_LINES);

Most of the time, this seems to work fine. But when some vertices of a bounding box lie behind the camera, they will be "mirrored" and extend into empty space, as you can see in this screenshot:

Something similar happens with my portal based rendering approach, as described in Portals and Mirrors: Simple, Fast Evaluation of Potentially Visible Sets. Basically, I'm looking for a visible portal, and then for more portals that are visible through the already found portal. The relevant code:

for (int c = 0; c < 4; c++) {
    glm::vec3 port = portal.getVertex(c);
    glm::vec4 result = VP * glm::vec4(port, 1.0f);
    glm::vec3 vert = glm::vec3(result) / result.w;
    // ...
}

This basically works as expected, as you can see in the following screenshot:

However, as before, there is a problem with vertices behind the camera. I would expect the transformed vertices Z axis to be in the range [0;1] and vertices behind the camera should be outside of that range. What I'm really seeing, however, is that the Z part is always 1, as you can see in this screenshot (the first line is the world vector, the second is the vector multiplied with the matrix, the third is the multiplied vector divided by w):

To give you the full picture, this is how I create my projection matrix:

projection = glm::perspective(45.0f, size.x / size.y, 0.1f, 75000.0f);

And my view matrix is created using the quaternion of my camera:

glm::mat4 translate = glm::translate(glm::mat4(1.0f), pos);
glm::mat4 rotate = glm::toMat4(quaternion);
view = glm::inverse(translate * rotate);

According to every description I've read of the OpenGL transformation pipeline, I've done everything to have my world coordinates now in clipping space. But, looking at the Z axis, this seems to be false. I'm sure I'm missing something obvious with my math here.

Please help me out :)

Best Regards,
Thomas

PS: English is not my native language, please excuse any mistakes.

sentences:
Is there a common library for key listener for Java? I'm making a game engine which supports Swing and JavaFX at the same time.

I provided key listener APIs like this:

Swing

fun addKeyListener(
    typed: Consumer<KeyEvent>? = null,
    pressed: Consumer<KeyEvent>? = null,
    released: Consumer<KeyEvent>? = null) {
    addKeyListener(object : KeyListener {
        override fun keyTyped(e: KeyEvent) {
            typed?.accept(e)
        }

        ... // Something similar for release and press
    })
}

fun addKeyTypedEvent(keyCode: Int, key: Consumer<KeyEvent>)
    = addKeyListener(typed = Consumer { e ->
            if (e.keyCode == keyCode) key.accept(e) })

... // Something similar for release and press

JavaFX

var onKeyTyepd: EventHandler<in KeyEvent>
    get() = scene.onKeyTyped
    set(value) {
        scene.onKeyTyped = value
    }

... // Something similar for release and press

But I want to extract an abstract common API to reduce the cost of migrating between Swing and JavaFX.
Since Swing and JavaFX uses different KeyEvent, I currently have no idea.

Is there any solution?

sentences: Is there a library or a framework that handles networking in an RTS? I'm aiming for making a(n) RTS game with networking so instead of doing tedious stuff like networking I wonder if there is a library/framework that will save me the effort. I intend to make that game in Unity if it is of any interest.

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:
Cannot find the Cocos2d templates I am about to upgrade to the last version of Cocos2d and would like to uninstall my current Cocos2d templates before installing the new one but cannot find the templates to delete.

I have looked at a number of web comments on this such as Uninstall Cocos2D ans another uninstall example but to no avail. However, I still see Cocos2d in my Xcode (4.5) framework. I have been searching my directories but cannot find it.

Is there anyone out there who can give me a hint where to find it so i can delete in?

sentences:
To implement a game object that expires, should I store the start time and total, or store the remaining time? Example:
There is a bomb (like in Counter Strike) which explodes after 45 seconds. Should I—

store the 45 seconds in a variable, and decrease it by the delta time at every update, or
store the time when the bomb was planted, and check at every update if it is less than or equal to the current time minus 45 seconds?

How do I choose which approach to use?

sentences:
opengles display human face in iphone and animate it? I need to make a human 2D face to 3D face.
I used this link to load an ".obj" file and map the textures. This example is only for cube and pyramid. I loaded a human face ".obj" file.

This loads the .obj file and can get the human face properly as below.

But my problem here is I need to display different human faces without changing the ".obj" file. just by texture mapping.

But the texture is not getting mapped properly, as the obj file is of different model. I just tried changing the ".png" file which is used as texture and the below is the result, where the texture is mapped but not exactly what I expected, as shown below.

The below are my few questions on it :

1) I need to load texture on same model( with same .obj file ) with different images. Is it possible in opengles?

2) If the solution for above problem  is "shape matching", how can I do it with opengles?

3) And finally a basic question, I need to display the image in large area, how to make the display area bigger?

sentences: Creating multiple fixtures in one body I want to create this type of fixture in one body. Here square and circle both are different fixtures but attach to one body. How do I do this?

sentences:
How to add lighting to a 2D Tile-based game in JavaFX? I'm making a 2D roguelike tile-based game with Java and JavaFX.  I'm currently working on adding lighting and darkness to the dungeon, but whenever I try running it, it takes a very long time to load, and it eventually gives an out of memory error.

Here is Lighting.java:

package sample;

import static sample.World.worlds;

public class Lighting {
    public static void calculateLighting(int wn, int skyLighting) {
        Block[][][] world = worlds[wn];
        for (int z = 0; z < worlds[Player.cw][0][0].length; z++) {
            for (int y = 0; y < worlds[Player.cw][0].length; y++) {
                for (int x = 0; x < worlds[Player.cw].length; x++) {
                    Block b = world[x][y][z];
                    b.light = skyLighting;
                    if (b.embID == 1) { //test if a block has a torch attached to it
                        for (int distance = 0; distance <= 15; distance++) {
                            for (int x1 = x - distance; x1 < x + distance; x1++) {
                                for (int y1 = y - distance; y1 < y + distance; y1++) {
                                    for (int z1 = 0; z1 < worlds[Player.cw][0][0].length; z1++) {
                                        try {
                                            world[x1][y1][z1].light += 1;
                                        } catch (ArrayIndexOutOfBoundsException ignored) {

                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        for (int z = 0; z < worlds[Player.cw][0][0].length; z++) {
            for (int y = 0; y < worlds[Player.cw][0].length; y++) {
                for (int x = 0; x < worlds[Player.cw].length; x++) {
                    Block b = world[x][y][z];
                    if (b.light > 15) {
                        b.light = 15;

                        //If your number X falls between A and B, and you would like Y to fall between C and D, you can apply the following linear transform:
                        //Y = (X-A)/(B-A) * (D-C) + C
                        //https://stackoverflow.com/questions/345187/math-mapping-numbers
                        //(worlds[Player.cw][x][y][z].light-0)/(15-0) * (1-0.5) + 0.5
                        if (b.sprite != null) {
                            b.sprite = ImgManip.darken(b.sprite, (worlds[Player.cw][x][y][z].light) / (15d) * (1 - 0.5) + 0.5);
                        }
                    }
                }
            }
        }
    }
}

What this is doing is that it first finds torches in the world, and then increases the brightness of each block around it, depending on how far away the torch is.  Then, it takes each block's sprite and makes it darker with the darken() method.  This is what is causing it to take so long. When I just comment that out, it performs just fine, but the lighting isn't there.

Here is the darken() method:

public static Image darken(Image image, double amount) {
        PixelReader pixelReader = image.getPixelReader();
        WritableImage writableImage =
                new WritableImage(
                        (int)image.getWidth(),
                        (int)image.getHeight());
        PixelWriter pixelWriter = writableImage.getPixelWriter();

        for(int y=0; y<image.getHeight(); y++){
            for(int x=0; x<image.getWidth(); x++){
                Color color = pixelReader.getColor(x, y);

                color = color.deriveColor(0,-amount/2d,-amount,0);

                pixelWriter.setColor(x, y, color);
            }
        }
        return writableImage;
    }
```

sentences:
Custom Rule-Based System for Action Recognition in a Game I want to make objects in a side project interatible with each other. For this, I want to be able to create rules so "Collisions" (Interactions) can be recognised by testing the rules. The rules should be able to reference what object does the player is trying use, in what state the object is, with which object does he try to interact with (could be nothing) and the state of this object. Maybe the rules will need to consider the state of the game as well.

With this in mind, here is my question. How could I create a rule-based system that I could use ? What design patterns could I use to create something scalable and that will allow me to add, remove and modify rules without having to regenerate the project ?

sentences:
What is the geometrical interpretation of Input.GetAxis("Mouse X")? According to the documentation, Input.GetAxis("Mouse X") produces a range of values from -1 to 1. However it will produce another range if it is setup to be  delta mouse movement.

  Returns the value of the virtual axis identified by axisName.

  The value will be in the range -1...1 for keyboard and joystick input. If the axis is setup to be delta mouse movement, the mouse delta is multiplied by the axis sensitivity and the range is not -1...1.

Question

I don't understand what the value means geometrically. Is it a displacement between two points each in  consecutive frame updates? If so what is its unit? Pixels, points, centimeters, etc?

sentences:
How to get connected tiles in hexagonal grid system I've been developing a game where a number of tiles can drag into a hexagonal grid background.

For some purpose I need to find the location of same tiles into an array and merge them.

Data Layer:

Presentation Layer:

I need to find the location of all the tiles those who have same value and connected with each other.

So I need a basic idea, how can I do that or if exists any algorithm.

Note: As3 related code will help.

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 the GameObject's LayerMask? I am currently following Unity's 2D Roguelike tutorial.

In that tutorial, I have Player, Enemy, and Wall Prefabs, which all belong to a Layer called BlockingLayer.

The Player and Enemy Prefabs both have a script inheriting from a script called MovingObject.

While writing the MovingObject class, I was meant to write the following line of code:

public LayerMask blockingLayer;

Later on, after creating the Player and Enemy scripts and attaching them to their respective Prefabs, I was supposed to set the blockingLayer to BlockingLayer from within the editor.

I thought this was stupid, because the Prefabs already belonged to the correct Layer, otherwise they couldn't interact with one another, so I changed the variable to private and instead added the following line to the Start() method:

blockingLayer = gameObject.layer;

However, suddenly collisions no longer worked. The Player and Enemy could now walk through each other as well as through Walls. Using the Visual Studio debugger, I noticed the following:

Setting the blockingLayer via the editor yielded following value: 256.
gameObject.layer has a value of 8.

Obviously, the two layers are completely different, which explains why my modification didn't work. Still, I believe that setting the Layer twice — once on the GameObject, and once on the script — is dumb.

How do I get the correct Layer programmatically?

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:
How do I find an accurate current speed of a navmesh agent? So I have a blendtree of an idle/walk/run animation of a character (the navmesh agent). I want to use a normalised float of the speed of the navmesh agent to control the blend of the animation cycles. Currently I use this:

void FixedUpdate ()
{
    speed = (transform.position - lastPosition).magnitude;
    lastPosition = transform.position;

    print(speed);
}

However the result is fluctuating all over the place and the animations blends look crap. How do I find a more accurate speed of the navmesh agent?

sentences:
Parsing "pick up" action in a text-based RPG I’m coding a text-based RPG and I have my controls working: I have a string checking what you write in against an array of if statements.

It can get it right with everything other than my pick up action.

My if statements are set out as follows:

int game_main() {

    string PlayerOption;

    //I have a few lines of cout statements just for my gui/hud

    cin >> PlayerOption;

    if (PlayerOption == "look") {
        //it’s then just calling a script from a separate header file
    }
    else if (PlayerOption == "pick up") {
        //another script from that header
    }

My look command and all my others work but I don’t know how to set it up right.

I've tried putting it like "pick up", I tried it like "pick"" ""up" and a couple other ways but I don’t know how to properly write the expression.

Even then my problem might be with my string and not my if statement so any suggestions would be greatly appreciated.

And I think @DMGregory might be right about the word boundaries because even with that command if I make it accept "pick" it works it’s only when I ask it for two words it really breaks

Is there any way I could get around that?

sentences:
OpenGL Uniform Standard Buffer Alignment confusion Although i asked the same question over StackOverflow, i thought i can get more info from here too.

I have been reading about std140 Uniform block in OpenGL Superbible 6th edition, where in page 111 the following example is given :

layout(std140) uniform TransformBlock
{
      //Member                        base alignment    offset  aligned offset
      float scale ;                   // 4              0       0
      vec3 translation;               // 16             4       16
      float rotation[3];              // 16             28      32 (rotation[0])
                                      //                        48 (rotation[1])
                                      //                        64 (rotation[2])
      mat4 projection_matrix;         // 16             80      80 (column 0)
                                      //                        96 (column 1)
                                      //                        112 (column 2)
                                      //                        128 (column 3)
}

I am having hard time understanding the alignments, even using the rules that have described earlier in that page, it still don't make sense.To be specific thing that confuses me is :

What is the Offset and what is aligned offset, why 2 different offset?
Why is the rotation[0] offset starts at 28, and why aligned offset is 32?

Hopefully someone can clear my confusions.I would highly appreciate.
Thanks

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:
NavMesh.CalculatePath returns invalid path Unity3D I am trying to get coordinates for path from source to destination object using NavMesh. NavMesh.CalculatePath() is only working for one level surprisingly. For all others, it returns false. Also NavMeshPathStatus is invalid. This is working Level, while this is not working fine with navmesh.

Code:

private NavMeshPath path;

    void Start () {
        path = new NavMeshPath();
    }

//Following function is called on button press
public void giveHint() {

        NavMesh.CalculatePath(source.transform.position, destination.transform.position, NavMesh.AllAreas, path);

    if (path.status == NavMeshPathStatus.PathComplete)
        print ("Path complete");
    else if (path.status == NavMeshPathStatus.PathInvalid)
        print ("Path invalid");
    else if (path.status == NavMeshPathStatus.PathPartial)
        print ("Path partial");

    for (int i = 0; i < path.corners.Length-1; i++) {
            Debug.Log(path.corners[i]);
        }
   }

// Update is called once per frame
    void Update () {
    if (path.corners != null) {
            if(path.corners.Length > 0) {
                for (int i = 0; i < path.corners.Length-1; i++) {
                Debug.DrawLine (path.corners [i], path.corners [i + 1], Color.red);
                }
            }
        }

    }

Please tell me way to debug/solve this issue. How unity calculates path between source and destination? Can there be possibly blockage in path? If yes then how? How path is invalid? Is there any bottleneck with the usage of CalculatePath function? Need guide from you guys... Thanks!

sentences:
Still players keep moving on the clients With UNET, despite Interpolation is set to None in the NetworkTransform, I've noticed that still players keep moving on the clients, very slowly, one pixel at a time.

Their position on the server is correct, and as soon as they move again, they warp to where they should actually be and go on. As soon as they stop, the slow horizontal movement often starts again.

This happens most often with yourself, and only sometimes to others. Sometimes you see yourself moving, while others will see you correctly, while some other times you also see others moving.

Googling around yielded no results, and other than disabling interpolation, which I already tried, I'm a bit clueless about what to do.

What could be causing this, and how could I fix it?

sentences:
How do I determine if a tiled shape is closed, but without checking diagonal connections? This is a follow-up to a similar question Determine if a set of tiles on a grid forms an enclosed shape.  My needs are similar, but I do not need to check diagonal connections.  I am also using Unity.

I’ve been in the process of trying to workout if a shape is closed.  I decided to use VB.net as my language of choice.

Red = walls
Light Blue = water
Black = Towers
Dark Blue = Fill

I’ve workout the code for filling the shape using the following website

lodev.org/cgtutor/floodfill.html

As far as I’m aware the graph formula is taken from here:

  Tarjan strongly connected components algorithm

I’ve seen versions that have a list of connecting nodes in a node.  The problem with that is not all sides could be connected (e.g. a node has four sides top, right, bottom, left edges these can have a connection to another node).

Although the list will only have a maximum of four connections the order could be all over, with a list depending on what order they where inserted (yes you could order them) it’s an overload that I wanted to mitigate if all possible then I though to make this easy on checking for connections each node could have four connection variables e.g. TopConnection, RightConnection, BottomConnection and LeftConnection, this would greatly simplify checking.

Please can you let me know if I’m on the correct track, if you still think the other ways is best please can you make it in layman’s terms or I’ll get lost before you start.

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:
XNA Subtract blending function doesn't work I wanted to subtract a white image with black circle background from a picture to get a lighting circle here is the white image

So I wrote this code

spriteBatch.Begin(SpriteSortMode.Deferred, new BlendState
{
      ColorBlendFunction = BlendFunction.Subtract,
      AlphaBlendFunction = BlendFunction.Subtract
});
//Draw the white image with black circle
spriteBatch.Draw(test, new Vector2(), Color.White);
spriteBatch.End();

I was aiming to get difference between it and the background image rendered

to get something like this

But the result that the first image is only drawn while second is below it

sentences:
Irregular oval collision detection I am using a physics library based on the Bullet physics engine. How do I create an egg shaped object or a cylinder where the width differs from the depth (i.e. with an oval shape)?

I'm not looking for code, but for a conceptual answer to help me understand this, or a useful approximation.

sentences:
cocos2d-x v2.1 CCSpeed, CCRepeatForever, and CCAnimation jerky at high speed I worked to port Tim Roadley's cocos2d-iphone example from (Box2D Driven Cocos2D Animation) to cocos2d-x to learn cocos2d-x for a project. It is all relatively simple to do, but I am suffering from one obstinate problem. When the ball speeds up, the animation gets very jerky. This problem does not exist in Tim's cocos2d example.

From my investigation and close watching of the animation, it skips frames at the end of the animation sequence when the speed is high (above 4 or 5 in my code).

Here is Tim's original code and some context:

// LOAD ANIMATION FRAMES FROM SPRITESHEET
NSMutableArray *rollFrames = [NSMutableArray array];
for(int i = 1; i <= 120; ++i) {
    [rollFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"Ball%i.png", i]]];
}

// CREATE ANIMATION ACTION
speedAction = [CCSpeed actionWithAction:
              [CCRepeatForever actionWithAction:
              [CCAnimate actionWithAnimation:
              [CCAnimation animationWithFrames:rollFrames delay:0.1]]] speed:3.5];

// CREATE BALL SPRITE
ball = [TRBox2D spriteWithSpriteFrameName:@"Ball1.png"];
[ball setPosition:ccp((screenSize.width/2), (screenSize.height/2))];
original = ball.position;  // used to determine ball trajectory
[ball runAction:speedAction];
[ball setTag:isTheBall];  // used so we can pick out this sprite during the physics loop
[ball setScale:0.7];

Here is my translation, again with some context:

// LOAD ANIMATION FRAMES FROM SPRITESHEET
CCArray *spriteFrames = CCArray::create();
for (int i = 1; i <= 120; i++) {
    std::stringstream spriteName;
    spriteName << "Ball" << i << ".png";

    CCSpriteFrame *spriteFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(spriteName.str().c_str());
    spriteFrames->addObject(spriteFrame);
}

CCAnimation *animation = CCAnimation::createWithSpriteFrames(spriteFrames, 0.1);
CCAnimate *animate = CCAnimate::create(animation);
CCRepeatForever *repeat = CCRepeatForever::create(animate);
speedAction = CCSpeed::create(repeat, 3.5f);

spriteFrames->release();

// CREATE BALL SPRITE
ball = (PhysicsSprite *)PhysicsSprite::createWithSpriteFrameName("Ball1.png");
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
ball->setPosition(ccp((screenSize.width/2), (screenSize.height/2)));
original = ball->getPosition();

ball->runAction(speedAction);

ball->setTag(1);
ball->setScale(0.7f);

Tim's example uses COCOS2D_VERSION==0x00010001 (v1.0.1)
I am using COCOS2D_VERSION==0x00020100 (v2.1.0)

I dug through the CCSpeed, CCRepeatForever, and CCAnimate. The major difference I find is in CCActionInterval.cpp where CCAnimate was changed to use "new animation format that supports delays per frame" (commit d0ab4515a4736bdf31aaed6394d95f8ea02beea1). If I revert this change to the previous "animation format" which does not support delays per frame, the sprite animates flawlessly at higher speeds.

Now to my question, am I mis-interpreting how the animation actions are intended to work in cocos2d-x 2.1? Have I missed something that is causing my jerky animation? It does not seem like changing some of the core code is the right answer, though bugs do exist.

sentences:
Why use Time.deltaTime in Lerping functions? To my understanding, a Lerp function interpolates between two values (a and b) using a third value (t) between 0 and 1. At t = 0, the value a is returned, at t = 1, the value b is returned. At 0.5 the value halfway between a and b is returned.

(The following picture is a smoothstep, usually a cubic interpolation)

I have been browsing the forums and on this answer I found the following line of code: transform.rotation = Quaternion.Slerp(transform.rotation, _lookRotation, Time.deltaTime);

I thought to myself, "what a fool, he has no idea" but since it had 40+ upvotes I gave it a try and sure enough, it worked!

float t = Time.deltaTime;
transform.rotation = Quaternion.Slerp(transform.rotation, toRotation, t);
Debug.Log(t);

I got random values between 0.01 and 0.02 for t. Shouldn't the function interpolate accordingly? Why do these values stack? What is it about lerp that I do not understand?

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:
Remove previous scenes from memory in Unity 3d I'm making a game in unity3d which I optimized as much as I can.

I've made different levels in each scene.

After a few scenes the game starts to lag on mobile devices. And works smoothly if application is restarted and game is continued from last scene .

How can I clear previously loaded scene in Unity3d or overcome the problem I mentioned above ?

sentences:
Transferring my OpenGL PC game to PS4 and/or XBox One I want to transfer my OpenGL PC game to consoles, PS4 and/or XBox One.

It's a complex application, where many calculations (incl. fast fourier transformations) via FBOs and Transformfeedback are performed within OpenGL. What is the best way to bring it to the PS4?

Or is it easier to implement the game in an engine like Unity or Unreal. As far as I know they have console support? An advantage would be that we could offer our methods as plugin/asset. We are planning to do this too.

There are a lot of glsl-shaders and OpenGL-Api-Calls. Is it possible at all to "translate" that into an engine like unreal? Or would we have to use the engines "predefined" rendnering mechanisms? We basically need shaders operating on floating point textures, changing render targets frequently and transform feedback if possible. We also need low level acces to shading attributes like changing pointsize in the vertex shader etc.

And I really would like to know which is less work. I could image that it is possible to absctract all the Api-Calls in classes/functions and then where first all the OpenGL-calls are implemted and then we would do an implemetation for the console api. Is this realistic on the PS4 Api?

I know that Direct X will have a different design and therefore abstraction itself won't be enough. I believe porting to an engine might be even more work as you have to respect its structures.

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:
QuadTree treeNode design question I'm a programming newbie.

I have a Quadtree. I created a TreeNode class that the Quadtree will use as nodes. I have spriteNode that inherits from TreeNode.

However, I also have several sprite types inheriting from a Sprite class that I use to instantiate specific sprites.

When I am creating spriteNodes for example I have to cast each specific sprite type to it's parent Sprite class. When I put spriteNode into the quadtree I have to cast the spriteNode to be of type TreeNode so I can generalize the quadtree as much as possible to take different types of data.

I'm not sure if this is a great way of storing all your sprite / map data inside a quadtree, because setting it up requires a lot of explicit casts (even though cast up a level are safe).

Is my OO design approach to storing sprite / map data inside the quadtree the correct way to handle a large quadtree of data? Or is there a better, more standard way of doing things?

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:
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:
Flash saves in Windows, not in Linux, FileReference.save() The code below compiles fine on the Flex 4 SDK on Fedora 15.  Mouse-click opens the dialog box, I click okay, and a file is saved, but the file is empty.  I run the same SWF file (that was compiled on the Linux machine) on a Windows machine, and the created file contains the expected data.

Then I broke the FileReference declaration out of the function into the class level, hoping to avoid a known bug and to keep a reference to the file alive outside the function.  However, the same problem persists.

Hoping to set up a workaround, I added the debug Flash player to my path and ran the file from Flash without the benefit of the browser, and it works.  So now a Flex problem has become a Firefox problem, maybe owing to a shady procedure I used to install the plugin without really understanding what was happening.  I am running Firefox 5.0.

In essence my workflow is fixed, but perhaps people who performed the above will not be able to use projects with FileReference.save()?  Should I be worried about this edge case?

/*
WriteTheFile.as
Original code by Brian Hodge
Test to see if ActionScript/Flash can write files
*/
package{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.utils.ByteArray;
    import flash.net.FileReference;

    public class WriteTheFile extends Sprite
    {
        private var _xml:String;
        private var fr:FileReference;

        public function WriteTheFile():void
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }

        private function init(e:Event = null):void
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            //Calling the save method requires user interaction and Flash Player 10
            stage.addEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown);
        }
        private function _onMouseDown(e:MouseEvent):void
        {
            fr = new FileReference()
            fr.save("<xml><test>data</test></xml>", "filename.txt");
        }
    }
}

EDIT: addressed answer in code above, but the same problem exists.

EDIT: This works on the same system when the standalone player is invoked.  Therefore this is a browser (FF 5.0) plugin problem.

sentences:
AS3 - Increase tint as health decreases I'm working on a game where enemies continually spawn with more and more health based on how long you've been playing. As the enemies take damage, I'd like their sprite to get darker and darker, until they die.

Here's what I've got so far:

    enemy_array[i].health -= damage;
    healthcolor.setTint(0x000000, enemy_array[i].health*0.1);
    enemy_array[i].transform.colorTransform = healthcolor;

Predictably, this is making enemies get less black as they take damage. What I need is to convert the decreasing enemies' health into an increasing number between 0 and 1.

I have absolutely no idea where to begin. It's entirely possible I have tunnel vision, but I'm hoping someone here might have an idea for how to accomplish this.

Thanks for your time.

sentences:
Shape editor with custom format? I'm trying to determine what format the shapes in my 2D game should be stored in and also what software I should use to aid in making the actual shapes.

Up until now I used PhysicsEditor from code'n'web, which saves shape information in XML format. The problem is that the way the file is layed out, it will require a lot of parsing to extract the actual information I'm interested in.

I've made my own "format" for storing shape information (see below). I used JSON instead of XML since it's a lot less verbose. Layed out like this, I require minimal parsing to get the actual information.

{
    "polygons":
    [
        {
            "density" : 1.2,
            "vertices": [
                [0.0, 8.9], [5.6, 7.8], [3.5, 0.0], [3.6, 9.9]
            ]
        }
    ]
}

My question:
Can I configure PhysicsEditor so that it saves shapes in this format automatically? If not, is there some software that allows that kind of configuration?

sentences:
Quaternions - how to limit axis? Is there any possibility to limit quaternions to move only in x & y axis (like in Eulers- yaw and pitch, without rolling)? I's there any equation or something similar to do this?
Some example:
Movement should behave like this: http://360.art.pl/experimental/1/
But when I build my player on quaternions it have no limits and I don't know how to fix it http://360.art.pl/experimental/2/

sentences:
unity Tilt Android Device player Freeze When Die I attached tilt script to my Player to move player x and y Axis. Player have Rigidbody2D and also IsKinematic=true. but the problem when the player can Die i want to stop tilting and player goes down to ground.
here is my tilt Code

public float Speed=20f;
 void Update () {
  if (PlayerControll.instance.isAlive) {
   transform.Translate (Input.acceleration.x * Speed * Time.deltaTime, Input.acceleration.y * Speed * Time.deltaTime, 0);
  } else {
   PlayerControll.instance.PlayerRigidbody.isKinematic = false;
  }

I try to do that using disable tilt script when Player die and Iskinematic=false but the problem is player can freeze to his position not goes down to the ground. I do that so many way but not done so what i do don't know then i post the Question. thanks in advance.

sentences:
Artefacts when drawing textures I am working on a level-based android game. The level is constructed of many blocks, all drawn with the same texture. Until now I didn't have any problems with drawing the different textures next to each other. However, when I draw a translucent rectangle over the level (in order to show a pause screen on top of it for example), I get artefacts on the places where the textures overlap. To be more clear I included a screenshot that clearly shows my issue: the regions where the textures of the different level blocks overlap do not have the same transparency as the rest of the rectangle.

As you can see, only when drawing the translucent rectangle on top of the level, the overlap is visible.

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:
Multiple Textures in Shader? I have this (pseudo) code:

unsigned int TextureLoc = glGetUniformLocation(programID, "objectTexture");
for(int i = 0; i < object->texturesCount; i++)
{
    glActivateTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, object->textures[i]->textureID);
    glUniform1i(TextureLoc, 0);
}

And Fragment Shader code:

in vec2 UV;
out vec3 color;
uniform sampler2D objectTexture;
void main()
{
    color = texture2D(objectTexture, UV).rgb;
}

My example is that of a house model that composes a single object, but the house walls are of Texture#1 and the roof is of Texture#2.

At first I coded that each object had it's own material/textures, but then I noticed it's a waste of memory if I'm using the same texture in multiple places, so now I have a list of objects and a list of textures.
An object can have n textures.

1. How can I get a "new" in GLSL for dynamic textures count? Some objects might have 1, some might have 10, etc... How can I control that?

2.  I have an array specifying which textureID each triangle in the object uses, but how can I use this information to properly draw the object? I send the array in the glEnableVertexAttribArray(int) function, but how can I know which texture I'm supposed to use when I'm in the shader code?

Another option I thought of was to divide all objects into smaller objects if they don't have the same texture, but I'm not sure what's the best approach to this.

sentences:
"Instantiate" function in Unity spawns enemy but it doesn't show up So, I'm making a top down shooter (2D) and I already made an enemy prefab. It walks to the player and damages it, and reacts to bullets physically until it eventually dies. The prefab itself is ok, because I can spawn it manually and it works as intended. The problem comes when I want to automate the spawn process with a script. So I made a script to do so, here it is:

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

public class GameController : MonoBehaviour
{

    public GameObject enemy;

    private float spawnPositionX;
    private float spawnPositionY;

    Vector2 spawnVector;

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

    void SpawnEnemy()
    {
        spawnPositionX = Random.Range(-630f, 630f);
        spawnPositionY = Random.Range(-340f, 340f);

        spawnVector = new Vector2(spawnPositionX, spawnPositionY);

        Instantiate(enemy, spawnVector, Quaternion.identity);
    }
}

As you can see, it's nothing too complex. I just refer to a game object (which I linked by the way) and then create some variables that will hold the x and y positions in which the enemy will spawn at random. Then when I call the function, those positions get set and stored into a bi-dimensional vector to then be used with the instantiate function.

This... works... kinda? When I run the game, the instance of the enemy gets made, I can see the clone in the hierarchy and I can select it and see that it's indeed moving, but it's like... not there? I can't actually see it on the screen and it's not invisible as I can't interact with it either. It's really weird and I have no idea what's going on.

I tried to put the script on the camera, on the canvas, on a new empty object, nothing. I also checked that the prefab and the instance that's being spawned are indeed active. I thought about the coordinates being out of bounds, but when I check my player coordinates they are inbounds, so that can't be it either. I'm completely lost on this one, thoughts? Thanks.

sentences: Can "dumbphones" play JavaScript games? Are JavaScript games exclusive to modern smartphones, or are older phone models also able to play games written in JavaScript?

sentences:
Why the rotation switching mode is not working right when using bools? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Objects : MonoBehaviour
{
    public float maxScale = 10.0f;
    public float minScale = 2.0f;
    public float shrinkSpeed = 1.0f;
    public float rotatingSpeed = 3f;
    public bool automaticScale = false;
    public bool rotateOnMouseMove = false;
    public bool rotateOnMouseDrag = true;

    private float targetScale;
    private Vector3 v3Scale;

    void Start()
    {
        v3Scale = transform.localScale;
    }

    void Update()
    {
        RaycastHit hit;
        Ray ray;

        if (Input.GetMouseButton(1))
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit) && hit.transform == transform)
            {
                targetScale = minScale;
                v3Scale = new Vector3(targetScale, targetScale, targetScale);
            }

            if (automaticScale == false)
                transform.localScale = Vector3.Lerp(transform.localScale, v3Scale, Time.deltaTime * shrinkSpeed);
        }

        if (Input.GetMouseButton(0))
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit) && hit.transform == transform)
            {
                targetScale = maxScale;
                v3Scale = new Vector3(targetScale, targetScale, targetScale);
            }

            if (automaticScale == false)
                transform.localScale = Vector3.Lerp(transform.localScale, v3Scale, Time.deltaTime * shrinkSpeed);
        }

        if (automaticScale == true)
        {
            transform.localScale = Vector3.Lerp(transform.localScale, v3Scale, Time.deltaTime * shrinkSpeed);
        }

        if (rotateOnMouseMove == true)
        {
            transform.Rotate(Input.GetAxis("Mouse Y") * rotatingSpeed, -Input.GetAxis("Mouse X") * rotatingSpeed, 0, Space.World);
        }

        if (rotateOnMouseMove == true)
        {
            rotateOnMouseDrag = false;
        }

        if (rotateOnMouseDrag == true)
        {
            rotateOnMouseMove = false;
        }
    }

    private void OnMouseDrag()
    {
        if (rotateOnMouseDrag == true)
        {
            transform.Rotate(Input.GetAxis("Mouse Y") * rotatingSpeed, -Input.GetAxis("Mouse X") * rotatingSpeed, 0, Space.World);
        }
    }
}

The problem is at the bottom:

if (rotateOnMouseMove == true)
            {
                rotateOnMouseDrag = false;
            }

            if (rotateOnMouseDrag == true)
            {
                rotateOnMouseMove = false;
            }

Once I'm starting the game by default the rotateOnMouseDrag is set to true.
When I click on the check box of rotateOnMoseMove it's switching between them the rotateOnMouseDrag is false and rotateOnMouseMove is true.

The problem is when then I click again on the check box of rotateOnMouseDrag but it's never switching between them again it keep staying true on the rotateOnMouseMove.

I want it to act like a switch each time one of them is true the other should be false.

sentences:
Move a sprite in a sine wave along different angles I understand this piece of code

Enemy.position.Y = StartPosition.Y + (-(float)Math.Cos(position.X / 100) * 100);

However it only works along the X axis. What I want to be able to do is move it along an arbitrary axis; Set an angle as the x axis.
How would I go about this?

sentences:
Fading in textures at a constant rate over a controlled duration I'm trying to fade textures onto the screen using SDL2.

I've tried some different methods I've looked up, but I always encounter the same problem. It seems that the fading takes longer and longer as Alpha gets higher and higher, meaning that the very end of the fade takes the longest amount of time, and thus the fade takes an unreasonably long amount of time. I want the image to fade in at the same rate, and not dramatically slow down when the image gets more and more opaque.

The code that was causing the issue described above has been deleted, and I'm working on an entirely new system to hopefully avoid the problem. However, it doesn't work at all. Any advice would be awesome!

My NEW code:

for (float alpha = 0; alpha <= SDL_ALPHA_OPAQUE; alpha += fadeSpeed * elapsedTime) {
        if (SDL_SetTextureAlphaMod(spriteTex, alpha) == -1) cout << "ERROR" << endl;
        SDL_RenderCopy(renderer, spriteTex, NULL, &destRect);
        math::present();
        cout << "ALPHA: " << alpha << endl;
    }

sentences:
How to wait until other script is ready? I have two scripts, first is AsteroidSpawner script that literally spawns object named Asteroid, and second is HUD that control all UI related stuffs.

There are some labels in UI, so I used onready to get those nodes:

extends CanvasLayer

class_name HUD

onready var asteroids_label = $Control/RightContainer/AsteroidCountLabel

func set_asteroids_label(value: float):
    asteroids_label.text = "Asteroids: " + str(value)
    pass

However, when I try to access HUD script, with setasteroidlabel, it gives me null error:

var spawned_asteroids: Array = []
onready var hud: HUD = get_tree().get_root().find_node("HUD", true, false)

func _ready():
    spawn_asteroids()

func spawn_asteroids():
    ... spawn asteroid ...

    spawned_asteroids.push_back(asteroid_instance)

    hud.set_asteroids_label(spawned_asteroids.size()) # UPDATE HUD

  Invalid set index 'text' (on base: 'Nil') with value of type 'String'

I guess that HUD is not ready, but AsteroidSpawner script try to accessing it, wasn't it? Then how should I wait until HUD is loaded?

sentences:
Why Do Textures Appear Black In OpenGL 4.5 In Windows? I usually code in Linux, and when I ran my OpenGL program the textures displayed correctly. However, when I ran it on Windows the textures appeared black until I used old OpenGL for the textures. Is there anything wrong in the code that creates the texture?

        int[] pixels = null;
    try {
        BufferedImage image = ImageIO.read(getClass().getResourceAsStream("/" + path));
        width = image.getWidth();
        height = image.getHeight();
        pixels = new int[width * height];
        image.getRGB(0, 0, width, height, pixels, 0, width);
    } catch (IOException e) {
        e.printStackTrace();
    }

    int[] data = new int[width * height];
    for (int i = 0; i < width * height; i++) {
        int a = (pixels[i] & 0xff000000) >> 24;
        int r = (pixels[i] & 0xff0000) >> 16;
        int g = (pixels[i] & 0xff00) >> 8;
        int b = (pixels[i] & 0xff);

        data[i] = a << 24 | b << 16 | g << 8 | r;
    }

    textureID = GL45.glCreateTextures(GL11.GL_TEXTURE_2D);
    GL45.glBindTextureUnit(0, textureID);
    GL45.glTextureStorage2D(textureID, 1, GL11.GL_RGBA, width, height);
    GL45.glTextureParameteri(textureID, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    GL45.glTextureParameteri(textureID, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    GL45.glTextureSubImage2D(textureID, 0, width, 0, 0, height, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, data);
    GL45.glBindTextureUnit(0, 0);

EDIT: The answer was very simple. I had forgotten to do GL11.GL_RGBA8 instead of just GL11.GL_RGBA when doing GL45.glTextureStorage2D. This threw a GL_INVALID_ENUM error which caused glTextureSubImage to not store anything, causing the texture to be black. It was strange that this problem did not occur on Linux, though.

I will leave this problem open, as some commenters have pointed out that there is something majorly wrong with how I use the new DSA features.

sentences:
Updating object positions after screen moves. Is there a better way? I am making a top down 2D shooter using SDL2 for fun and I ran into a problem. I have a whole list of enemies each with their position on the screen stored in an array. Now you only see a portion of the map on your screen, because the whole map is too large. I want to have the player be able to move around the map, in which case I have to update the position of all the enemies. The same goes for projectiles and buildings. So I would have to loop over each of these every time the screen moves. I thought that a smarter way may be possible where you keep track of the entire map for each frame and when you render it you zoom in on only the part you need. That way you only have to keep track of one position vector, for instance the point on the map at which you want your screen to be centered. How is this problem normally tackled?

I realize that both methods will take some time, but seeing as the map is not THAT large, maybe 6x the screen, I thought it might be worthwhile. The problem is then that I am rendering the textures using  SDL_RenderCopyEx and then displaying them with SDL_RenderPresent, and I don't think you can zoom in like that.

sentences:
SDL: Certain bitmap not displaying I have come across a very wierd problem. Here is my code:

#include <iostream>
#include "SDL.h"

using namespace std;

class MyGame
{
public:

    SDL_Surface* image;
    SDL_Surface* window;
    SDL_Event* e;

    void Start()
    {
        SDL_Init(SDL_INIT_EVERYTHING);

        window = SDL_SetVideoMode(800,600,32,SDL_SWSURFACE);

        image = SDL_LoadBMP("Bitmap.bmp");
        SDL_BlitSurface(image,NULL,window,NULL);
        SDL_FreeSurface(image);

        SDL_Event evt;

        bool programrunning = true;
        while(programrunning)
        {
            SDL_WaitEvent(&evt);
            if(evt.type == SDL_QUIT) programrunning = false;
        }

        SDL_Quit();
    }

    void Update()
    {
        SDL_Flip(window);
    }
};

int main(int argc,char* args[])
{
    MyGame obj;
    obj.Start();
    while(true)
    {
        obj.Update();
    }

    return 0;
}

Whenever I run this code on Code::Blocks, no errors appear and everything works except for the bitmap. For some reason it doesn't display. However, I once tried replacing Bitmap.bmp with cb.bmp (the Code::Blocks logo that came with the IDE) and it rendered perfectly fine. Also, whenever I close the program Windows gives me this error: "2DGame.exe not responding", no matter what bitmap I use. This is one of the strangest coding problems I have come across ever, please tell me why Bitmap.bmp is being a jerk and how to fix it and also how to fix the error I get whenever I close my program. Thanks!

P.S: You guys asked for the image, here it is:

sentences:
Rendering fancy particles? I'm making a tower-defense game for Windows (not phone) in XNA.

I've seen this video of another tower-defense game for Windows Phone that uses particle effects, which I really like. They change color, glow and density as they move away from the explosion. Really cool stuff!

http://www.youtube.com/watch?v=YhPr4A4LRPQ&hd=1

I would like a similar result (particle-wise) to the stuff in the video, however, I don't know where to start. I suppose I need to do linelist hardware instancing to achieve the result, and then update every particle position on the CPU.

Or is there a better alternative? Post your suggestions. That'd be great, thanks.

Edit It's the explosion particle effect that I want to implement. Not the particle effects that the projectiles leave when they fire.

sentences:
Accelerating Missile guidence Background
I'm building a simple game where two ships are launching missiles at each other in space.
Stuff got complicated when the ships started moving in a frictionless environment and the missiles naturally needed to do the same thing.
Premises

A missile has a constant acceleration and is trying to hit a moving target in a frictionless environment.
Target is also constantly accelerating in the same frictionless environment.
The frictionless environment is only 2 dimensional
There is no gravitation affecting the missile

Question
What math should I use to determine the direction the missile should jolt in?
What i have right now
I've implemented this answer which works quite alright. I am not 100% sure of what a, b, c etc means and not sure which math is actually implemented here.
I modified above linked answer by making the missile mimmic its targets jolts and adding its own on top of those. It is an ugly solution to say the least.
Problem with current solution
The current solution requires to know the speed of the missile.
The missile is constantly accelerating, and it has no top speed.
Unless I know how far the missile will travel, I cannot know the average speed.
Above solution requires that I know the speed of the projectile.

sentences:
How to get the complete width of SKSpriteNode which has many child nodes I have a Sprite node with many 6 child nodes. Each are placed one after another in X-axis.
I want to know the complete with of the Sksprite node.

SKSpriteNode *array = [SKSpriteNode node];

[array addChild:box1];
[array addChild:box2];
[array addChild:box3];
[array addChild:box4];
[array addChild:box5];
[array addChild:box6];

array.size.width dosen't get me any size, so how should i get the complete width of array with child nodes..

If i add multiple sprites to NSMutalbleArray then how can i get the width of the complete array.

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:
one time rotation Unity How do I rotate the object only once after a key press. So after it rotates say 10 degrees upwards, the user can't rotate it anymore.

this is my code which as continuous rotation -:

   void Update(){
 if (Input.GetKey(KeyCode.J))
     transform.Rotate(0, 0, 3f);
  }

sentences:
Restrict Trajectory on Z axis I have a cube which I select on mouse and point out the location to throw the cube with trajectory dots.

The code is working fine, but I need to restrict the trajectory dots position on z axis so the user could not be able to throw it towards z axis.

Here is my code

   if (cubePlane.Raycast(camRay, out enter))
            {
                cubeisClicked2 = true;
                fingerPosition = camRay.GetPoint(enter);

                cubeFingerDiff = cubePosition - fingerPosition;
                ShotForce = new Vector3(cubeFingerDiff.x * shootingPowerX, cubeFingerDiff.y * shootingPowerY, 0);
                if (cubeFingerDiff.magnitude > 0.4f)
                {
                    trajectoryDots.SetActive(true);

                }
                else
                {
                    trajectoryDots.SetActive(false);
                }

                for (int dotNumber = 0; dotNumber < NumberOfDots; dotNumber++)
                {
                    x1 = cubePosition.x + ShotForce.x * Time.fixedDeltaTime * (DotSeparation * dotNumber * dotShift);
                    y1 = cubePosition.y + ShotForce.y * Time.fixedDeltaTime * (DotSeparation * dotNumber * dotShift) + (Physics.gravity.y / 2f * Time.fixedDeltaTime * Time.fixedDeltaTime * (DotSeparation * dotNumber + dotShift) * (DotSeparation * dotNumber + dotShift));
                    z1 = cubePosition.z + ShotForce.z * Time.fixedDeltaTime * (DotSeparation * dotNumber * dotShift);
                    Dots[dotNumber].transform.position = new Vector3(x1, y1, 0f);
                }
            }
        }

I set the z axis to zero every where but still able point towards z axis.

Note: It is 3D game not 2D

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:
Making an organized rendering class I'm using LWJGL (opeengl wrapper for Java) and Don't know how to make a renderer class for OpenGL. So In Immediate mode rendering I'd do a method like this to draw quadralaterals.

public static void drawQuad(int x, int y, int width, int height) {
    glBegin(GL_QUADS);
    glVertex2f(x, y);
    glVertex2f(x + width, y);
    glVertex2f(x + width, y + height);
    glVertex2f(x, y + height);
    glEnd();
}

Now that I want to use OpenGL 3+ , how can I organize code like this into a static rendering class I can call methods like Renderer.drawRect(x,y, width, height);? Or if I can make something like a spriteBatch class.

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:
How can I run two CCActions in parallel and another one afterwards with Cocos2D? With Cocos2D I can run two actions in parallel by simply using runAction and I can use a CCSequence two run several actions after each other.
However what I could not find is:

Run two actions simultaneously
When both actions are done, trigger a third CCAction

It must be really easy but I seem to use the wrong search keywords on Google. :-)

The only possible solution I have found so far is to use a delayed action as the first element of a CCSequence and then start the third action. But it "feels" wrong.

sentences:
Making a parent system with euler angles (gimbal lock problem) I have a system where objects can be connected to each other - as the parent rotates the child objects will rotate too and child objects themself can rotate too. The system is already working, however, I am doing it with rotation matrices.
I want to dynamically simulate angular physics and for that, I would need the angular velocity for which I thought the direct and easiest way would be to get the difference of the euler angles.
I am still a beginner with those rotation maths like matrices, quaternions etc.
The problem is that the rotation of the children would be local and currently I am just adding the euler angle values (which works fine if I only rotate around one axis). So when I rotate a child on the x axis by 90 degrees and then rotate the parent on the y or z axis the system breaks (y and z should be swapped in this scenario with 90 degrees x rotation)
As far as I have understood it the problem could be explained with "gimbal lock".
Is there a way to calculate the local euler angles? Or is there in general a better way to achieve what I am trying to do here? I have heard that quaternions also don't save 360+ degrees, so that would be also a problem for angular velocity.

sentences:
Problem restoring the game preffered buffer size after navigating from a XAML page. Monogame I have implemented to my game a simple leaderboard and submit score pages, which are pages in XAML. I used PreferredBackBufferHeight/Width to set the buffer to be equaly on all devices, whether their screen size is 5 inch, 4.7 or whatever size. Though I thought the problem was solved, now, when I was testing my game on emulator for bigger devices, I encountered a problem when returning back to game page from the xaml page. Let me show you some pics, and you will understand what I am talking about:

Testing on Emulator 4.7 inch:

1) Before entering the leaderboard xaml page (everything normal):

2) After exiting from xaml leaderboard page:

Even if I tried to put the PreferredBackBufferHeight/Width in the function that I call to exit from the leaderboard page, it didn't change anything... :

private void NavigateBackToMain()
    {
        var app = App.Current as App;

        if (app.GamePage == null) app.GamePage = new GamePage(string.Empty);
        Game1.statics.graphics.SupportedOrientations = Microsoft.Xna.Framework.DisplayOrientation.LandscapeRight | Microsoft.Xna.Framework.DisplayOrientation.LandscapeLeft;
        Game1.statics.graphics.PreferredBackBufferHeight = Constants.PrefferedBufferHeight;
        Game1.statics.graphics.PreferredBackBufferWidth = Constants.PrefferedBufferWidth;

        Window.Current.Content = app.GamePage;
    }

What can I do about my problem?

sentences:
CCUserDefault, iOS/Android and game updates My game uses cocos2d-x and will be published on iOS platform first, later on Android. I save a lot of things with CCUserDefault (scores, which level was completed, number of coins taken, etc...). But now I have a big doubt.

What will happen when the game will receive its first update?

CCUserDefault uses an XML file stored somewhere in the app storage space. This file is created and retained until one uninstalls the app. I am wondering what happens when the app is updated. Will the old XML file be maintained?

Because if not, how should I handle app updates (updates in the sense that 2, 3 or more new level packages will be added, but the informations about the old ones, like scores, which level was finished and which not, number of coins, etc., need absolutely not to be lost)?

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:
Unity UV map, tint / change color of texture I have an array of vertices with texture coordinates for a UV map in Unity:

newUV.Add(new Vector2 (0, 1)); // FACE 1
newUV.Add(new Vector2 (1, 1));
newUV.Add(new Vector2 (1, 0));
newUV.Add(new Vector2 (0, 0));

newUV.Add(new Vector2 (0, 1)); // FACE 2
newUV.Add(new Vector2 (1, 1));
newUV.Add(new Vector2 (1, 0));
newUV.Add(new Vector2 (0, 0));

mesh.uv = newUV.ToArray();

It textures my mesh just fine.

How could I go around tinting FACE 1 to a darker color? Let's say the texture is just plain green and I wanted to texture only on FACE 1 to be a darker shade of green.

sentences:
Moving the bulk of a recursive ray tracer function to the gpu, using DirectX12 not DirectX 12 DXR HLSL So I'm wanting to generate images by ray tracing. I've done so, but the main ray function is recursive. I know one can make a non recursive function out of a recursive function using a stack, but is it possible to do in HLSL? I have the bulk of the function I'm using here:
color ray_color(
    const ray& r,
    const color& background,
    const hittable& world,
    const shared_ptr<hittable>& lights,
    int depth) {

hit_record rec;

// If we've exceeded the ray bounce limit, no more light is gathered.
if (depth <= 0)
    return color(0, 0, 0);

// If the ray hits nothing, return the background color.
if (!world.hit(r, 0.001, infinity, rec))
    return background;

scatter_record srec;
color emitted = rec.mat_ptr->emitted(r, rec, rec.u, rec.v, rec.p);

if (!rec.mat_ptr->scatter(r, rec, srec))
    return emitted;

if (srec.is_specular) {
    return srec.attenuation
        * ray_color(srec.specular_ray, background, world, lights, depth - 1);
}

auto light_ptr = make_shared<hittable_pdf>(lights, rec.p);
mixture_pdf p(light_ptr, srec.pdf_ptr);
ray scattered = ray(rec.p, p.generate(), r.time());
auto pdf_val = p.value(scattered.direction());

return emitted
    + srec.attenuation * rec.mat_ptr->scattering_pdf(r, rec, scattered)
    * ray_color(scattered, background, world, lights, depth - 1)
    / pdf_val;
}

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:
Does libGDX support the Xbox One controller? I just bought a Xbox one controller and i'd like to test my game with it. I use the Controllers extension from libGDX and it works fine, at least with my PS3 controller.

I get some weird results when i'm polling the axis of the controller with libGDX. The values are ok for Y axies but not for X ones. I mean, for X axis, values are really weird, sometimes, when the stick is fully pushed to the left, the value is not even negative, same goes for the right, sometimes value is negative. I don't know why but values seems inconsistent for X axies, Y axies work fine.

Concerning buttons, they are all detected except for the dpad.

I am using the drivers available here. I tested the controller with several games, it works fine so i think it's related to libGDX.

Do you think the Xbox One controller is not supported yet? Can it be a driver issue? Should I use another way to poll controller states? If yes, is there a good and up to date library to do so?

Thanks.

sentences:
Using of opengl buffers Newbie question, and sorry for my English. Suppose that we create a lot of GL_ARRAY_BUFFER buffers, fill them with some data. But only few of them we link with shader variables. During glDraw..., what happens with other non-linked buffers? Do they go to the pipeline as well as linked buffers?

I hear but can misunderstood, that all buffers linked to the current VAO will go to the pipeline
in any case, if they are involved in the shader or not. I hope this is wrong.

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:
Sprites are sometimes blurry in Flash I am playing around with drawing an SVG sprite (imported in through [Embed]). Depending on the coordinates of the image, sometimes it appears more crisp than others.

The following image shows how at different locations is it rendered differently:

(Image link - You may have to download and zoom in with an image editor to see it)

You'll notice that the middle sprite is more blurry than the ones on the sides. Does anyone know why this is? Any help would be appreciated.

sentences:
XNA Vertex buffer/Index buffer high memory usage? I've got about 120mb of vertex and indices data, but when I set the data in the vertex and indices buffer it ramps up to about 300mb of memory used, this isn't really acceptable and I don't know why it is, my code to set them is:

        vertex_buffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, chunk_vertices.Count, BufferUsage.WriteOnly);
        vertex_buffer.SetData(chunk_vertices.ToArray());
        index_buffer = new IndexBuffer(device, IndexElementSize.ThirtyTwoBits, chunk_indices.Count, BufferUsage.WriteOnly);
        index_buffer.SetData(chunk_indices.ToArray());

sentences:
Matrix stack from direction vector chain I've implemented an IK system for a grabber arm based on several straight segments, starting from a fixed point. The IK is based on a mass-spring simulation, which eventually rests. What I'm left with is an array of positions in world space, one for each joint position, and an extra one at the end.

I need to convert these world positions into one quaternion rotation for each joint, so that I can build a hierarchy of transformation matrices (I'm using quaternion for the rotation part). each segment of the arm is an instance of a segment model that I want to translate into world space. The hierarchy works by inheriting previous rotations and translations. The issue I'm facing is describing each progressive joint rotation relative to the previous rotations (rather than relative to the world).

So far my approach is:

Initially the grabber arm point upwards, so the root rotation is described as the orientation difference from the vector (0, 1, 0) - (I'm using GL coordinates).

Keep the direction vector of the previous joint, prevDir, initially (0, 1, 0).
Keep a quaternion of the accumulated rotations, rotChain, initially the identity quaternion.
From root to tip, for each joint:

Take the next joint position and subtract the current position and normalize, to get a direction vector dir. This is why there's an extra point in the array, for the last joint
Compute the cross product between prevDir and dir, which should give a world rotation axis side, between the previous and current joint. Also compute the dot product, dot.
Rotate the side vector by rotChain, to bring it into the current joint's orientation.
Create a quaternion rot on the axis side and rotation acos(dot). This should represent the rotation of the current joint relative to the previous one.
Post-multiply rot onto rotChain, to add the effect of the current rotation.
Update prevDir to dir.

This only works as long as all the segments are on the YZ plane, which I think is a fluke. What am I doing wrong?

I'm only using quaternions as I'm trying to invert rotations easily.
As per this answer, I get the sense I could instead directly derive an orientation matrix from dir and side. Would this work better?

sentences:
Developing a card game framework What sort of design patterns and ideas might one use to build a somewhat general purpose card game framework?

This stems from I made an attempt to build a clone of the popular Steve Jackson game "Munchkin".  Because of the nature of that game I ended having to hard code so many card functionalities that the development became chaotic and over-bearing.  I had wanted to build something general but ended up with just to many classes with to many overridden functions and switch statements to determine behavior.

I was curious what someone with more experience in design would handle such a task of building a general purpose card game framework, or at least something that could be extended.  Or is it best that if I want to make a simulation of a card game like Munchkin, i'm stuck making a specific framework.

I would like to use C#.

EDIT

I would like to clarify somewhat of what i'd eventually like to achieve.  I'd like a framework where I can basically implement phases with custom functionality (phase 1: draw cards, phase 2: apply upkeep rules, phase 3: play cards, phase 4: resolve, etc).

I think then defining a ruleset would be wise which would be coupled with both the cards and the phases.

Then, the cards would be defined and I suppose tied to the rules so for instance a rule might be "During upkeep phase, lose 1 token".  However, a card that the player has might provide "Don't lose any tokens during the upkeep phase".  So it would be nice to be able to tie this together but within the guts of the framework.

I suppose this might be way out of my league as well.

sentences:
Issue with fps limiting in XNA The game I am making runs at 60 fps, but occasionally it will drop lower than that. I want to limit the frame-rate to 30 fps so that those drops will be less noticeable.

I don't understand everything about this, so bear with me.
Here is what I have in the Initialize method:

IsFixedTimeStep = true;
TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0f);

All this is doing is making the game run in slow-motion.
What am I doing wrong?

Edit: I would like Update to be called the same number of times per second, but for Draw to be called only 30 times per second, instead of 60. How could this be accomplished?

sentences:
Deferred shading - g-buffer positions, world or view space? So, i am doing this for the first time. I have a lodded terrain that i would like shade deferred. I have built the g-buffer with positions/normals/albedo/depth and render vertices like  I did before with forward rendering. World positions are calculated in the vertex shader from offsetting and scaling nodes (CDLOD after P. Strugar). I pass on world positions multiplied with  view-projection-matrix and after rednring the position texture looks like this:

For reference, the normals are like this:

All textures are RGB 16bit floats. The normals look all right. In positions, just like one would expect the quadrants move with the camera movement, the cross staying in the center. I have not yet started with the lighting pass, so my question is: does this look right ? I expected smoother transitions and not really white. Or should i use world positions (then everything is white in the position texture) and divide by world size to stay in clamped 0..1 land ?
Again, I haven't changed the vertex shader from forward rendering, and the fragment is trivially rendering to the g-buffer.

sentences: How to implement Long Polling with PHP and flash? I'm trying to make a multiplayer game but am a newbie to server side programming except that I know a little PHP. I learnt about this technique called long polling where the server can wait for fresh data to be available and then send it. How does one do long polling using PHP? Are there any libraries available. I'm already using ZendAMF, so how do I make zendamf and long-polling to co-exist?

sentences:
How to improve load times of audio files without loosing too much quality for HTML5 game? I'm creating an HTML5 game. We have high fidelity composed music, in the format of wavs and mp3s— some ogg. Game engine we are using is melon JS.

The wav files are generally 3x time size of mp3s, but even loading the mp3s is by far the slowest asset to load on the web game.

I've tried compressing file mp3s at http://www.mp3smaller.com/, @ mp3 Bitrate 32Kbps which resulted in 89% reduction in file size. This significantly improves load time of the game, but it's as though we lost 89% of the quality.

Any recommendations for lossless (or close to) compression services/techniques with significant file downsize but little quality loss?

In images, I know we can take a .png and save as .jpg at lower fidelity, saving about 70-80% in space...but to the eye, it's impossible to tell.

sentences:
Can a Game Engine be built into a Game Engine? This confuses me as the title says "Mostly Civilized: A Hex-Based 4x Game Engine for Unity - Part 1"

Unity is a Game Engine, and he is building a game engine for a game engine.

Did he word this incorrectly, or is building a game engine into a game engine a real thing?

sentences:
From look-at vectors to a quaternion So, I have code to create a quaternion from a matrix (using the 3x3 rotational part.)

And I have code to construct a transformation matrix from a lookat + up vector pair.

To go from lookat+up to quaternion, I can thus go via the matrix intermediary:

vec3 lookat;
vec3 up;
...
mat44 trf = mat44::create_basis( lookup, up );
quat ori = quat::from_matrix( trf );

So far, so good.

But can I do this without the matrix intermediary?
Because it seems to inefficient. For starters, both the lookat+up and the quaternion are a lot more concise than the intermediate matrix. It goes from compact to large, to the most compact.

How can I create a quaternion using just a look-at vector and an up-vector, both of which are guaranteed to be unit length and perpendicular to each other.

sentences:
Generate race track using freeform curves I am trying to generate a race track in Vertex Shader(constraint) and only using B-Spline/Bezier/Hermite curves. My problem is that when i try to widen the obtained curve by translating another instance of it (lets say translate the x value), at certain turns, the road gets thinner.

As input, i can only have a certain number of control points/knots with which to generate a 2-degree closed(start point = end point) curve B-spline.
The closed curve (translated on Z) is shown in the picture attached. The camera is positioned right above it. Every vertex from the curve has Y = 0, seeing how the track is flat without any height(no perspective view).

Is there any possible way to keep the road's width on all its sections?

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:
Point Sprites vs Textured Quads in Open GLES 2.0 I'm wondering what would perform better, point sprites (GL_POINTS) or regular sprites (GL_TRIANGLES).  Here's the scenario:

I am developing a simple particle system to allow me to produce various effects like fire (in a very simple way).  Each particle will be rendered using a texture, but the rub is I want different textures depending on the "age" of the particle (imagine a fire particle transitioning from a "burning" style texture to a "smoke" style texture).

As I understand it if I use point sprites I would have to bind different textures during the lifetime of the particle set based on the age of the various particles still alive.  That is, as many texture bind operations as there are "stages" for a particle (at most).

Conversely if I use regular sprites I can do a single bind of an atlas then just render away.

I'd also "like" to be able to rotate the particles, but that's probably not a deal breaker if the performance gain for point sprites is significant.  I would definitely want to scale, but I'm assuming I can do that by changing the point size... not sure what the max is for that.

My sense is that a few additional texture bind operations is going to have less of a performance impact than drawing 4 times the number of vertices (4 verts per sprite vs 1 per point).  Of course there'd also be an additional sort operation in the point sprite approach so I can batch up the particles with the same texture, but again that shouldn't be too heavy if there are only 3-4 states per particle.

I'm developing for mobile (Android/iOS) so chipset will vary (not sure how much impact that will have on the decision).

Now the "right" thing to do would be to implement both and test, but that sounds like way too much hard work ;)

Would I be correct in assuming point sprites are still the better approach?

sentences: Is the Key Bindings delay unavoidable in Java when pressing different directional keys quickly? I've read just about every tutorial I can on why to use Key Bindings instead of implementing the KeyListener interface, including all the examples that show using a field to track the key event because of the repeating delay when holding down the same key. No matter what I do though I simply can't get past a keyboard delay when alternating quickly between directions (i.e. - 'W','D','S','A'). I've read some comments that state this is very dependent on your keyboard OS settings, and in some cases is just unavoidable. Some of the registry editing suggestions for keyboard speed seem to indicate there is some truth in that. Is there a posted solution somewhere that guarantees a "hardware independent" Java solution for handling quick key presses without delay?

sentences:
Get a camera's frame-buffer in Unity Is there a way to "record" the display of a camera instead of rendering it on screen?

For example, if I want to stream a camera's frame block to an external application.

sentences:
Calculating transform of arrow model pointing at some point in 3D space I'm working on a 3D flight game and I'd like to implement a simple "navigation arrow" pointing at the next waypoint in world which the player has to fly to.

I have position of both airplane (=camera) and the target and also orientation of the airplane (in form of quaternion). But sadly I can't figure out correct way to use them to get the arrow pointing at the target regardless the airplane yaw/pitch/roll.

The arrow was already working once, but only when the airplane was in horizontal orientation. But when the airplane was tilted, the tilt was not reflected in the arrow transform.

Here's my code (it might not be accurate, as I'm desperately trying anything that could help) to get the arrow rotation

Vector3 target = ...;
target.subtract(airplane.position);
target.normalize();

Vector3 dir = new Vector3(0, 0, -1); // initial airplane direction
dir.rotateBy(airplaneQuat); // current airplane direction

double angle = Math.acos(target.dot(dir));
Vector3 axis = target.cross(dir);

I think my problem is the fact that the airplane can fly upside down and in other riddiculous orientations, and I just cannot visualize all the transforms in my head.
I'll be happy for any help.

UPDATE:
Based on Cong's answer I came up with working solution. Here's the pseudocode. It could be improved, but the arrow behaves sufficiently accurate by now, just the way I indended.

Vector3 dir = target.position;
dir.subtract(airplane.position);
dir.normalize();

Quaternion q = airplane.orientation;
q = q.conjugate();
dir.rotateBy(q);

Vector3 up = Vector3(0, 1, 0);
Matrix4 mat = Matrix4.createLookAt(dir, up);

Matrix4 transform = Matrix4(); // identity
transform.translate(0, -0.85, 0); // move to the bottom of the screen
transform.mul(mat);
transform.scale(0.2); // just scaling the model

sentences:
How can I simulate limited AI vocabulary for a word game? I've got a small handful of competitive word games in progress, and while the preference is for (mostly asynchronous) play against other human opponents, I'd like to provide players the option of playing against an AI.  I have my dictionary and I can easily give the AI full dictionary knowledge while it's playing, but my concern is that having the AI regularly playing words they're not familiar with will be a frustrating experience for players: 'I would have won that game if it'd just used words I know!' — even if the AI's overall skill level is turned down.

I'd rather create a weaker AI through a combination of (un)tuned play parameters and a weaker vocabulary — but I'm not sure how to limit that vocabulary to 'common' words.  I've looked at several word frequency lists (for instance, the list of all words that appear in the Project Gutenberg books, sorted by number of occurences) but they all have a number of false negatives: words that everyone knows that simply don't show up with any real frequency (for instance, CHEETAH shows up less frequently in the PG texts than VOCATIVE or SUTTEE).  I've tried using search results to get estimates of a word's popularity, but they also tend to be prone to spurious mis-estimates, and of course it's hard to get search results for an entire dictionary without running afoul of the terms of service on the search engines.

Does anyone have suggestions on other good means of determining a rough frequency of word usage, or other ways of limiting word game AI that will feel natural to players?

sentences:
Is it possible to create sqlite database only for android in LIBGDX game? I want to know if I can just implement sqlite database for android in libgdx game?
Also if this is not possible then may I know the simple way to integrate libgdx game to just store scores in sqlite database.
I dont want to use preference or jason because I have to get last stored scores and then level wise comparison of scores.

sentences:
What is the standard practice for animating motion -- move character or not move character? I've downloaded a bunch of (free) 3d warriors with animations. I've noticed for about 25% of them, the 'run' animation physically moves the character forward in the z direction. For the other 75%, the animation just loops with the characters feet moving etc., but does so in place, without changing the character's physical location.
I could fix this by:
1.) Manually updating the transform in code for this 75%, to physically move the character
2.) Alter the animation by re-recording it, with a positive z value at the end (when I did this it caused the character to shift really far away the rest of the units, probably something to do with local space vs world space I haven't figured out yet).
But before I go too far down this rabbit hole, I wonder if there is any kind of standard? In the general case, are 'run' / 'walk' animations supposed to move the character themselves, or is it up to the coder to manually update the transform while the legs move and arms swing in place? Is one approach objectively better than the other, or maybe it depends on the use case? If so, what are the drawbacks of each? I know nothing about animation, so I don't want to break convention (if there is one).

sentences:
Deferred Rendering: Orthographic directional light that has position Basically I need to code a light for deferred rendering that is a cross between a spotlight and a directional (positionless) light.  It's to be used for sunlight, but because my terrain has overhangs and multiple layers, I can't use a directional light for the sun, as those affect everything in the scene, and do not cast shadows.

I would also prefer that the light uses a full screen pass like directional lights use, rather than rending the light using a cone geometry like spot lights do.

Does anyone have an example of something like this?  I've found a few resources but nothing that clearly shows how to code it up.  Language is irrelevant, but I would prefer C#.  Anything would be great though.

sentences:
How to move an object from off screen right to left continuously? I am trying to make an object move from off screen on the right to off screen left and continuously generate (like the flappy bird pipes). How would I do this with my current code below? I have tried creating a class like I did with the "ball" class but I can't seem to get it to work... Any examples or help would be appreciated. (I am very inexperienced in game development and java so please bear with me). This is my current code, I have the ball that jumps in the air and now want to make the spike move from off screen right to off screen left and generate another "spike" each time. I have drawn the spike which at the moment is just a texture that does not do anything. Thanks.

class Ball {

public static final float GRAVITY = -500;
public static final float BOUNCE_DAMPENING = 0.0f;

public final Vector2 position = new Vector2();
public final Vector2 velocity = new Vector2();
public final Vector2 acceleration = new Vector2(0, GRAVITY);

public void update (){

 float deltaTime = Gdx.graphics.getDeltaTime();
    velocity.add(acceleration.x * deltaTime, acceleration.y * deltaTime);
    position.add(velocity.x * deltaTime, velocity.y * deltaTime);

    if (position.y <0){
        position.y = -position.y * BOUNCE_DAMPENING;
        velocity.y = -velocity.y * BOUNCE_DAMPENING;
    }
}
}

public class MyGdxGame extends ApplicationAdapter {
SpriteBatch batch;
Texture background;
Texture ballTexture;
Ball ball;
Texture spikeTexture;

@Override
public void create () {
    batch = new SpriteBatch();
    background = new Texture("gamebackground.png");

    ballTexture = new Texture("ball2.png");
    ballTexture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

    ball = new Ball();

    spikeTexture = new Texture("spike2.png");

}

@Override
public void render () {

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if (Gdx.input.justTouched())
            ball.velocity.y += 350;
        ball.update();

    batch.begin();
        float scaleFactor = 2.0f;
        batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        batch.draw(ballTexture, ball.position.x, ball.position.y, ballTexture.getWidth() * scaleFactor, ballTexture.getHeight() * scaleFactor);

        batch.draw(spikeTexture, 80,-260, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);

        batch.end();

}

@Override
public void dispose () {

    batch.dispose();
    background.dispose();
    ballTexture.dispose();

}

}

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:
How can I draw a model with a color on WP7? How can I draw a model with a color (and still be aware of the lighting)?

This is really straight forward when you can use shaders, but on Windows Phone you can't.

sentences:
Effective solution for showing the outline of the player sprite when behind objects or tiles that are meant to be in foreground I'm very new to Unity and I'm now experimenting with possible ways to show the player outline when he/she is behind objects or tiles. This is what I came up with:
My setup

Built-in rendering pipeline
Renderers sorted using based on Order in Layer. All the Tilemaps and the Player are at the same Z
Transparency Custom Axis: (0, 1, 0). (All default sprite shaders are in the same Transparent Queue)
Three Tilemaps: Bottom (grass, order in layer -2), Middle: (fence, order in layer -1), Top (house and player, order in layer 0)

My solution

Create a Sprite GameObject (let's call it OutlineSprite) with the same sprite used by the player. Assign it as child of the PlayerSprite
Assign, to the OutlineSprite, a "Order in Layer" greater than anything else.
Assign, to the OutlineSprite, the same animator used for the Player sprite (and modify the c# script that sends notification to the animation controller whenever the player moves so that it sends notification to the OutlineSprite animation controller too)
Assign, to the OutlineSprite, a material which uses a shader able to render the outline of a given sprite (I just copy/pasted a shader I found online which does more or less what I wanted, I'm not anywhere near to understand how to write a shader right now)
Modify the player Sprite outline so that it exactly match the shape of the sprite
Put a Sprite Mask in every place you need to create this effect (in the screenshot is just over the house roof)
Configure the Player sprite to be "Visible outside mask" and the OutlineSprite to be "Visible inside mask"

This solution seems to do what I need but has many cons that I'd like to address, if possible.
Pro:

simple solution that doesn't require extensive knowledge of advanced concepts

Cons:

the player animation runs twice
tedious to manually configure the outline of all the animation sprites
tedious to manually place the sprite mask where needed

My question
Is there another (or multiple) solution to this problem that involve the least amount of changes and work (so that the setup fast and maintenance is minimal)? Ideally I'd like to only change the player's shader, if possible.

sentences:
Custom inventory items based on inheritance So, here's the scenario:
I'm building an RPG. Like most of the other RPGs on the market, my game will feature an inventory and of course, inventory items. So far I've worked well with using a single class for all items, because I did not need anything else than character stat alteration on item usage (consumption). However, I'd like some items to have a more exotic effect. Think of something like when the user consumes a transformation potion, he automatically turns into a beast.

In order to achieve this I've thought about declaring a new class that inherits from BaseItem for each item. Each descendant would override some methods (like void OnConsume()), to change the base behavior.

This works fine, but when it comes to inventory management, I have some issues. The actual inventory will have to work with BaseItem components only (for obvious reasons, as it's an enumerable collection of objects of the same type); casting any descendant to the base class is possible, so no problems in adding items to the inventory. But how can I keep track of the descendant's type (class) for each item in the inventory? And how to perform the descendant's OnConsume from withint he inventory, for each item?

Let me know if you can think of a better solution than mine, or if you can think of a solution to my problem only.

Development is done in C#, inside Unity 3.5.

Thanks!

sentences:
Determining Poker Hands I have been making a Texas Hold'Em game as a part of an assessment, and I have been mulling over how to examine the 7 available cards and determine if hands exist.

The only possible method I can think of is to sort the cards numerically, then examine each possible group of 5 cards and check if they match a list of every single possible hand. That would take a long time snd would only be feasible for determining pairs, as the suit is irrelevant.

The cards are each strings, made up of a number/a/j/q/k, and a suit (char)3 (that makes a little spades symbol).

Does anyone have any suggestions, formulas, or links I could use to help create a hand-analysing system?

Don't worry about ranking hands against each other yet, that's a different kettle of fish.

sentences:
NullReferenceException in my inventory system I'm making a simplified inventory system for a 3d game.

When I try to pick up an object, I get the following error:

  NullReferenceException: Object reference not set to an instance of an object

Here are the scripts I'm using:

Pick Up goes on the item - the error fires inside the Update method

public class PickUp : MonoBehaviour {
    private playerInventory inventory;
    public Transform woodIcon;
    public Transform slot1;
    public void Start()
    {
        inventory = GameObject.FindGameObjectWithTag("Player").GetComponent<playerInventory>();
    }

    public void Update()
    {
        if (inventory.slot1 == true) // <-- error fires on this line.
        {
            Destroy(gameObject);
            Instantiate(woodIcon, slot1.position, woodIcon.rotation);
        }
    }
}

Player Inventory

public class playerInventory : MonoBehaviour {

    public bool slot1;

    public void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.name == "wood")
        {

        }
        if (slot1 == false)
        {
            slot1 = true;
        }
    }
}

Here is a screen shot showing my setup and the error:

sentences:
P2P Online Gaming, it is viable? I am working on a Peer to Peer based Online Gaming system. I plan on using it for running a decentralized MMORPG in which there are no central servers and traffic is routed evenly among each node/Realm in the network. There are some diagrams and notes that I have for the system and I wanted to know if such a system is actually viable.

https://mega.co.nz/#F!5d8UFaRb!ojwZ0WyDzgFct2IhmdQoZg Diagrams are here.

Essentially this system would be a Mesh Net type network in which people can create their own private realm and then connect it to the network so that other people can play on it. There are two methods to configure the software, 1 you can create your own private realm or 2 you can act as peer for an existing private realm by acting as a mirror for it.

So the more people who connect to the network and play on it, the more stable the network becomes. An individual private realm and its mirror nodes would be called a Realm Cloud. Bit torrent protocol to evenly distribute all traffic to avoid network congestion. IPv6 for global network traffic and DHT for individual realm cloud traffic.

The number of connections can be configured in the client but there must be at least two. The number of maximum connections in theory can be indefinite. End to end encryption keeps all traffic within the network including text and voice chats secure from eavesdropping and garlic routing can prevent tracking.

People can set their own rules and policies for their own realms that they create. If you don't like them then create your own and write the rules the way you like it.

This is still just a basic idea but I just wanted to know if this is an idea that would actually work.

sentences:
Rendering issue: depth buffering + blending: how do they work together? This image describes the problem I'm having:

What you are seeing consists of two images:

Image A(with the alien-concept art thingy), depth value .98, the white parts on the image is where the alpha value is 0.0f
Image B(with the play game button thingy), depth value .99, one solid image without any transparency value.

Now, when I first set this up, I expected Image A to let the colours of Image B through where Image A is fully transparent. But it doesn't

Question 1 : Why doesn't it?

Question 2 : What can I do to fix it? Are there multiple ways to fix it?

Question 3 : Is this problem different for partial transparency? If so, how do I make it work with partial transparency as well?

Thanks.

sentences:
Create a touchpad-joystick using texturepacker2 I am adding a touchpad control to my game, using TexturePacker for loading images into the image-atlas. I have followed this tutorial to add the joystick. Everything is the same apart from the loading assets part. This is how I am adding the control:

//in create
ta = new TextureAtlas(Gdx.files.internal("image-atlases/pages-info.atlas"));

        camera = new OrthographicCamera();
        camera.setToOrtho(false, 800, 480);

        batch = new SpriteBatch();

        blockSpeed = 5;

        InitTouchPad();

        //create a stage and add touchpad
        stage = new Stage(800, 480,true, batch);
        stage.addActor(touchpad);
        Gdx.input.setInputProcessor(stage);

        //create block sprite
        blockTextureRegion = ta.findRegion("block");

        blockSprite = new Sprite(blockTextureRegion);
        //set position to the left bottom of screen
        blockSprite.setPosition(800-blockSprite.getWidth()/2, 480-blockSprite.getHeight()/2);

//end create

private void InitTouchPad(){
        //adding touchpad controls
        //create a touchpad skin
        touchpadSkin = new Skin();
        //set background image
        touchBackgroundRegion = ta.findRegion("touchBackground");
        touchpadSkin.add("touchBackground", touchBackgroundRegion.getTexture());
        //set knob image
        touchKnobRegion = ta.findRegion("touchKnob");
        touchpadSkin.add("touchKnob", touchKnobRegion.getTexture());
        touchpadStyle = new TouchpadStyle();
        //create drawable's from touchpad skin
        //touchBackground = touchpadSkin.getDrawable("touchKnob");
        //touchKnob = touchpadSkin.getDrawable("touchBackground");
        //apply the drawables to the touchpad style
        touchpadStyle.background = touchpadSkin.getDrawable("touchBackground");
        touchpadStyle.knob = touchpadSkin.getDrawable("touchKnob");
        //create new touchpad with the created style
        touchpad = new Touchpad(10, touchpadStyle);
        //setbound(x,y,width,height)
        touchpad.setBounds(0, 480 - 150, 150, 150);

    }

@Override
    public void render() {
        // TODO Auto-generated method stub
        Gdx.gl.glClearColor(0, 0, 0.2f, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

        camera.update();

        //add touchpad controls
        blockSprite.setX(blockSprite.getX() + touchpad.getKnobPercentX()*blockSpeed);
        blockSprite.setY(blockSprite.getY() + touchpad.getKnobPercentY()*blockSpeed);

        batch.begin();
        blockSprite.draw(batch);
        batch.end();

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();

    }

And for the output, all my assets are preloaded on the screen, the touchpad is nowhere looking like a joystick control. The images are jumbled over each other the movement of the sprite is in opposite direction..

sentences:
How to add global variables to a global list and then call the elements in a second scene in Unity, c# I have the following problem with my app. I have a scene where the player is adding products with prices, by using strings. They are added to a Global Control file, which saves the data. Then, in this GlobalControl file, I want to add each of this strings in a list, so this way in the next scene I can call them and add them to a ScrollView, similar to order preview. Unfortunately, I can't manage to make it the right way and to add more than one item to the Order Preview.

My code is the following:
Scene one:

public void addToOrder()
{

    if (m_currentSelectedModel <= 33)

    {
       GlobalControl.orderContent =
       menuItemNamesString[m_currentSelectedModel];
       GlobalControl.priceContent =
       menuItemPriceString[m_currentSelectedModel];
    }

}

My GlobalControl is the following:

public class GlobalControl : MonoBehaviour
{
    public static GlobalControl control;

    //the global variables

    static public string orderContent;
    static public string priceContent;

    //global lists
    static public List<string> orderItemsList = new List <string>();
    static public List<string> orderPricesList = new List <string>();

    void Awake()
    {
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);
            control = this;
        }

        else if (control != null)

        {
            Destroy(gameObject);
        }

    }

    private void Start()
    {

        //adding the current selection to the respective list
        if (orderContent != null)
        {
            orderItemsList.Add(orderContent);
        }

        if (priceContent != null)
        {
            orderPricesList.Add(priceContent);
        }

    }

And last my OrderPreviewManager, which is in scene 2, is:

void Start ()
{
    //my current solution, which does not retrieve a variable from a list

    curOrderContent = GlobalControl.orderContent;
    curPricetContent = GlobalControl.priceContent;

    AddSelectedItemToOrder();
    AddSelectedItemPriceToOrder();
}

//the two methods for adding the string to text components into a scroll
  view

void AddSelectedItemToOrder()
{
    GameObject gameObject = new GameObject("Child");
    gameObject.transform.SetParent(orderContentView.transform);

    gameObject.AddComponent<Text>().text = curOrderContent;
    gameObject.GetComponent<Text>().font =
    Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
    gameObject.GetComponent<Text>().color = Color.black;
    gameObject.GetComponent<Text>().fontSize = 20;
}

  //similar to the previous method but for the prices

void AddSelectedItemPriceToOrder()
{
    GameObject gameObject = new GameObject("Child");
    gameObject.transform.SetParent(pricetContentView.transform);

    gameObject.AddComponent<Text>().text = curPricetContent;
    gameObject.GetComponent<Text>().font =
    Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
    gameObject.GetComponent<Text>().color = Color.black;
    gameObject.GetComponent<Text>().fontSize = 20;
}

My question is: why does this only insert one item in scene 2?

sentences:
Initializing OpenFeint for Android outside the main Application I am trying to create a generic C++ bridge to use OpenFeint with Cocos2d-x, which is supposed to be just "add and run" but I am finding problems.

OpenFeint is very exquisite when initializing, it requires a Context parameter that MUST be the main Application, in the onCreate method, never the constructor. Also, the main Apps name must be edited into the manifest. I am trying to fix this. So far I have tried to create a new Application that calls my Application to test if just the type is needed, but you do really need the main Android application. I also tried using a handler for a static initialization but I found pretty much the same problem.

Has anybody been able to do it? This is my working-but-not-as-intended code snippet

public class DerpHurr extends Application{

@Override
public void onCreate() {
    super.onCreate();
    initializeOpenFeint("TestApp", "edthedthedthedth", "aeyaetyet", "65462");
}

public void initializeOpenFeint(String appname, String key, String secret, String id){
    Map<String, Object> options = new HashMap<String, Object>();
    options.put(OpenFeintSettings.SettingCloudStorageCompressionStrategy, OpenFeintSettings.CloudStorageCompressionStrategyDefault);
    OpenFeintSettings settings = new OpenFeintSettings(appname, key, secret, id, options);

//RIGHT HERE
    OpenFeint.initialize(***this***, settings, new OpenFeintDelegate() { });
    System.out.println("OpenFeint Started");
}

}

Manifest

<application
    android:debuggable="true"
    android:label="@string/app_name"
    android:name=".DerpHurr">

sentences:
How do I implement level generation based on graph grammars? I'm looking to do some pseudo-random map generation using graph grammars (graph rewriting).  However, most of what I can find online on this is purely academic and, while helpful, doesn't have any direct practical application.

For the uninitiated, the thousand-foot view of this is that say a dungeon room is generated, then based on a set of rules for that room, one rule is randomly chosen and applied adding more rooms.  From there, another specified room may go through the same or a different set of rules for additional growth of the map.

For the practical side of things, I'm thinking of storing the possible rules as arrays containing data about what additional rooms it contains, what order they are in, and which might also end up having a rule applied to it.  But then mapping this to 2D space, while it seems easy, may end up with some complications, such as what happens if rooms end up overlapping.

At any rate, I was hoping someone might have some insight into whether this might be done in a better fashion than an array for the rules.

The results from the rules will likely be added to a custom class that will hold the layout as it's built.

Thoughts? :)

sentences:
How can I handle multiple simultaneous skeletal animations? I wonder how skeletal animations in games work. I am writing my own graphics engine for fun, and I have come across several problems with animations.

Here is how I do it right now:

Load the mesh with animations
Simulate every animation with the CPU and then send it to my GPU via a texture that I make from the final transformation matrices.
In my shader I multiply every vertex by the transformation matrices that are tied to that vertex.

This method works very good (until now). Now to the problem, if I have two animations that I want to use at the same time (running and shooting for example) then I have to do a "height check". It still works but I am getting serious doubts about it. If I want to render custom directions with this shoot animation (to where the camera is heading) I just don't know how I could fix this with my current method.

How can I accomplish this?

sentences:
Process for Creating Imposters (For Unity) I'm still working on making a sports stadium with crowd etc. I've been reading a lot about 'Imposters' and 'Billboarding'. I want to explore and learn the imposters technique.
But I am stuck at step 1 :|
I have a stadium model made which is empty (no seats or people).
All I want at the moment is seats. I have the model made in Maya for a seat.

Do I need to make (and import to Unity) both a low-poly and high-poly version of the model.
How exactly is an 'imposter' asset stored in data (specifically if used in Unity)?
Do I need to make 2d images/textures of many angles of the seat?

I do have more questions, but these may be enough to get me started.
Thanks as always for any help.

sentences:
Understanding particle texture rotation / space I want to remake a "portal" that I've seen in RE4. It looks like this:

I have observed it, and to me, it looks just like a texture rotating on a cylinder.

To remake this, I thought that I should use a Particle System.

First question: Is that a good choice?

In my particle system, I'm using this texture:

I'm also using a cylinder mesh.

I have then set the following settings:

Duration: 1.0
Start lifetime: 1
Emissions Rate over time: 1
Rotation over Lifetime: Separate Axes: Y: 360

It does rotate on the cylinder as expected, but the texture is really strange.
I have no idea in which way it's being used. Therefore I have added the red, blue, green and yellow dots.

As on can see, the spikes come from above as well instead of only from below.
Also, there's a "gap" in that circle:

I thought that it was perhaps caused by the texture tiling, so I played around with that. It didn't really help. Here is a video of my desperate attempt.

Can anybody tell me which pitfall I have stumbled over?

If I can't make the texture fit correctly by tiling and offset, what else could I do to make the texture fit perfectly here?

Edit: This is what the cylinder unwrap looks like. I just used Smart UV Project in Blender:

sentences:
Old "Play Montage" node vs new 'Montage Play" and "Play Anim Montage" so.. Following documentation/guides/etc.. I keep coming across the classical node called "Play Montage" which shows one of those Mario Bros pipes as an icon.

However, my version of unreal engine does not have that BP node. it only has "Montage Play" and "Play Anim Montage". As far as I can tell the difference is that there are different input nodes in each of the three cases, and the "Montage Play" is aimed at an Anim instance while the Play Anim Montage is aimed at character.

Could anyone help me out here and illustrate the real difference between all 3? Thank you :)

This is the old one:

These are the new ones:

sentences:
Lookup table in shader opengl es What I need is apparently very simple, a lookup table in a fragment shader. It seems that the natural way would be an array float lut[], but in some implementations of OpenGL ES I am getting an error

  "profile requires index expression to be compile-time constant".

Next approach would be a 1D texture filled with the values, but again OpenGL ES doesn't like that :)

What would be the simplest way to have a lookup table of 256 float elements in the fragment shader? (I guess it will be a 2d texture but it looks like it is some overhead and I am not sure if it's possible to handle two textures on a shader)

P.S. I am a very beginner in OpenGL but what I need is simple handling of images in textures.

sentences:
Moving a sprite in XNA/C#, using vectors I'm currently looking into XNA game development with the C# language.

I have two classes: the main game handler and a "sprite" class. Following is some basic pseudo-code which I hope adequately describes the issue.

Game.cs

class game {
  sprite the_sprite;
  void update(time) {
    var mouse = mouse.state
    if(mouse.clicked) { this.the_sprite.moveTo(mouse.x, mouse.y) }
    this.the_sprite.update(time)
    base.update(time)
  }
}

Sprite.cs

class sprite {
  vector2 location;
  vector2 move_to;
  void moveTo(x, y) { this.move_to = new vector2(x, y) }
  void update(time) {
    if(this.location.x > this.move_to.x /* (or less than) */) {
      // adjust location.x
    }
    if(this.location.y > this.move_to.y /* (or greater than) */) {
      // adjust location.y
    }
  }
}

Basically: when the user clicks somewhere in the game window, the x and y coordinates of the mouse are taken, and the game object will move towards that location over a period of time.

Well... the code works, but it's ugly, and objects don't move directly towards the object (instead, it's diagonal movement, followed by single-axis movement). I'm guessing there are some mathematical functions I can use, but I honestly haven't a clue where to get started. Any suggestions?

sentences:
Placing Zones in Cities Skylines I'm trying to build a mod that places zones on a keypress. How would I accomplish this?
So far I've detected the keypress. But when I modify m_blocks in ZoneManager by calling block.setZone(x,y,zone) The block appears to have changed, but only for the moment. When I run the keycommand again, the data appears to have  been reset. I never see the zone change in game, only when I print it to the console.
string outtext = "";
            uint blockCount = Singleton<ZoneManager>.instance.m_blocks.m_size;
            outtext += "start{\n";
            for (int index = 0; index < blockCount; index++) {
                var block = Singleton<ZoneManager>.instance.m_blocks.m_buffer[index];
                if (block.m_valid != 0) {
                    block.SetZone(1, 1, ItemClass.Zone.Industrial);
                    block.RefreshZoning(0);
                    outtext += " valid:" + block.m_valid + " position:" + block.m_position.ToString() + " zone:" + block.GetZone(1, 1) + " \n ";
                }
            }
            outtext += "}";
            Debug.Log("OUTTEXT " + outtext);

I've tried calling block.refreshZoning() as well, but I'm not sure how to calculate the blockid :(.

sentences:
How to confirm an actor location in a realtime multiplayer game at the exact same time on two devices? I am trying to figure out how to make a game like Pong in multiplayer. I have two devices that run the same simulation. Now I want to make sure that each of them start at the exact same time and send packets from the host to the client that confirm the position of the ball.

I am not sure if this would be the right approach, but how do I make sure that both devices are running the same game?

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: Is an iOS development license with Unity free? I'm coding in Unity Personal and I'm going to try to put my game onto the App Store (through the Unity --> XCode --> App Store process). In the past, Unity has charged money to get a iOS license for this. The price was $400 I believe. I've certain articles that say that it has changed, and some that say it still costs money. So, I'm not sure which one is true. Is creating and publishing a commercial game with Unity Personal now free? (meaning that there is no license required). If there is a price, how much is it, and is it a one-time fee or per month/year/game published etc. Thanks! Also, can I legally make money with this game using the Unity Personal?

sentences:
Issues with AABB on a platformer game i'm facing an issue at the moment in my javascript/html platformer game that despite searching for this issue i can't solve. The problem is this:

When i place two platforms next to each other and the player moves between them, the algorithm believes the player is colliding with the side (left or right) face of the next platform. This is because all my bounding boxes are placed in an array and iterated through, the algorithm doesn't care if the player has to pass through one collider to get to another, it just thinks it has collided with both.

One solution is of course to make it consider what it has collided with first, another is simply not to place two platforms together. My solution would be to implement a kind of occlusion culling with collides, which if the player collides with a top face it can't collide with a side face if that side face's top face is higher or equal to top first that was being collided in.

That was hard enough to explain let alone implement and i just feel like there is a better work around that wouldn't be too difficult to implement and would be efficient.

My solution:

Another solution is to disable gravity if the player is in contact with the ground, this must be done carefully not to trigger an oscillation effect and also means that two iterations need to be made, one for collision in the y (done first) and the other for collisions in the x (done second).

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:
Unity - Determine direction vector3 from a point in space and an angle in eulers I have a ball positioned as Vector3(x, x, x).

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

Code (csharp):

Vector3 direction = Direction (clickPos2 - startPos);

Where the method is:

Code (csharp):

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

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

But how I calculate it?

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

Mirza

sentences:
pixel art game looks like it is lagging As you can see from the title, I'm working on a game using pixel art. To archive that, I create a 160x90 texture, draw everything onto that and scale it up.
But the player in this game only moves about 10 pixels per second in some places. Luckily, the position isn't stored in pixels, but as a float, so the player can also be at (10.234, 3.76543). Because the map is big, the player is always centered on the screen and the world moves, instead. But as of my current implementation, I round the player's position to whole pixels in each update call. Otherwise, the engine would place all the world's sprites between the pyhsical pixels and they would be interpolated and look very unsharp and not very pixel-artish.

And there comes the problem: because the player moves just 10px/sec, the world only moves on the screen every 1/10 second. And that, of course looks like the game was running at 10 fps (it actually runs at 60fps).

So what is the recommended approach for that? Should I stick to what I current have got or should I let the graphic card do what it wants to do and let it interpolate the pixels and simply ignore the blurry effect.

PS: I know this question is similar but the difference is that in his case, he wants to avoid this staircase effect, while in my case, I want to avoid the lag

sentences:
Texture Packer - Any way to make it combine intelligently I am making a Pokemon Clone, using libgdx. I have the different types of sprites: e.g. Back, front, back shiny, and front shiny.

The current way the Texture Packer combines the textures seems to be semi-randomly. I would like to be able to tell it to put the sprites together based on number, because my sprites go:

003
003b
003bs
003s

Where the 003 is the pokedex number, and the b is for back, and s for shiny.

Two questions here:

Is there a way to get it to sort the textures in some way?
Is there a benefit to this sorting?

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:
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:
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:
Generate texture for a heightmap I've recently been trying to blend multiple textures based on the height at different points in a heightmap. However i've been getting poor results. I decided to backtrack and just attempt to recreate one single texture from an SDL_Surface (i'm using SDL) and just send that into opengl. I'll put my code for creating the texture and reading the colour values. It is a 24bit TGA i'm loading, and i've confirmed that the rest of my code works because i was able to send the surfaces pixels directly to my createTextureFromData function and it drew fine.

struct RGBColour
{
    RGBColour() : r(0), g(0), b(0) {}
    RGBColour(unsigned char red, unsigned char green, unsigned char blue) : r(red), g(green), b(blue) {}

    unsigned char r;
    unsigned char g;
    unsigned char b;
};

    // main loading code
SDLSurfaceReader* reader = new SDLSurfaceReader(m_renderer);
reader->readSurface("images/grass.tga");

// new texture
unsigned char* newTexture = new unsigned char[reader->m_surface->w * reader->m_surface->h * 3 * reader->m_surface->w];

for (int y = 0; y < reader->m_surface->h; y++)
{
    for (int x = 0; x < reader->m_surface->w; x += 3)
    {
        int index = (y * reader->m_surface->w) + x;

        RGBColour colour = reader->getColourAt(x, y);

        newTexture[index] = colour.r;
        newTexture[index + 1] = colour.g;
        newTexture[index + 2] = colour.b;
    }
}

unsigned int id = m_renderer->createTextureFromData(newTexture, reader->m_surface->w, reader->m_surface->h, RGB);

    // functions for reading pixels
RGBColour SDLSurfaceReader::getColourAt(int x, int y)
{
    Uint32 pixel;
    Uint8 red, green, blue;
    RGBColour rgb;

    pixel = getPixel(m_surface, x, y);

    SDL_LockSurface(m_surface);

    SDL_GetRGB(pixel, m_surface->format, &red, &green, &blue);

    SDL_UnlockSurface(m_surface);

    rgb.r = red;
    rgb.b = blue;
    rgb.g = green;

    return rgb;
}

    // this function taken from SDL documentation
// http://www.libsdl.org/cgi/docwiki.cgi/Introduction_to_SDL_Video#getpixel
Uint32 SDLSurfaceReader::getPixel(SDL_Surface* surface, int x, int y)
{
    int bpp = m_surface->format->BytesPerPixel;

    Uint8 *p = (Uint8*)m_surface->pixels + y * m_surface->pitch + x * bpp;

    switch (bpp)
    {
    case 1:
        return *p;
    case 2:
        return *(Uint16*)p;
    case 3:
        if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
            return p[0] << 16 | p[1] << 8 | p[2];
        else
            return p[0] | p[1] << 8 | p[2] << 16;
    case 4:
        return *(Uint32*)p;
    default:
        return 0;
    }
}

I've been stumped at this, and I need help badly! Thanks so much for any advice.

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:
Smooth transitions between 2d animations I am writing a 2d game (in libGDX, but I think that doesn't matter too much). In that game I want to have smooth transitions between animations. For example, let's think of a guy walking around. Now that guy is hit by something (a bullet for example) and dies. So I want to play the death animation for this guy now.

The problem: I cannot simply exchange the walking animation by the death animation, because the guy's current walking animation frame is not necessarily the same as the first frame of the death animation. So for the player that would look as if the animation "jumps" from walking to death.

So my question is: what is the "typical" way to achieve a nice and smooth transition from animation to another, in general?

sentences:
HTML5 Canvas Game Timer How to create good timer for HTML5 Canvas games?
I am using RequestAnimationFrame( http://paulirish.com/2011/requestanimationframe-for-smart-animating/ )

But object's move too fast.

Something like my code is:

http://pastebin.com/bSHCTMmq

But if I press UP_ARROW player don't move one pixel, but move 5, 8, or 10 or more or less pixels. How to do if I press UP_ARROW player move 1 pixel?

Thanks for help.

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:
On screen controller for libgdx games? Does anyone know a better controller for 2D Games than a virtual on screen joystick? The pros of the joystick are:

Easy to implement for developers
Familiar interface for users

But there is a huge con:

The screen is obscured by thumbs.

And also, is there any library for a quick implementation of virtual joysticks for Libgdx?

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 to disable depth buffer in Directx11 For now i know what i must use OMSetDepthStencilState. In the beginning i must create two states and change them every time i need another. For now i have this and it doesn't work, i.e. objects rendered in order i draw them:

D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
depthStencilDesc.DepthEnable = TRUE;
depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
depthStencilDesc.StencilEnable = FALSE;
depthStencilDesc.StencilReadMask = 0xFF;
depthStencilDesc.StencilWriteMask = 0xFF;

// Stencil operations if pixel is front-facing
depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;

// Stencil operations if pixel is back-facing
depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;

ID3D11DepthStencilState *m_DepthStencilState;
HR(m_Device->CreateDepthStencilState(&depthStencilDesc, &m_DepthStencilState));
m_ImmediateContext->OMSetDepthStencilState(m_DepthStencilState, 0);

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:
Dynamic vs Kinematic, do either of these cause a collision before OnCollisionEnter2D? Firstly, it would be a great deal of help if someone could explain to me the differences between Dynamic, Kinematic and Static (especially if there is a box for static by the name of the object. I've looked at the APIs and tried playing around with them, they are so confusing. :/

Secondly, I understand that the physics engine evaluates first and can cause a collision (when the ball hits the paddle in my Pong game) but is there a way around this? I'm trying to send the ball in the opposite direction to which it hit the paddle by using OnCollisionEnter2D but this method gets called second and therefore the ball changes direction twice and the physics engine causes an unnecessary collision...

I have looked to tutorials on the movement in pong and tried following the tutorials but get the same problem (even though their game is faultless), this leads me to think that it's the Body Type property that is causing the physics engine to produce the extra collision because theirs is an older unity version. It could possibly be the bouncy material with no friction also, I don't know much purely because I'm a newbie to unity. I wonder whether anyone has had the same problem as me and can set me free.

Thanks in advance. I seriously appreciate any help I can get! :)

sentences:
Is it safe to base a combo system in frames instead of time? I'm building a prototype for a fighting game (not vs, something like Final Fight). I'm trying to define the data for the player combo tree and had a look around looking for inspiration and have seen games like Street fighter that base its combo timming on frames instead of time. The game is locked at a fixed frame rate too.

My question is, my game is targeting Windows, so, there are a lot of processes running in a computer. If I base my combo timmings on frames, can't a cpu spike produced by another process break my game?

A solution to fix this is to check every Update() how many real logic frames have passed (based that we want our game to run at 60 logic frames) and run the combo system all these number of frames at once. But not sure if this would work.

Beside all this, another problem is that Unity does not provide a separated thread for rendering and logic that could be configurable and accesible by the developer (It does not even have a frame rate independent input system shame).

Well, what do you think?

Cheers.

sentences: How can I send someone an early version of my game made in clickteam fusion 2.5? I'm currently in the process of making my first game and have a pretty sturdy prototype, but I don't know how to send it out to select people. Any suggestions?

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:
How to get this wavefront .obj data onto the frustum? I've finally figured out how to get the data from a .obj file and store the vertex positions x,y,z into a structure called Points with members x y z which are of type float. I want to know how to get this data onto the screen.

Here is my attempt at doing so:

//make a fileobject and store list and the index of that list in a c string
ifstream file (list[index].c_str() );

std::vector<int>faces;
std::vector<Point>points;
points.push_back(Point());
Point p;
int face[4];

while ( !file.eof() )
{
    char  modelbuffer[10000];
    //Get lines and store it in line string
    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);
            cout << "Getting Vertex Positions" << endl;
            cout << "v" << p.x << endl;
            cout << "v" << p.y << endl;
            cout << "v" << p.z << endl;
            break;
        case 'f':
            sscanf(modelbuffer, "f %d %d %d %d", face, face+1, face+2,  face+3 );
            cout << face[0] << endl;
            cout << face[1] << endl;
            cout << face[2] << endl;
            cout << face[3] << endl;
            faces.push_back(face[0]);
            faces.push_back(face[1]);
            faces.push_back(face[2]);
            faces.push_back(face[3]);
    }
    GLuint vertexbuffer;
    glGenBuffers(1, &vertexbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER, points.size(), points.data(), GL_STATIC_DRAW);
    //glBufferData(GL_ARRAY_BUFFER,sizeof(points), &(points[0]), GL_STATIC_DRAW);

    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
    glVertexPointer(3, GL_FLOAT, sizeof(points),points.data());
    glIndexPointer(GL_DOUBLE, 0, faces.data());
    glDrawArrays(GL_QUADS, 0, points.size());
    glDrawElements(GL_QUADS, faces.size(), GL_UNSIGNED_INT,  faces.data());
}

As you can see I've clearly failed the end part but I really don't know why its not rendering the data onto the frustum? Does anyone have a solution for this?

sentences:
Unity - Button get function from GameObject So I have two gameObjects, the blue one the player character and different spheres of difference colors. Each sphere has a function lets say SphereFunction().
When the player character touches a sphere gameobject I want a button to appear on the screen. This can be done using the ontriggerenter2d and ontriggerexit2d.

What I want is the button OnClick to call the SphereFunction() of the sphere if pressed. This function can have different implementations depending on the color of the sphere, just the function name is the same.
How can this be done using a single button?

sentences:
Unity3D : Retry Menu (Scene Management) I'm making a simple 2D game for Android using the Unity3D game engine. I created all the levels and everything but I'm stuck at making the game over/retry menu. So far I've been using new scenes as a game over menu. I used this simple script:

#pragma strict

var level = Application.LoadLevel;

function OnCollisionEnter(Collision : Collision)
{
    if(Collision.collider.tag == "Player")
    {
        Application.LoadLevel("GameOver");
    }
}

And this as a 'menu':

#pragma strict

var myGUISkin : GUISkin;

var btnTexture : Texture;

function OnGUI() {
GUI.skin = myGUISkin;

if (GUI.Button(Rect(Screen.width/2-60,Screen.height/2+30,100,40),"Retry"))
    Application.LoadLevel("Easy1");

if (GUI.Button(Rect(Screen.width/2-90,Screen.height/2+100,170,40),"Main Menu"))
    Application.LoadLevel("MainMenu");
}

The problem stands at the part where I have to create over 200 game over scenes, obstacles (the objects that kill the player) and recreate the same script over 200 times for each level. Is there any other way to make this faster and less painful?

sentences:
What are the drawbacks of this messaging system implementation? So I've just been thinking about component and messaging systems recently for simple C# XNA games and came up with this. How extensible would this implementation be and what are the drawbacks? Example below:

Score

class Score
{
    public int PlayerScore { get; set; }

    public Score()
    {
        EnemySpaceship.Death += new EventHandler<SpaceshipDeathEventArgs>(Spaceship_Death);
    }

    private void Spaceship_Death(object sender, SpaceshipDeathEventArgs e)
    {
        PlayerScore += e.Points;
    }
}

EnemySpaceship

class EnemySpaceship
{
    public static event EventHandler<SpaceshipDeathEventArgs> Death;

    public void Kill()
    {
        OnDeath();
    }

    protected virtual void OnDeath()
    {
        if (Death != null)
        {
            Death(this, new SpaceshipDeathEventArgs(50));
        }
    }
}

SpaceshipDeathEventArgs

class SpaceshipDeathEventArgs : EventArgs
{
    public int Points { get; private set; }

    internal SpaceshipDeathEventArgs(int points)
    {
        Points = points;
    }
}

Basically, the idea uses the built in events system in C#. When something interesting happens to an object, it raises a static event. Then, anything else in the game that wants to know when that happens subscribes to that static event and does something in response. In this case, the Score class subscribes to the static Death event of a Spaceship and when it dies, it uses the EventArgs to adjust the score accordingly.

Would this kind of architecture start to crumble and get quite confusing as the development of the game progressed? Thanks for reading.

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:
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:
Why glDrawElements draws nothing? I tried to implement indexed draw, but when I call I got nothing on screen. Even more strange that I wasn't get any error when call it and buffer variables packed right.

There my constructor:

Mesh::Mesh(Shader &shader, std::vector<GLuint>* indices, std::vector<VertexData>* vertices) {
shaderProgram = &shader;
_meshLenght = (GLsizei) indices->size();
_indices = indices;

glGenBuffers(1, &_ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices->size(), indices, GL_STATIC_DRAW);

//create one here
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);

std::vector<glm::vec3> positions {};
std::vector<glm::vec3> normals {};
std::vector<glm::vec2> texture {};

for (size_t i = 0; i < vertices->size(); ++i) {
    positions.push_back(vertices->at(i).positions);
    normals.push_back(vertices->at(i).normals);
    texture.push_back(vertices->at(i).texCoords);
}

glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*(positions.size()+normals.size()), nullptr, GL_DYNAMIC_DRAW);

glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(glm::vec3)*positions.size(), positions.data());
glBufferSubData(GL_ARRAY_BUFFER, sizeof(glm::vec3)*positions.size(), sizeof(glm::vec3)*normals.size(), normals.data());

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, reinterpret_cast<const void*>((sizeof(glm::vec3) * positions.size())));

glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER,0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

And there my draw code:

void Mesh::Draw() {
glBindVertexArray(_vao);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _ebo);
if (_ebo==0)
    glDrawArrays(GL_TRIANGLES, 0, _meshLenght);
else {
    glDrawElements(GL_TRIANGLES, _meshLenght, GL_UNSIGNED_INT, nullptr);
}
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}

Also show my vertices info screenshot:

And if you need have apitrace trace file:
https://drive.google.com/file/d/0B-dWIpzqq91mQXVIeHhTOHFhRkU/view?usp=sharing

sentences:
Importing 3d model with multiple skeletons I have created an animated butterfly in 3ds Max and try to export it in ".fbx" format to use in XNA, however as soon as I compile, i get the following Errors:

Warning   1 Multiple skeletons were found in the file. The first skeleton, named "Left.Wing" has been moved to be a child of the scene root. The other, "Right.Wing", will be ignored. Fragment identifier "Right.Wing".

Error 2  Vertex is bound to bone "Right.Wing", but this bone is not present in the skeleton.

Which is confusing since I have the bone Right.Wing . . and I use it to animate the butterfly

I have seen a few possible solution for Blender but none for 3Ds max it would be really helpful if someone could help me out with this

sentences:
Moving an object to random points Unity3d c# So here is the problem
I want to change the position of gameObject to specific points that I declared with empty objects randomly but the problem is the moment the object reaches one of the points it starts shaking around and not doing the same thing again
here is my code

public class EnemyController : MonoBehaviour {

public Transform[] movePoints;
public float speed;
private int amount;
private Transform currentTarget;

void Start () {
    randoming ();

}

void Update () {
    Movement ();
}

void randoming(){
    amount = Random.Range (0, movePoints.Length);
    currentTarget = movePoints[amount];
}

void Movement(){
    transform.position = Vector3.MoveTowards (transform.position, currentTarget.position, speed * Time.deltaTime);
    StartCoroutine (startMoving());
}

IEnumerator startMoving(){
    yield return new WaitForSeconds (5.05f);
    randoming ();
}

}

sentences:
Isometric camera movement My camera system has two objects: the isometric camera itself, and an empty object it's attached to which handles both movement and rotation. When the player drags the middle mouse button, the camera (or, rather, the empty object) moves like this:

Vector3 diff = lastFramePosition - currFramePosition;

float xchange = diff.x / 5;
float ychange = diff.y / 5;

//flips the direction of movement if the rotation of the object is a certain way
if (transform.rotation.y == 90 || transform.rotation.y == 180)
                ychange *= -1;

if (transform.rotation.y == 270 || transform.rotation.y == 180)
                xchange *= -1;

Vector3 pos = transform.position;

//moves the camera and restrains it within the limits of the map (core.mapx and core.mapy)
transform.position = new Vector3(Mathf.Clamp(xchange + pos.x, 0, core.mapx), 3, Mathf.Clamp(ychange + pos.z, 0, core.mapy));

It turns out, though, that since it moves the empty object along the X and Y axes, dragging up/down or left/right moves it along those axes instead of actually moving the camera view up/down and left/right. The best way I can describe it is like those old isometric games that do the exact same thing. Is there any way I can get it to move like this?

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:
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:
How to hide a sprite on trigger when the player enters the trigger zone? I am making a roof for my 2D top down survival game, and I want to make it so that the roof disappears when the player enters the building, and re-appears when they leave.
Here is the code I've written so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Roof : MonoBehaviour {
    public GameObject roofGameObject;

    void OnTriggerEnter2D(Collider2D collision) {
        roofGameObject.SetActive(false);
    }

    void OnTriggerExit2D(Collider2D collision) {
        roofGameObject.SetActive(true);
    }
}

I got it to work so that, when I go in, the roof it disappears. But when I leave it stays disappeared. How can I fix that?

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:
How do I rotate a cube around an axis, relative to the camera view? I want to be able to rotate a cube, either by

dragging vertically to rotate it around the Y-axis, or
dragging horizontally to rotate it around the X-axis.

However, when the camera is rotated 90 degrees or more, these directions become wrong relative to the view screen. How can make rotating ‘up’ always mean ‘up’ relative to the camera view?

Here's a picture explaining the situation:

sentences: How to handle Animal AI biting and holding onto the character Example state of decay, zombie biting the player

sentences:
An inherited scene component has no details panel and can't be moved I'm making an fps, and I'm spawning the gun at a location on the player character.  To do this I added a scene component to the players class, and that is what the gun is attached to when it is spawned.  ( the scene component was added after I had created the blueprint derived from the cpp class).  This worked fine, and the gun is spawing.  Its spawning at the bottom of the character however, so I need to move the scene component to where I want the gun to spawn.  When I try to do this, I notice there's no widget to move the component, and it has no details in the details panel.  I tried creating a new blueprint derived from the class to see if the details would work there, but they didn't.
here's my header file code for creating the object:
USceneComponent* GunSpawnPoint;

And here's my cpp constructor  code:
AGunBase::AGunBase()
{
    // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;
    RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
    RootSceneComponent->SetupAttachment(RootComponent);
    GunMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    GunMesh->SetupAttachment(RootSceneComponent);
    BulletSpawnPoint = CreateDefaultSubobject<USceneComponent>(TEXT("Spawn Point"));
    BulletSpawnPoint->SetupAttachment(GunMesh);
}

Is this a bug?  How do i fix this?

sentences:
relationship between the model and the renderer I tried to build a simple graphics engine, and faced with this problems:

i have a list of models that i need to draw, and object (renderer) that implements IRenderer interface with method DrawObject(Object* obj). Implementation of renderer depends on using graphics library (opengl/directx).

1st question: model should not know nothing about renderer implementation, but in this case where can i hold (cache) information that depends on renderer implementation? For example, if model have this definition:

class Model
{
public:
    Model();

    Vertex* GetVertices() const;

private:
    Vertex* m_vertices;
};

what is the best way to cache, for example, vertex buffer of this model for dx11? Hold it in renderer object?

2nd question: what is the best way for model to say renderer HOW it must be rendered (for example with texture, bump mapping, or may be just in one color). I thought it can be done with flags, like this:

model->SetRenderOptions(RENDER_TEXTURE | RENDER_BUMPMAPPING | RENDER_LIGHTING);

and in Renderer::DrawModel method check for each flag.

But looks like it will become uncomfortable with the options count growth...

sentences:
Invert parent transform (doesn't work for combination of rotation and scale) My problem
I'm working with Qt3D and my problem is almost exactly like this one:
https://stackoverflow.com/q/60995155/3405291
Suggested solution
A solution is suggested here:
https://stackoverflow.com/a/61315454/3405291
Understanding the solution
I have a problem understanding the suggested solution. Specifically:

The problem is that the QTransform node does not store the transformation as a general 4x4 matrix. Rather is decomposes the matrix into a 3 transformations that are applied in fixed order:

S - a diagonal scaling matrix
R - the rotation matrix
T - translation
and then applies it in the order T * R * S * X to a point X.

So when the transformation on the parent is M = T * R * S, then the inverse on the child will be M^-1 = S^-1 * R^-1 * T^-1. Setting the inverse on the child QTransform will attempt to decompose it in the same way:

M^-1 = T_i * R_i * S_i = S^-1 * R^-1 * T^-1

That doesn't work, because particularly S and R don't commute like this.

I'm looking for the phenomenon happening here and why it happens. Does it happen in other 3D engines? How is it resolved in other 3D engines?

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:
Implementing grid based selection box What is a good way of implementing a RTS selection box for tiles on a grid? I'm making a game with some similarities to Evil Genius, the building in particular. In that game you click one place, drag the cursor somewhere else and something similar to the GIF below shows.

To do so a grid and a way of translating mousePosition to the correct cell is needed. Then a set of for loops (one for x and one for y) for executing the necessary action on each cell. My main problem is accounting for the direction of dragging, and in particular when shrinking. My current solution (hastebin here) is rather crude, and I would like a more elegant solution for a more civilized age. Hopefully someone else can think of a easier way of accounting for drag direction, I surely can't.

Any help appreciated.

sentences:
Should I call the garbage collector during loading screen? SO, I read a bit on Garbage Collection lately, out of curiosity, and there is something that is repeated quite often: garbage collection can lead to sudden slow down of the program, depending of the "depth" of the collection.

But in video games, there is a moment where the user can't really notice a small lag: loading screen. So, I thought, it might be useful to proceed to full garbage collection during a loading phase (via Collect()), having to wait a second or two longer should not really impact the user.

My question is, is it really useful, or are there no real benefit to doing this?

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:
Dealing with multiple scenes /levels Overview

I have a scene manager in my game and in each 'Scene' I have a render() and a update() method for drawing and updating my game's logic.

Basically, when I want to switch to another scene, let's say, when the player progresses to the next level or going from game-over back to the main menu, I just do something like this:

SceneManager.getInstance().setCurrentScene(level2); //Where level 2 is a 'Scene' class.

I have a 'MainGame' scene who's sole purpose is to house all the methods I call from my individual levels.  So I might then do something like this:

Current method

public class Level1 extends MainGame implements Scene {

    private Resources res;
    private MyGLRenderer r;

    Level1(MyGLRenderer r, Resources res){
        super(r, res);
        this.res = res;
        this.r = r;
    }

    @Override
    public void render() {
        draw(background);
        draw(playerSprite);
        draw(blue-enemies);
    }

    @Override
    public void update(){
        super.movePlayer();
        super.moveEnemies();
        super.checkCollision();
    }

}

However, in my game, when the player survives for a certain amount of time, I want to introduce more elements into the game, so I might then have a 'level2' Scene (although strictly, from the player's perspective, the game is perceived to be one big rolling level).....

    public class Level2 extends MainGame implements Scene {

        private Resources res;
        private MyGLRenderer r;

    Level2(MyGLRenderer r, Resources res){

        super(r, res);
        this.res = res;
        this.r = r;
    }

    @Override
    public void render() {
        draw(background);
        draw(playerSprite);
        draw(blue-enemies);
        draw(pink-enemies);  //New!!!! *********************************
    }

    @Override
    public void update(){

        super.movePlayer();
        super.moveEnemies();
        super.checkCollision();
    }

}

So, as you can see, Level2 is exactly the same as Leve1 but now I'm also drawing my 'pink-enemies', I can keep doing this for 'levels' 3 through 10 but I'll end up duplicating and simply adding to each level each time.  Seems like a lot of effort just to introduce 1 or 2 new things every 'level'.

Using conditions within my render / logic?

Is there a cleaner / tidier way of achieving that which I'm trying to achieve?  I could do away with all my individual 'Level' classes altogether and just work straight out my MainGame class's Render() and Update() methods, but then I would have to have something like:

Render(){

    //Render elements common to all levels
    draw(background);
    draw(playerSprite);
    draw(blue-enemies);

    //Render specific level objects

    Switch (Level){

        case 4:{draw(giantAlienSpaceship);}
        case 3:{draw(orange-enemies);}
        case 2:{draw(pinkEnemies);break;}
    }
}

And then a similar switch in my logic.  I'm not sure about this however, as it adds additional switch/conditional statements in my rendering and seems somewhat 'amateur' however, I could be completely wrong and this may be an acceptable method that people do use.

Am I missing any other obvious cleaner / cleverer way to do this (similar to my first method but without the duplicated super method calls)

sentences:
HLSL Gaussian blur pixelshader: blur is not occurring I am trying to use postprocessing to create a gaussian blur, however, no blur is to be seen, what am I doing wrong?

I have included the full code at the bottom of this post in a google docs link, but here are the most important bits and pieces.

Part of the xna draw method:

RenderTarget2D renderTarget;
renderTarget = new RenderTarget2D(this.device, screenWidth, screenHeight, 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);

// Set the effect parameters (the 'simple' technique creates a red lambertian shaded model, like is shown on the image below)
effect.CurrentTechnique = effect.Techniques["Simple"];
effect.Parameters["TextureWidth"].SetValue(screenWidth);
device.DepthStencilState = DepthStencilState.Default;
device.BlendState = BlendState.Opaque;

// Draw the model
mesh.Draw();

// Render our scene
this.device.SetRenderTarget(null);

effect.CurrentTechnique = effect.Techniques["GaussianBlur"];

spriteBatch.Begin(0, BlendState.Opaque, null, null, null, effect);
spriteBatch.Draw((Texture2D)renderTarget, screenRectangle, Color.White);
spriteBatch.End();

The pixelshader:

float Pixels[13] =
{
   -6,
   -5,
   -4,
   -3,
   -2,
   -1,
    0,
    1,
    2,
    3,
    4,
    5,
    6,
};

float BlurWeights[13] =
{
   0.002216,
   0.008764,
   0.026995,
   0.064759,
   0.120985,
   0.176033,
   0.199471,
   0.176033,
   0.120985,
   0.064759,
   0.026995,
   0.008764,
   0.002216,
};

float4 GaussianPixelShader(float2 TextureCoordinate : TEXCOORD0) : COLOR
{
    // Pixel width
    float pixelWidth = 1/TextureWidth;

    float4 color = {0, 0, 0, 1};

    float2 blur;
    blur.y = TextureCoordinate.y;

    for (int i = 0; i < 13; i++)
    {
        blur.x = TextureCoordinate.x + Pixels[i] * pixelWidth;
        color += tex2D(TextureSampler, blur.xy) * BlurWeights[i];
    }

    return color;
}

What I have further found out by testing

The code in the GaussianPixelShader does get executed (if I set it to just return a black color it gives an entire solid black screen) but just doesn't seem to work/do the blurring.

Images

This is how currently my model looks (I cant see any blurring but maybe the blurring is just too light): image.

Full Code

Link to the shader code and the link to the xna/c# code.

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:
move sprite relative to position on another sprite (sword and player) I'm sure this is a common problem people face but I can't find much on this topic after some googling.

I have a sword, and a player, both which are sprites. I want the sword to be attached to the player -- Normally you would be able to just child the sword sprite to the player sprite and change the relative position of the sword sprite -- but my player's hands move during the walking animation.

So is there an easy way of moving the position of the sword sprite during each frame of the player walking animation? Or some way of attaching the handle of the sword sprite to the player's hand?

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:
LibGDX Game vs ApplicationAdapter When I create a new LibGDX project the main class of Core project extends ApplicationAdapter.
Here is how it looks like.

package com.marimba.apptest;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;

public class AppMain extends ApplicationAdapter {
    @Override
    public void create () {

    }

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

    }
}

So I have to change the ApplicationAdapter to Game if I want to call setScreen method in order to switch between Screens. So what is the use of ApplicationAdapter ? When shall I use it ?

sentences:
What is better: One texture per model or assigning multiple models to one single huge texture? If I'm making a low-poly car pack of multiple cars for mobile platforms, should I:

Make a large texture like of 2048x2048 and unwrap all the models to it
Make separate, smaller (256x256) textures for all cars

Will there be a difference in performance? Which way of texturing is preferred? I've never seen any PC game have one large texture for all the cars, instead every car has its own set of textures and materials.

sentences:
How do I maintain the world pitch, roll or yaw of child objects? I've got an application where I'm trying to display an object in 3D, with information provided by real-world accelerometers and inclinometers - sensors that pick up the angle of the equipment, relative to ground. The trouble comes when I want to show this 'world pitch' or 'world roll' on an object that is a child of another. I'd think that there is a trivial solution to the problem, but for the life of me, I can't figure out what it is.

Let's say I've got a robot arm with several pieces - "LowerArm", "Elbow", "UpperArm" and "Hand". "Hand" is the child of the "UpperArm", and "UpperArm" is the child of "Elbow". I'd like to place "Hand" at 0 degree pitch, relative to world-space, no matter how I move the parent objects. If I grab my "LowerArm", and rotate it 90 degrees, the hand should still lay 'flat', relative to the ground; in local coordinate space, it should moved 90 degrees, to compensate.

I want it to remain attached; so it should continue to follow the other parts, in terms of roll and yaw. If I twist the arm, the hand twists with everything else - it just maintains that 0 degree world pitch. Observe the yellow object, in the below example:

How can I do this? I would have thought that there was some kind of trick, with matrices or quaternions, that could resolve it; but I've had no luck, so far. It's hard to figure out what the new 'forward' vector should be.

sentences:
MonoGame Mac installation instructions Does anyone know how to install MonoGame on Mac. I have been looking around for a while and I can't find any guides. I have Mono and MonoDevelop up and running fine, but I cannot figure out how to install MonoGame.
Thanks.

sentences:
fastest way to check for surrounding tiles I'm working on a tile map where each type of tiles has 12 states with 12 different sprites associated with it, what I'm trying to say is that whenever I place a tile let's say a road tile, that tile should adjust itself automatically according to the 4 tiles surrounding it, so for example if the tile above it is a road tile and the tile below it is also a road tile, it should automatically adjust itself into a vertical road tile... there is 12 states a tile can have:
1-closed(not surrounded by any similar tile)
2-horizontal(similar tiles up and down)
3-vertical(similar tiles right and left)
4-open from up and left(similar tiles to the left and above)
5-open from left and down(...)
6-open from down and right(...)
7-open from right and up(...)
8-open from up & left & down(3 similar tiles up, left and down)
9-open from left & down & right(...)
10-open from down & right & up(...)
11-open from right & up & left(...)
12-open from all 4 directions(all surrounding tiles are similar)
the problem is that I don't know how to check for surrounding tiles and choose the right tile state without having a huge mess of if statements and performance waste, and I don't have enough experience with algorithms and data structures to figure it out myself.
how can check all 12 states the fastest way possible ?
thanks!

sentences:
What is an optimum failure rate that will keep people coming back to my game? I'm guessing some research has been done into this but I can't find much information. The question might be a bit too vague in itself as it depends on so many other factors.

I'm developing a puzzle game that I want to be challenging, but not so challenging that users don't bother coming back to try again if they fail. I'm assuming the shorter the game length to more willing a user will be to try again.

For example, if a level takes an hour with a 95% failure rate, I suspect that many users wouldn't bother trying again after a couple of failures. But if a game takes 30 seconds then they'll probably keep trying again until they succeed.

I'm wondering if anyone has, or can point me in the direction of information that offers guidance on this aspect of game development.

sentences:
Awesomium custom surface scroll I have a custom Awesomium::Surface implementation, and I need to create a Scroll function for it. The function asks me to manually move some pixels of my texture by the indicated X and Y offset.

How can I move/access pixels inside a SDL_Texture since SDL_LockTexture() provide write-only pixels?

sentences:
breakout game, computing optimal ricochet angle of a ball to get to a certain point perhaps the title isn't clear so here is an explanation with a picture to better express my question

Consider the following breakout clone game

where the game is rigged to change the ricochet angle according to some parameters

Suppose the ball was to hit one of these blue bricks, finding the angle at which the ball should ricochet to go toward any point below the bricks using trigonometry should be trivial and easy.

My question however, is if we have the following setup

How would I got about finding the optimal angle to ricochet from the collision point (circled in red) to get to a certain location (green dot for example)

The path should ricochet off of multiple points to get there, obviously, I'm just not sure how to go about it.

Any math guru who can help me out? Thanks!

sentences:
How do you create an over world styled like Pokémon Black and White, with both 2D and 3D elements? The over world of Pokémon white uses 3D models for objects like houses, and 2D sprites for characters like the player.  What would I have to do to create an over world styled like this?

Here is an example:

sentences:
Unity - GameObject jumps to wrong point at start In Unity, I have this problem where the Game Object this script is attached to jumps to Z position 0 as soon as the game runs. In the Editor, I have the Game Object set as Z position -50. I want startPos to read this position (-50) and use it when newPos is updated.

Why does startPos get updated immediately to 0?

using UnityEngine;

public class MoveOutScript : MonoBehaviour {

    public float speed = 10f;
    float startPos;
    Vector3 newPos;
    float changePerSecond2;

    public void Start()
    {
        startPos = transform.position.z;
        changePerSecond = speed * Time.deltaTime;
    }

    public void Update()
    {
        #region Move sprite away steadily

        newPos.z += changePerSecond;
        newPos.z = Mathf.Clamp(newPos.z, startPos, 15f);
        transform.localPosition = newPos;

        #endregion
    }
}

sentences:
Unity 3D - Game is fine in "play" but when built, player moves diagonal up+left So I just completed the first "Roll-a-ball" tutorial, but when I run the build, the game ball races to the Upper-Left corner even when I don't press any buttons.

I did the obvious stuff (reboot, build again...) but it still does it for the PC stand-alone build, and not when I play directly from Unity.

My code doesn't seem to be different from the tutorial (see link above).  Here's the input handling code inside of the "PlayerController.cs":

    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

 Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

 rb.AddForce (movement * speed);
    }

Then I added statements to print the Horizontal and Vertical. When inside the IDE and I play it, they're zero, and when I press an arrow key, they move from 0 to 1 floating point in about a second. In the built stand-alone, Horiz is -1, Vert is 1.

void SetCountText ()
{
    countText.text =
        "Count: " + count.ToString () + "\n" +
        "Horizontal: " + Input.GetAxis("Horizontal").ToString() + "\n" +
        "Vertical:" + Input.GetAxis("Vertical").ToString()
        ;
    if (count >= 12) {
        winText.text = "YOU WIN!!";
    }
}

sentences:
What is the point of "delta" in this code? Does it reflect a standard thing in game dev? I know very little about game programming but would like to learn more. I am trying to understand the code for this game. I am trying to understand why the code is passing a "delta" to Shipcontrols.js, which changes the direction of the ship based on user input.

Basically the game calculates "delta" every loop...

Here is an abbreviated version of the stack that uses delta thru one loop...

var delta = now - this.time;
this.time = now;
this.current.render.call(this.current, delta, this.renderer);

Steps into here...

ctx.manager.add("game", scene, camera, function(delta, renderer)
{
if(delta > 25 && this.objects.lowFPS < 1000) this.objects.lowFPS++;
var dt = delta/16.6;
this.objects.components.shipControls.update(dt);

Steps into here...

bkcore.hexgl.ShipControls.prototype.update = function(dt)
{
var pitchAng;
var yaw;
var roll;
if (undefined != hand){

Which does stuff like this...

if(this.key.forward)
    this.speed += this.thrust * dt;
else

and this...

if(this.key.right)
{
    angularAmount -= this.angularSpeed * dt;

What is the point of delta here? Is it just trying to introduce an element of randomness? The code for this game is very good. Why did this guy use delta?

sentences:
Not clearing FBO's Texture error in battery economy mode When rendering inside a FBO's texture, I'm not using glClear() but overwriting each fragment, GL_BLEND is set to true.
This works just fine, but  I just realised when my laptop switch to economy mode, and I guess switch to egpu (intel 630) , the texture is full of garbage data when drawn.
here you can see first the working render, and then the garbage one. It should be exactly the same the only difference is my laptop is not plugged in AC

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:
Manipulating vertices after multiplication with MVP matrix (OpenGL) I'm making a collage of lots 16x16 renders on a 512x512 texture, of the same scene, from various viewing positions and angles, preferably lots of times per second. I've profiled my program (which contained a glDrawElements call per mesh), and the multiple glDrawElements calls seemed to slow it down a lot. In order to optimize, I've resorted to instanced rendering. However, the main problem I'm having is changing the viewport between, say, every 3 instance renderings, or so. I was thinking of adding a fourth matrix, which would scale the perspectively-projected vertices of a would-be 16x16 picture, translate them so that the little images don't overlap, and based on the little picture's position and size (16x16 pixels) on screen, use the `discard' command in the pixel shader.

How do I scale the projected vertices from the current large viewport into a 16x16 smaller version of it and translate them inside the former at a certain position?

Or, more clearly, how do I change the viewport during a glDrawElementsInstanced call, every N instances?

EDIT
Here's a visualization of what I'm trying to achieve:

Keep in mind, I can't change the viewport as I want to do this during a call to glDrawEleemntsInstanced, every 3 instances, or so.

How do I compute a matrix or what do I have to do to get the post-projection vertices scaled and translated so that I'll have the full image scaled in a 16x16 portion of the screen?

sentences:
Parallax Background Size If I have three scrolling/continuous parallax backgrounds, what should be the ideal size (width/height) of the background images assuming I am going to support all devices including the new iPad?

UPDATE:

Only landscape mode
Deployment Target: 4.2+
Same scene will be repeated.

sentences:
OpenglGL Render two scenes with one draw call I need to draw a normal-vector scene and default scene.

I could achieve this my having two programs with different fragment shader to produce the following images. It will require me to draw twice.

//somethinglike
useProgram(normal_vector_rendering_program);
render_bunny();
useProgram(just_default_scene_program);
render_bunny();

However when I am rendering the default scene, I am already passing normal vector information to achieve the lighting.

So it got me curious, can I produce two different scenes with one program(a program that has two color_buffer attaches) and one draw call somehow? I think if such is possible then I am saving lots of computer resource by not having to draw multiple times for different images.

sentences:
Particle Effects move awkwardly as the camera approaches them Particle effects seem to move rather awkwardly when partly out of camera bounds. When scaling up particle effects to the point where they fill most of the screen they don't appear static anymore.

Video of the effect

I'm using particles to simulate clouds. Is there a way to fix this without scaling down the individual clouds?

sentences:
Using a web service for multiplayer games? I've been looking into web services for making multiplayer games and was just wondering how feasible would it be?

What I would like to do is make a simple MMORPG that uses a turn based fighting system, are there any inherent limitations with web services which would make this difficult and not worth my time?

Also out of curiosity would a faster paced multiplayer game be workable using web services? Something like a top/down shooter similar in pace to games like asteroid?

sentences:
Positioning a texture inside a 3D object with GLSL I have a 3D object in my scene and a texture that is the same size of the screen (a render to texture). Is there a way to make the object act like a "mask" for the texture(using glsl), so the texture is aligned with the screen 2D space but only shows what is "inside" the mask object?

What I'm trying to achieve here is this: I have a 3D scene made of cubic tiles, some of these tiles are going to be water and I want to distort whatever is behind them. My idea was to pass the render to texture and then distort it to make a refraction effect. Is this going to work? Am I even suposed to do refraction like this?

sentences: Is there any other way to animate 2d spritesheet without Animator Component in unity? Is there any easy way exists that animates frames without using Animator component?

sentences: If two objects interact, what holds the interaction code? Think of a bullet and an enemy, or the player and the floor. If these objects interact, what holds the interaction code?

sentences:
Unity navmeshagent and doors I'm trying to make an agent patrol around a maze. The maze is proceduraly generated and consists of many rooms connected with doors. The problem occurs when the agent reaches a door. I wrote a script where if the agent gets near a door, the door opens, but the results are bad because the doors are walkable, so the navmesh doesn't consider them as obstacles and the agent gets stuck if the door opens and gets in its way.

I've been looking everywhere on the internet, but haven't found a solution.
If anyone has an idea or a way to make this work, I'll be very thankful.

sentences:
How to use OpenGL blend mode/functions to brighten/darken a texture. Tried this code, but the texture didnot get any lighter.

    try {
        texture = TextureLoader.getTexture("png",
           Game.class.getResourceAsStream("/brick.png"), true, GL_NEAREST);
    } catch (IOException e) {
        e.printStackTrace();
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());

    glEnable(GL_BLEND);
    glBlendFunc(GL_CONSTANT_ALPHA, GL_CONSTANT_ALPHA);
    GL14.glBlendColor(1.0f, 1.0f, 1.0f, 0.5f);

    glColor4f(1, 1, 1, 0.5f);
    GL11.glBegin(GL11.GL_QUADS);          // Start Drawing Quads
    // Front Face
    GL11.glNormal3f(0.0f, 0.0f, 1.0f);    // Normal Pointing Towards Viewer
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);  // Point 1 (Front)
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);   // Point 2 (Front)
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);    // Point 3 (Front)
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);   // Point 4 (Front)
    glEnd();

sentences:
Why is my application getting more CPU usage while it's halting the operation I have a question about the way OS gives CPU time to the applications. Usually when I render my scene with a single object in it I get ~8% CPU usage, but when I stop the framework for further process while my window has lost focus I see that my application has a ~50% CPU usage. Now, I'm a little bit confused about this behavior because supposedly I should get no CPU time at all.

The pseudo code is something like this:

while(open)
{
  // Window
  window->update();

  // Freeze when we have no focus
  if (freeze) continue;

  // Physics, Input, Render ...
  do_the_stuff();
}

The situation that I'm talking about is when I set freeze to true and just process the window messages. It means there is only one job to do per frame.

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:
Z rotation matrix inverting object I'm currently creating a 3d game where I need to rotate shapes. To do se, I created a rotation matrix for each axis, X, Y and Z. X and Y are giving me expected results, but not Z who kind of "inverts the shape". I need it to rotate like it would rotate a 2d shape.

Here is the Z matrix :

zRotation.matrix[0][0] = cosf(rotationAngles.z);
zRotation.matrix[1][0] = -sinf(rotationAngles.z);
zRotation.matrix[0][1] = sinf(rotationAngles.z);
zRotation.matrix[1][1] = cosf(rotationAngles.z);
zRotation.matrix[2][2] = 1;

Here is what it looks like : https://imgur.com/a/3YR4Nlc

PS : The game have an isometric perspective.

EDIT : Here is how I do matrix * vector

vec3 operator *(vec3 operand){
    //multiply vector by matrix

    vec3 result = vec3((operand.x * matrix[0][0]) + (operand.x * matrix[1][0]) + (operand.x * matrix[2][0]) + (operand.x * matrix[3][0]), (operand.y * matrix[0][1]) + (operand.y * matrix[1][1]) + (operand.y * matrix[2][1]) + (operand.y * matrix[3][1]), (operand.z * matrix[0][2]) + (operand.z * matrix[1][2]) + (operand.z * matrix[2][2]) + (operand.z * matrix[3][2]));
    return result;
}

(Fourth element is always 0)

sentences:
Can't figure get the conversion from cartesian to spherical("polar") correctly for my orbiting camera The two angles from the polar coordinate system are defined as hRotation and vRotation

This is how they are converted from polar to cartesian:

    // Get the distance between the object and the camera
    float distance = cam.getLocation().distance(RotationTarget);

    Vector3f pos = new Vector3f(distance * FastMath.sin(vRotation) * FastMath.cos(hRotation),
                                distance * FastMath.cos(vRotation),
                                distance * FastMath.sin(vRotation) * FastMath.sin(hRotation));

    // Add in the objects position to make the new relative position of the camera
    pos = pos.add(RotationTarget);
    cam.setLocation(pos);

Now the problem is when I try to get hRotation and vRotation from cartesian coordinates for the to initialize hRotation and vRotation, rather than setting them to an arbitrary value and having the camera jump each time. The camera is generally free roaming "a fly cam" but when an object is selected, the user can hold shift to rotate the camera around the object. So I need to base hRotation and vRotation off of the coordinates of camera and object, here is my code so far, but the issue is that the Camera will mirror its rotation rather than allowing me to fully rotate. For instance I can rotate to the left but it snaps to opposite angle from the right. I know I probably need to invert the angle when something is less than something, but I can't figure out what it is...

    float distance = cam.getLocation().distance(RotationTarget);

    Vector3f diff = cam.getLocation().subtract(RotationTarget);

    vRotation = FastMath.acos(diff.y / distance);
    hRotation = FastMath.asin(diff.z / FastMath.sqrt((diff.x * diff.x) + (diff.z * diff.z)));

Thanks,
-Tim

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:
Libgdx detect touch on a specific object (while moving) I have a class (I'll call it with letter "A") and class B.

A is the object (as a character) and B is the rendering class which have the aim to show A.

I am looking for a way to detect when A is pressed, with normal InputProcessor I can't because it detect touch in the entire screen, I only want detect touch over the object. If I check touch position and "A" position it doesn't work because the object is moving and the values aren't so precise

How to solve?

this didn't solve for me :Efficient way of detecting a touched object in a game?. Here is explained "what to do" and not "how to do"

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:
Procedural texturing with opengl I have a hexagonal grid of fields, each field has a certain terrain type. I assign every vertex of hexagon with terrain type and pass it as attribute to vertex and then fragment shader. Then I use the extrapolated value to blend terrain textures together.

For instance: 1 is grassy, 2 is desert.

Vertex shader:

varying vec2 vUv;
attribute float terrainType;
varying float vTerrainType;

void main()
{
   vUv = uv;
   vTerrainType = terrainType;
   vec4 mvPosition;
   mvPosition = modelViewMatrix * vec4( position, 1.0 );
   gl_Position = projectionMatrix * mvPosition;
}

Fragment shader:

uniform vec3 diffuse;
uniform float opacity;
varying vec2 vUv;
varying float vTerrainType;
uniform sampler2D map;
uniform sampler2D map1;

void main()
{
   gl_FragColor = vec4( diffuse, opacity );
   vec4 texelColor = texture2D( map, vUv ) * (2.0 - vTerrainType) + texture2D( map1, vUv ) * (vTerrainType - 1.0);
   gl_FragColor = gl_FragColor * texelColor;
}

Implementation is WebGL, if it makes any difference.

The result looks really unnatural, so is there any way to make it smoother and rounder?

sentences:
How to differentiate between object types and roles? I have a base class Object, and depending on how the object must behave on the scene, I have multiple abstract "role" classes, that inherits virtually from Object:

Updatable if the object is dynamic, and must be updated every frame;
Collidable if the object can collide with others, and thus must take part on collision detection;
Drawable if the object is visible and must be drawn.

So, for instance, a particle special effect animation is both a Updatable, because it moves, and Drawable, because it is visible, but is not Collidable. A trigger may be Updatable, but is definitely Collidable, and is not Drawable because it is invisible.

If objects are never removed or created, this design is easy to manage: I have three lists on my world, one for each object type, that hold pointers for all objects of that type: i.e. the updatable_list holds a pointer to all my Updatables, etc. This is what I have so far.

Now I have to add and remove objects, and this design is biting me.

When a new object is added, I would have to use dynamic_cast to figure out its roles and add its pointer to the proper lists. But dynamic_cast is usually referred as bad design and code smell, not to mention being slow.

When an object is removed, it can potentially be part of multiple lists, so I would have to track its existence across lists, maybe by storing std::weak_ptr instead of raw pointers, and would have to check and potentially remove every time I use an object from such list. Other options would be linear search and remove from all lists upon removal, or use std::unordered_set instead of std::list to make it fast to search and remove. But I find these other options a bit fragile, because I risk having dangling pointers if I "forget" to remove the object from some list.

So, my question, is this a good design? How can it be improved? How is this problem of different object types usually handled in game engines?

sentences:
What are my options other than game engines? I'm a programmer. I've experience in Java, python, and c++.
I see that some big games are built using game engines (Crysis uses Cryengine).
However, other don't (Bayonetta for example).
what's their approach ?
Do they start coding from scratch using OpenGL or Directx ?
is this approach feasible considering time, cost, porting to many platforms ?

I want to know what's the options before I start

sentences:
why does Physics.Raycast always return my player game object instead of the object I clicked? I have 3D world. I want to detect when the player clicks on a game object in the world.

In this image, I have 2 objects I want to detect mouse click on. The white sphere does have collider on it. The dumpster does not. The behavior is the same as noted below.

I am getting the mouse down detection.  When I check the RaycastHit, I always get the player game object transform and not the game object I clicked on in the world. If I remove the raycaster checks, then I get mousedown for anything in the game not just mouse down over the game object. I need to be able to distinguish between clicks on different game objects.

I found a post here and added a PhysicsRayCaster, but it didn't change the behavior.  The problem isn't getting the event.  My problem is detecting which game object the player clicked on in the world.

Here's my code:

public class InventoryItemSearchHandler : MonoBehaviour
{
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = UnityEngine.Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                // CompareTo always fails because hit.transform.name is always "Player" and
                // not the name of the object clicked on
                if (0 == hit.transform.name.CompareTo(transform.name))
                {
                    print("mouse down");
                }
            }
        }
    }
}

EDIT:
In the image below (compared to the one above) I do get the correct transform in the RaycastHit type when I click on the white sphere (and when I click on the dumpster I get the player transform as noted above).

So it looks like the player object is getting in the way.  What would be causing that?

sentences:
One framebuffer for each light vs unique framebuffer per light Currently I have two ideas how to implement my lighting system:

1) Use one framebuffer per light source

no need to switch texture attachments of framebuffer
may be faster
bigger memory usage

2) Use one framebuffer for every light source

some time may be wasted on attaching new textures to framebuffer
less memory usage

So could you please tell me which way is better and why? Or I'm totally wrong on my thoughts and there is no difference at all?

sentences:
I have an "amoeba" game mechanic. Any idea on how to implement it? Outside of a tetris clone, a crappy 2D top-down shooter, and some messing around with stuff like Unity and Flixel, I realize that I have yet to complete a single, polished, bells-and-whistles game. I want to change this, and I have an idea for my next project.

The idea is that you're an amoeba. Amoebas have these eye-like cores (or something like that, I don't know biology), and you have two of 'em. You control one with WASD and the other with IJKL. There has to be a constant radius of stuff around each of the cores:

And the area of the amoeba has to stay constant. So if you move a core in one direction, you increase the amoeba's area, but that increase is compensated by a decrease somewhere else:

Aaaaaand I'd like to implement a vagination mechanic. You absorb things by engulfing them, like a boss. Maybe even an extra core, or a needle that pops you and causes all your inner stuff to start gushing out:

But here's the problem: I don't know how to make this. However, I would like some ideas on how to implement it. Should I explore physics libraries like Box2D? Or maybe something involving fluid physics? Any help would be much appreciated.

P.S. Feel free to steal this idea. I have plenty of ideas. If you do, please tell me how you made it so I can try it myself.

sentences:
Play videos via 3rd party library or as animation in libGDX? I want to add an animated splash screen to my desktop game, which I develop using libGDX. Now I see there is no native support for videos in libGDX, so I guess I have two options:

Include a 3rd party framework for video playback (like the Java
media framework); or
Save the video as a series of PNG images and
play them as a libGDX animation.

Since the splash screen video is not very long, maybe 5 seconds or so, I tend to the libGDX animation option. However, the video would be full screen, so rather large images, and I am not sure whether an animation would really be the best option in that case.

Does anyone of you guys have some experience with (full screen) video playback under libGDX on the desktop?

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:
Can't find sibling node, keeps giving "null instance" I'm trying to set it up so that there are three buttons but only one can be toggled at a time. So when one button gets toggled it makes sure that the other two are not toggled.

The code is trying to set the toggled status however since it can't find the node I'm at a loss.

var vec = Vector2(0,1000)
var ori = Vector2(0,0)
func _ready():
    pass

func _on_Ally1_Button_toggled(button_pressed):
    if button_pressed:
        set_position(ori)
        $Player_Button.set_pressed(false)
    else:
        set_position(vec)

This is what the tree looks like.

The Player_Ally1_ui is trying to access Player_Button but as stated it can't seem to find it and just returns null.

Any help is greatly appreciated, thank you in advance.

sentences:
Questions about scaling in a 2d game in unity Okay, so:

I am making an android game. I want everything to scale to the size of the screen I'm using. Further, my static background needs to scale (as well as every other object), but if the aspect ratio is less than the AR of the background image I want the image to be cut off at the edges.

Further, I have a game object I need to always be at the corner of the screen. I'm guessing I should use a script to determine the width of the screen and place it a few coordinates up and right of that on start?

The game is only in landscape mode if that matters. How do I go about this? I previously had the background as a plane with an image on it but it didn't take up the whole screen and I think it might not be the right thing to do? Maybe use a quad?

How do I test to make sure that this works? I only have my one android phone to test it on.

sentences:
Reference keyboard keys as "justPressed", "pressed", and "justReleased" with SDL in C++ I'm teaching myself 3D graphics with OpenGL and SDL in C++. I'm at a point where I need to be able to query states of individual keys, like so:

if (InputManager::justPressed(SDLK_UP)) {}
if (InputManager::pressed(SDLK_UP)) {}
if (InputManager::justReleased(SDLK_UP) {}

I'm not sure if I should be using SDL_GetKeyboardState or bool arrays for SDL_Keycode/SDL_Scancode, using states seems to me to be the more correct way. I've implemented this previously using states in C# with XNA (see that here). But I've been unsuccessful trying to replicate that with SDL.

Method 1 - Using SDL_GetKeyboardState

// InputManager stores
Uint8* _curKeys, _oldKeys;

void InputManager::init() {
    _curKeys = SDL_GetKeyboardState(NULL);
    _oldKeys = new Uint8[sizeof(_curKeys)/sizeof(Uint8)];
}

void InputManager::update() {
    memcpy(_oldKeys, _curKeys, sizeof(_curKeys)/sizeof(Uint8)); // this seems to work
    std::copy(std::begin(_curKeys), std::end(_oldKeys), std::begin(_curKeys));
}

bool InputManager::pressed(SDL_Keycode code) {
    return _curKeys[code];
}

bool InputManager::justPressed(SDL_Keycode code) {
    return _curKeys[code] && !_oldKeys[code];
}

bool InputManager::justReleased(SDL_Keycode code) {
    return !_curKeys[code] && _oldKeys[code];
}

In the main loop I update the InputManager instance by copying the current keyboard state and updating the current state. Since I'm relatively new to C++ I'm unsure of exactly the best way to copy the values from _curKeys to _oldKeys without using a for-loop. I can't just set _oldKeys=_curKeys because that just makes _oldKeys point to _curKeys. But memcpy seemed to work.

With this implementation justReleased is constantly true, no matter what key is pressed, and justPressed and pressed are always false.

Method 2 -Array of bools

// SDL_PollEvent() loop
case SDL_KEYDOWN: InputManager::keyDown(//event keycode);
case SDL_KEYUP: InputManager::keyUp(//event keycode);

The keyDown and keyUp functions just set keyArray[keycode] to true and false. In the InputManager update function I once again duplicate of the array, simulating "states". But with this implementation all three functions are always false.

Anyway

I hope that this question wasn't too incoherent, I tried to explain it as best as I could. I've found some forums where people had similar problems, the criticism always was that this kind of functionality isn't needed. I would disagree, a good use case for this would be, for example, a charge-up weapon in a game. At justPressed you start the charge, increment a charge counter while pressed is true, and at justReleased you fire the weapon.

If anyone has any pointers for me (no pun intended :P) that would be awesome.

sentences:
Height field/Shallow water eqation water simulation with ground height Hey guys I found a lot of tutorials on 2D height field/swe water simulation but I have yet to find one that takes into account of ground height, i.e.

http://zejiazheng.com/?p=87

The overall water simulation results is fantastic however it does not takes into account of ground height and it doesnt work when the height of water is 0.

Would appreciate help on how to implement that as I've been stuck for several weeks on how to implement it. Thanks!

sentences:
Passing of board data in board games Every time I make board game, I am faced with a decision. I have classes for the board and/or game logic, and another for the UI. I don't know how I should pass the board data to the UI. I could make a method on the board class that returns an array which represents the "board state", then just iterate over them on the UI. Or I can make a method that gets the value/s of a single coordinate, e.g. a getValue(int row, int col) method. Here are sample codes (in Java):

public class Board{
    private int[][] grid;
    private int rows;
    private int cols;

    // Constructor and other methods here, getRows(), getCols(), etc....

    public int getValue(int row, int col){
        return grid[row][col];
    }
}

public class UI{
    private Board board;
    // Constructor and other methods here

    public void someMethod(){
        for(int i = 0; i < board.getRows(); i++){
            for(int j = 0; j < board.getCols; j++){
                // Do something with board.getValue(i, j);
            }
        }
    }
}

or I can do this:

public class Board{
    private int[][] grid;
    private int rows;
    private int cols;

    // Constructor and other methods here, getRows(), getCols(), etc....

    public int[][] getBoardState(int row, int col){
        int[][] boardcopy = new int[][]

        for(int i = 0; i < board.getRows(); i++){
            for(int j = 0; j < board.getCols; j++){
                boardcopy[i][j] = grid[i][j];
            }
        }

        return boardcopy;
    }
}

What should I use? Or if this is debatable, could you just explain the pros and cons of each?

sentences:
SceneGraph in Entity Component System, Transformations I'm recently learning entity component systems, and started implementing it into my test engine, however I'm having an issue integrating this with scene-graph, which I'm trying for the first time.

All my entities have a TransformComponent which transforms the entity in the scene, with it's position, rotation and scale. This is how I'm doing this:

transform.reset();

Entity entity = this.entity;

while (entity != null)
{
    if (!lockScale) transform.scale(entity.scale);
    if (!lockRotation) transform.rotate(Vector3.AXIS_Z, entity.rotation);
    if (!lockPosition) transform.translate(entity.position);

    entity = entity.parent;
}

The TransformComponent is present for all the entities, and hence it cannot be removed from the entity, I restrict it.

Now I have another component, called as CollisionComponent which contains the polygon, and a callback when a collision occurs, along with a collision tag. It updates the polygon position upon update:

polygon.setPosition(entity.position);
polygon.setRotation(entity.rotation);
polygon.setScale(entity.scale);

This is working for all the entities that are in the scene root, they are displayed at their correct positions, and also the collisions are working. The issue starts with the entity's children if they are present.

I have attached a child entity with position set to (0, 50) whose coordinate system is local to the parent entity system. But here, the graphics work correctly, on rotating the parent, the children rotate too due to the transform matrix, but the polygon stays at the local position.

The solution that I'm thinking now is to make the entity positions in global coordinate system, even if they are in the children of an entity, and have the transform change correctly even when the parent moves.

How can I do that?

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:
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:
Unity How does Time.smoothDeltaTime work I can't seem to find any actual information on what Time.smoothDeltaTime does or how it works.

I would assume it takes a rolling average of previous deltaTimes but how does it do that? Is the average asymptotic? How sensitive is it to outliers? What is it's actual intended use case?

If anyone could explain how it works, or link to a resource on what it is doing it would be really helpful.

sentences:
Dividing up spritesheet in Javascript I would like to implement an object for my spritesheets in Javascript.

I'm very new to this language and game-developement so I dont really know how to do it.

My guess is I set spritesize to 16, use that to divide as many times as it fits on the spritesheet and store this value as "spritesheet". Then a for(i=0;i<spritesheet.length;i++) loop running saving the number of sprites.

Then tile = new Image(); and tile.src = spritesheet[i] to store the individual sprites based on their coordinates on the spritesheet.

My problem is how could I loop trough the spritesheet and make an array of that? The result should be similar to:

sprite.sprites = Array(
"0",
"1"
);

If possible this would be done with one single object that i only access once, and the tile array would be stored for later reference.

I couldn't find anything similar searching for "javascript spritesheet".

Edit 2: I've come a long bit since I first posted this question and this is what I've come up with so far:

function Sprite(){
    this.size = 16;
    this.spritesheet = new Image();
    this.spritesheet.src = 'spritesheet.png';
    this.spriteCount = this.spritesheet.height / this.spritesheet.width;
    this.spriteIndex = 0;
    var sprites = new Array();

    for(i=0;i<this.spriteCount;i++){
    sprites.push(this.spriteIndex); // Could insert pretty much whatever I want
    this.spriteIndex++;
    alert('spriteIndex # ' + sprites[i] + ' pushed');
    }
}
var sprite = new Sprite();

The alert method is only for testing, it alerts from 0 and up giving me usable X and Y values for the drawing (when multiplyed by size).
If anyone has improvements please let me know.

Edit 3: I still have some trouble with the array. How would i access the index of it?
For example the first sprite should give me sprite.sprites[0] second sprite sprite.sprites[1].

sentences:
OpenGL ES texture rendered not as expected with disproportional aspect ratio triangles I cannot seem to understand how texture coordinates work.
I try to render a texture into two triangles and this is what I get

Where the expected output is a normal continuous image as you can imagine.

Triangles coordinates (where w = 1080, h = 1920):

0, 0, w, 0, 0, h,
w, 0, 0, h, w, h

Texture coordinates

0, 1, 1, 1, 0, 0,
1, 1, 1, 0, 0, 0

Texture parameters

gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);

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_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

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:
making rigid body stop using friction how am I suppose to apply friction to an object so that when I apply force it decelerates eventually to zero? Here are my physics objects:

Rigid Body "Sphere"

Collision shape: btSphereShape(0.50)
Mass: 1.0 kg
Restitution: 0.5
Friction: 10.0

Rigid Body "Platform"

Collision shape: btBoxShape( btVector3(23.0, 0.5, 23.0) )
Mass: 0.0 kg
Restitution: 0.75
Friction: 1.0

I apply central force of btVector3(0,0,-100) on key press 'W' to the sphere. The sphere moves but never stops. Is there anything else I should take into consideration? The sphere is not rolling (the force is to the center) and the damping cannot be used because it slows the object down on any force, even gravity.

What I have tried:

Added mass to the platform. I set linear and angular factors to (0,0,0) so the platform didn't move by any applied force.
Applied the negative of the total applied force. I get a working result but not how I wanted. If I had friction the object would slow down more realistically

sentences:
How to clip cut-off using different frustrum than that of original camera? How to cut plane by pyramid shape? SOURCE : http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Mitchell_LightShafts.pdf

This process is part of creating light draft effect. And I am suggested to do the described process in order to enhance performance and I really want to do it.

However I am clueless on how I can apply "frustrum perspective matrix" from other camera to my camera perspective to chop off that square plane into shapes that fit into the "frustrum perspective matrix".

I am guessing I need to do this on CPU side first? But that's as far as my wild guess goes

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:
Why doesn't x fully reach y in while(x < y) I have the following code in a coroutine

float percent = 0;

while(percent < 1) {
    Debug.Log(percent);

    percent += Time.deltaTime;
    yield return null;
}

However, percent never reaches or passes 1 (stops around ~0.98). How can I make sure that the while loop doesn't end until percent reaches 1?

sentences:
How do you create images that work for multiple resolutions? I'm currently doing some game development and I've been curious about this situation for many years.

Let's say your game has two resolutions: 640x480 and 800x600 (using small numbers just for simplicity). I have an image that I want to, no matter, take up 1/4 of the screen. For 640x480 resolution, it would be 320x240; while 800x600 resolution, it would be 400x300. There's a few ways I think of that this could be accomplished:

Make the image 320x240 and scale it up on the larger resolution (will look pixelated)
Make the image 400x300 and scale it down on the smaller resolution (loss of detail)
Create two separate images for each resolution (size bloat)

Just for 4:3 aspect ration, you probably have 5-6 resolutions that are commonly found in more professional games; plus additional ones for 16:10 and 16:9. Creating separate assets for each aspect ratio makes sense, but doing it for each resolution sounds like overkill and a huge size jump.

How do developers normally handle this sort of situation?

Thanks!

UPDATE: This information would be used for a 2D platformer.

Part of the reason that I'm interested in this is trying to keep a "level playing field" for all players no matter what resolution they are at. I don't want the 800x600 resolution player to be able to see more of the level than the 640x480 player can.

Additionally, since I really have no graphics experience, I'm not sure how much the resolution changes would affect the integrity of the images.

sentences:
game models that stand in grass The open source game Glest has models that feel detached from the ground that they sit on because of the hard edges.  In real life, grass is not flat!

What are the options and recommendations for breaking up the hard edges where the meshes of the models meet the terrain?  How do other games do it?  What are the options on a sliding scale of rendering performance and widespread GPU support?

sentences: How to animate a flip of a card in Cocos2d? I am working on a card game and would like to ask if someone could advice me how to implement a flip of a card in Cocos2D?

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:
Cross-Sections of 3D Rendered Objects I am currently trying to look into techniques that allow the calculation of arbitrary cross-sections of a 3D object or rendered volume. However, I have been unable to find much on the topic. I know of some software packages, such as the SolidWorks CAD package, that employ such techniques; as seen here:

Does anyone know of any available methods, techniques, algorithms, or tutorials that aim to achieve this result? Also, in terms of the theory of this technique and the concept of calculating it on the fly; how performant is such a technique likely to be?

sentences:
SharpDx: using maximized RenderForm I'm trying to learn DirectX via SharpDX, very new to this. What I want to do is be able to draw 2D shapes for a game I'm trying to make. So I started with the demo "MiniRect" that came with SharpDX. Since I want my game to be full-screen, I changed the RenderForm to be maximized (using WindowState) and set the FromBorderStyle to None.

I noticed that even if the form is set to maximized, it's size is always 800 by 600. In my renderloop, if I specify the location for the rectangle has 400 by 300, it is drawn in the middle of the screen. If I try to set the location via mouse-click (using the RenderForm's MouseClick event, there is always an offset present between where the mouse was clicked and where the drawing shows up.
My system DPI is set to the standard (96) so there shouldn't be any scaling. But it looks like there is a scaling factor of about 2.4

If it's not the DPI settings, does anyone have any idea what this be related to? The problem doesnt happen if the RenderForm is not maximized.
Is there another way to be drawing full-screen using SharpDX?

Thanks

sentences:
Lerp velocity in specific time How to lerp velocity to 0 in specific time? For example in two seconds? I need this for jumping.

velocity.Y = MathHelper.Lerp(velocity.Y, 0, [time]);

sentences:
Building a simple bomberman game with Node.js and Socket.io I'm building this game mostly because I want to experiment with Node.js and Socket.io, and the game is more like a proof of concept.

To start with, I have a 2D grid system as the game map.

_________________________________________.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|.

Each position with values:

0: empty
1: wall - can not be destroyed by explosion
2: obstacles - can be destroyed by explosion
3: bomb
4-9: some powerups
10>=: the id of player

CLIENT-SIDE

I'm not planning to have any game logic happen on the client side, so the client simply send left, right, up, down and plant a bomb command to my server. There is however, some simple check that happen on the client side - 1. check that there's no wall at the direction the client is moving to; 2. the client didn't plant a bomb in the last 3 seconds.

The client also receives the state of the map as a 2d array and knows how to draw everything using that info.

SERVER-SIDE

Main game logic happen on the server side, which includes updating the position of player, calculating the damage of bomb explosion - destroy stuff in the range, except walls and space behind walls

Questions:

When the player is moving, he won't see himself moved until he gets the data back from server that updates his position. So I worry this delay may affect user experience, is it better that I move his position on his browser right away, and only update other players' position using info received from server, that means his own movement is rendered away, while his position info is sent to server.
When rendering everything, it's simple to implement that whenever anything on the map move or change, redraw everything with the new data. Is that a waste? Can I only update things that change, for example, a player move right 1 position, nothing else changed on the game map, do I still have to redraw everything? I think I'm going to use Canvas to render.
Please feel free to comment or answer if you think there are places I can improve or I simply thought wrong, thanks!

sentences:
how do I tile this generated terrain infinitely around the player? i made a script that instantiates cubes with for loops and perlin noise. is there any way i can tile this infinitely around the player? here is the script for the generation of one tile

public GameObject grass;
public int mapSizeX = 50;
public int mapSizeZ = 50;

public float heightScale = 20f;
public float detailScale = 20f;

float seed;
// Use this for initialization
void Start()
{
    //if (instance == null)
    //   instance = this;
    for (int x = 0; x < mapSizeX; x++)
    {
        for (int z = 0; z < mapSizeZ; z++)
        {
            int y = (int)(Mathf.PerlinNoise((x + seed) / detailScale, (z + seed) / detailScale) * heightScale);

            GameObject g = Instantiate(grass) as GameObject;
            g.transform.position = new Vector3(x, y , z);
            g.transform.SetParent(this.transform);
        }
    }
}

sentences:
Objects fall off screen, because stay one behind another[unity] I m learning unity, I placed objects on a scene, camera is looking at them and displays them fine.

but in 3d, I can see they are one behind another, so when i hit play button, they just fall!

Pic:

is there any specific button like "align on one level" in unity?

sentences:
How to slow down my Variable Timestep Loop in Java I am currently developing a game in Java and I ran into a problem

At first, I thought my game loop was working well as it was giving a similar amount of FPS as the tutorial I was following

Then I reach to the phase where I started implementing input from the user. When the user entered in the W key the sprite would move very rapidly to the bottom of the screen and then back up to the top for no explained reason

I think it is something to do with my game loop. As I did my research I deduced that my game loop is running way to fast. The only problem is that I haven't been able to slow down the loop. Or maybe it is a totally different problem

Can anyone please help

Run method of my game:

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 ;

    /*  Game loop use:
     *      From timer calls to while loops to recursive function calls to keep the game alive
     *      Until a certain condition is meet (The loop)
     *
     *      A way to delay the length of each loop iteration so you get a stable frame rate (The timing mechanism)
     *
     *      A way to make the game speed remain independent of the speed of the loop (The interpolation)*/

    //This is a variable timestep loop
    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;
            //While times updated per second is greater than one (allowing updates to be seen) call tick method of Handler class

            /* Fixed timestep loops vs Variable timestep loops:
             *
             *      Variable timestep loops: Great because the game will seem consistent regardless of how fast the players's computer is
             *          Allowing it to work on a variety of machines and update the game logic with very high attention to details happening in the game
             *          Graphics latency is not a problem as things are drawn as they change
             *
             *
             *
             *      Fixed timestep loops: You know that every single timestep
             *          will take up the exact same length of time. Allows for consistent gameplay
             *          regardless of how fast a machine is as you know the tick rate of your machine
             *          Works wonderfully for math-heavy games with physics operations. Also good for networked games as packets are going and coming at a generally constant speed.
             *          Keeps game logic running at a very low rate while the frame rate can still and frame rate really high
             *                                                            */
        }
        stop();
    }
}

'''

Thanks!!!

sentences:
Creating 3D water on Unity for iOS/Android I want to render an ocean where players can change waves’ amplitude in real-time. Initially, I would render rolling waves (see picture). As the amplitude increases, I need to transition the rolling waves into breaking waves (see picture). For now, I am not going to show the shoreline onscreen so I don’t need to render breaking waves interacting with the shoreline; I only need breaking waves on the open ocean.

I’ve tried three different approaches so far and I’ve only had success with rolling waves using approach 1. Breaking waves have been impossible so far with all three approaches.

Approach 1: Mesh deformation

I can create smooth rolling waves using the Sine and Gerstner equations.
Since I can’t use these equations for breaking waves, I tried to implement them by using this free plugin whose output is similar to this paid mesh deformation plugin. But there are 2 problems with this plugin approach:

Problem 1: There is no smooth transition between rolling waves generated by approach 1a and the breaking waves generated by the Deform plugin

Problem 2: The output of the plugin does not look similar to real breaking ocean waves in three different ways:

i. No smooth blending with the ocean surface

ii. A large depression is created below the crest

iii. The entire wave is the same height (rather than with more realistic variations)

I considered using vertex shaders but this approach seems similar to mesh deformation.

Approach 2: Fluid dynamics + metaballs

To render an ocean I will need thousands of particles which will be too expensive in terms of performance (especially for mobile devices).

Approach 3: Using mesh files

I can create breaking waves using some 3D software like in this post but then I can’t modify the ocean in real-time. It will be more like a pre-rendered simulation.

To summarize, I am looking for an approach where I can vary ocean waves’ amplitude for a smooth transition between rolling waves and breaking waves.

sentences:
How can I morph between images in real time? So, I need to be able to make a picture slowly transition into another picture, not as a transparency fade, but as a morph.
And I need that in real time.

More on "morphs":
When you outline two areas in two separate images which are supposed to turn into each other over a number of animation frames; and then their colors and outlines slowly blend until one image becomes another.
That is what I need.
I was initially hesitant to ask this, because I was under the impression that it has traditionally been a brutal algorithm to force your computer to perform.

sentences:
Quaternion based rotation and pivot position I can't figure out how to perform matrix rotation using Quaternion while taking into account pivot position in OpenGL.What I am currently getting is rotation of the object around some point in the space and not a local pivot which is what I want.
Here is the code [Using Java]

Quaternion rotation method:

  public void rotateTo3(float xr, float yr, float zr) {

    _rotation.x = xr;
    _rotation.y = yr;
    _rotation.z = zr;

    Quaternion xrotQ = Glm.angleAxis((xr), Vec3.X_AXIS);
    Quaternion yrotQ = Glm.angleAxis((yr), Vec3.Y_AXIS);
    Quaternion zrotQ = Glm.angleAxis((zr), Vec3.Z_AXIS);
    xrotQ = Glm.normalize(xrotQ);
    yrotQ = Glm.normalize(yrotQ);
    zrotQ = Glm.normalize(zrotQ);

    Quaternion acumQuat;
    acumQuat = Quaternion.mul(xrotQ, yrotQ);
    acumQuat = Quaternion.mul(acumQuat, zrotQ);

    Mat4 rotMat = Glm.matCast(acumQuat);

    _model = new Mat4(1);

   scaleTo(_scaleX, _scaleY, _scaleZ);

    _model = Glm.translate(_model, new Vec3(_pivot.x, _pivot.y, 0));

    _model =rotMat.mul(_model);//_model.mul(rotMat); //rotMat.mul(_model);

    _model = Glm.translate(_model, new Vec3(-_pivot.x, -_pivot.y, 0));

   translateTo(_x, _y, _z);

    notifyTranformChange();
   }

Model matrix scale method:
      public void scaleTo(float x, float y, float z) {

    _model.set(0, x);
    _model.set(5, y);
    _model.set(10, z);

    _scaleX = x;
    _scaleY = y;
    _scaleZ = z;

    notifyTranformChange();
  }

Translate method:
      public void translateTo(float x, float y, float z) {

    _x = x - _pivot.x;
    _y = y - _pivot.y;
    _z = z;
    _position.x = _x;
    _position.y = _y;
    _position.z = _z;

    _model.set(12, _x);
    _model.set(13, _y);
    _model.set(14, _z);

    notifyTranformChange();
   }

But this method in which I don't use Quaternion works fine:

  public void rotate(Vec3 axis, float angleDegr) {
    _rotation.add(axis.scale(angleDegr));
    //  change to GLM:
    Mat4 backTr = new Mat4(1.0f);

    backTr = Glm.translate(backTr, new Vec3(_pivot.x, _pivot.y, 0));

    backTr = Glm.rotate(backTr, angleDegr, axis);

    backTr = Glm.translate(backTr, new Vec3(-_pivot.x, -_pivot.y, 0));

    _model =_model.mul(backTr);///backTr.mul(_model);
    notifyTranformChange();

   }

sentences: 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:
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:
Bilinear filtering: Selecting pixels to interpolate between When looking for implementations of bilinear filtering online, all the ones I can find seem to just pick the current pixel, and the three pixels to the bottom and right side of the current pixel.

However, is this even correct, or do you actually have to get the nearest neighbors to the current pixel (from the 8 surrounding pixels) depending on the texture coordinate?

Also, how would I select between the 8 options as efficiently as possible in shaders?

sentences:
multi-thread in mmorpg server For MMORPG, there is a tick function to update every object's state in a map. The function was triggered by a timer in fixed interval. So each map's update can be dispatch to different thread. At other side, server handle player incoming package have its own threads also: I/O threads. Generally, the handler of the corresponding incoming package run in I/O threads. So there is a problem: thread synchronization. I have consider two methods:

Synchronize with mutex. I/O thread lock a mutex before execute handler function and map thread lock same mutex before it execute map's update.
Execute all handler functions in map's thread, I/O thread only queue the incoming handler and let map thread to pop the queue then call handler function.

These two have a disadvantage: delay. For method 1, if the map's tick function is running, then all clients' request need to waiting the lock release. For method 2, if map's tick function is running, all clients' request need to waiting for next tick to be handle.

Of course, there is another method: add lock to functions that use data which will be accessed both in I/O thread & map thread. But this is hard to maintain and easy to goes incorrect. It needs carefully check all variables whether or not accessed by both two kinds thread.

My problem is: is there better way to do this? Or from practical view, the delay can be accepted because nothing will happen between 2 tick (the world is driven by continuous tick, all object will paused in 2 tick's interval) Generally, the interval is about 50ms to 100ms

Notice that I said map is logic concept means no interactions can happen between two map except transport. I/O thread means thread in 3rd part network lib which used to handle client request.

sentences: Blur shader without render textures? Is it possible to append a blur shader to a standard (diffuse) shader ? I am looking for a way to do this as Unity indie doesn't allow render textures.

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:
How do I launch a ballistic projectile to hit a moving target, given: launch position & angle, target position & velocity? This problem is in 3D space. My question is: How do you find the initial velocity of a projectile that flies under constant gravity, so that it hits a target moving with constant velocity, given the parameters:

Launch Position
Launch Angle
Target Position
Target Velocity
Acceleration due to Gravity

Most of the answers I find solve the problem using Launch Speed instead of Launch Angle.

The reason why I want to use Launch Angle, rather than Launch Speed, is because the arc of the projectile doesn't look good when solving with Launch Speed. The low angle is too low, and the high angle is too high.

My goal is to be able to adjust the arc of the projectile to be more visually pleasing, while still being able to hit the moving target 100% of the time.

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:
Swaying Camera when Walking You can see the effect in many games. The camera sways or wiggles a bit while walking to make the movement feel more realistic.

I have implemented a camera in my game. (Who'd have thunk it?) So is there a common approach to build this swaying effect in?

sentences:
How can I load another form containing a new level when my player reaches the current level's exit? I am coding a very basic side-scrolling game in C#, using Windows Forms.

I want to connect my game's levels with 'exit points'. When the player touches an exit point, a new form should be loaded immediately. How can I do this?

sentences:
Using grids from a different script I suspect there is a very simple answer to this one but I have been scratching my head trying to figure it out for a while.

I have this piece of code that works fine. It effectively adds the location of the children of my GameObject to a grid array.

  public void AddToGrid()
       {
        Transform[,] grid = new Transform[totalGridWidth, totalGridHeight];
        foreach (Transform children in transform)
           {
               int roundedX = Mathf.RoundToInt(children.transform.position.x);
               int roundedY = Mathf.RoundToInt(children.transform.position.y);
               grid[roundedX, roundedY] = children;

           }
       }

However, I need to modify it so that rather than taking the children of the GameObject that runs this script - I need it of the children of a different GameObject.

i.e. this script sits on GameObject A, however I need to change it to grab the position of the children on GameObject B. I don't want to simply add this script also to B as there is other stuff in the script that won't make any sense and I need to keep the array in A.

I suspect (hope) there is an easy answer here, but am struggling to figure it out.
Thanks for the assistance.

sentences:
Camera Control Techniques in Games I am an MPhil student in Computing Science working on the problem of camera control in graphics. Though the literature of camera control dates back to the end of 1980s, the majority of them (up to my knowledge) is mainly academic and rarely used in games.

Now part of my thesis should be dedicated to camera control methods used in games. But the problem is that I have not implemented all the games in the world, so I can't speak about them. But I suppose there are some references that game developers usually use.

Can anybody help me with this? Even if it is from your own experience rather than a book.

sentences:
Client not executing commands in Unet Edit

Okay, so I partially solved the problem by adding a rigid body component to the capsule. I read somewhere that apparently you have to have one in order to move on the server.

Problem 2

The next problem I have is that I can now move a capsule that is spawned by the client fine and the host can move it as well as many times as they like. The problem I am getting now is that when the host spawns a capsule the client cannot move it at all and I get a sort of glitch effect on the client side and the capsule still doesn't move on the host side. Is there a reason why it would only work one way and not the other way around? I thought at first it might have to do with Spawn vs SpawnWithClientAuthority but that doesn't seem to make a difference.

Project Summary

I have a pretty simple multiplayer project, all I want to do is have one player host and the other join as a client. Once they are joined together the two players can spawn a capsule and then when the user clicks on a capsule. They should be able to pick it up and move it around the scene and the other player should be able to see this action. I can get both players to connect to the server and spawn their own capsule and both players can see this. The movement script is done as well. However, it is only transmitted on the host side. When the client picks up the object it does not update on the server.

Problem

I have done a bit of debugging and have found that when I call the command on the client it is not being executed at all through line breaks and simple debug statements.

Code

public void OnInputClicked(InputClickedEventData eventData)
    {
        Debug.Log("clicked");
        if (isLocalPlayer)
        {
            if (Physics.Raycast(transform.position, direction: transform.forward, hitInfo: out hit, maxDistance: range))
            {
                Debug.Log("Hit capsule");

                objectID = GameObject.Find(hit.transform.name);
                objNetId = objectID.GetComponent<NetworkIdentity>();
                playerIDThatClicked = player.GetComponent<NetworkIdentity>();

                CmdAssignAuthority(objNetId, playerIDThatClicked);
                Debug.Log("grabbed");

            }
            else
            {
                //if we are releasing the object we want to unassign our authority
                if (objNetId != null)
                {
                    CmdAssignAuthority(objNetId, playerIDThatClicked);

                    objNetId = null;
                    Debug.Log("released");
                }
            }
        }

    }

[Command]
    void CmdAssignAuthority(NetworkIdentity target, NetworkIdentity player)
    {
        Debug.Log("inside cmd");
        current = target.clientAuthorityOwner;
        playerconn = player.connectionToClient;

        if (current != null && current != playerconn)
        {
            Debug.Log("Had authority now removing and replacing");
            target.RemoveClientAuthority(current);

            target.AssignClientAuthority(playerconn);

        }
        else if (current != null)
        {
            Debug.Log("removing authority");
            target.RemoveClientAuthority(current);

        }
        else if (current == null)

        {
            Debug.Log("No authority, adding one now");
            target.AssignClientAuthority(playerconn);

        }
        else {
            Debug.Log("CmdAuthority error");
            target.RemoveClientAuthority(playerconn);

        }
    }

Question

Am I calling this command correctly? The script is attached to a player prefab and the capsule prefab contains a network id and a network transform. I am pretty new to Unet and this feels like a noob mistake.

sentences:
What is the basic skill set that a Professional Game Programmer needs to have? I have a very general question which bothers me but i want to add some details first. I'm a core Java programmer. I have independently created some small games in Java for fun. Now, the more I'm looking into professional game development the more I'm getting confused. This is because, whenever I Google about some game development topics or visit any fora etc., I come across different suggestions.

Some will say C++ is good, while some will say JAVA may be better, while still others will say some other language is the ur-language, like Python, Lua, UnrealScript, etc. Also it is suggested that one ought to have knowledge of game engines like Unreal, Torque, Blender, Panda, etc and knowledge of OpenGL, AI, Collision Detection is required. I have even created a game using Android SDK.

What I want to ask is:

What is the basic skill set that a Professional Game Programmer needs to have? Is it any 1 Programming Language + 1 Scripting language + 1 Game engine knowledge + OpenGL? (Phew!!)
If I want to enter into Game Industry as Gameplay Programmer or AI programmer then can I get into it with my current skills and portfolio (as stated above)?
Is learning one programming language is enough for Game Development?

Any guideline will be helpful.

sentences:
Progress bar in Super Hexagon using OpenGL ES 2 (Android) I'm wondering how the progress bar in Super Hexagon was made.  (see image, top left) Actually I am not very sure how to implement a progress bar at all using OpenGL ES 2 on Android, but I am asking specifically about the one used in Super Hexagon because it seems to me less straightforward / obvious than others: the bar changes its colour during game play.

I think one possibility is to use the built-in Android progress bar. I can see from some Stackoverflow questions that you can change the default blue colour to whatever you want, but I'm not sure whether you can update it during the game play.

The other possibility I can think of for implementing a progress bar is to have a small texture that starts with a scale of 0 and that you keep scaling until it reaches the maximum size, representing 100%. But this suffers from the same problem as before: you'll not be able to update the colour of the texture during run-time. It's fixed.

So what's the best way to approach this problem?

*I'm assuming he didn't use a particular library, although if he did, it would be interesting to know. I'm interested in a pure OpenGL ES 2 + Android solution.

sentences: How do I parent an object to a bone in the blender hierarchy? So, I'm trying to make a simple RPG game using Blender and Unity. I would like to have an empty object to be used as a weapon holding position parented to my right hand bone so that I can switch weapons in and out and they'll be able to animate along with my character by being the child of the empty position. The problem I am having is that I can't get the empty position to be a child of the specific right hand bone, only the armature. Is there a way to make this work? Also, if this isn't a good procedure to accomplish what I am trying to do, please enlighten me with the proper way, I'm kind of a noob, thanks.

sentences:
Why is my game object generated by a custom Unity editor script missing its sprite? I have a number of sprites that I generate outside of Unity.  I'd like to automate the process of importing these sprites into Unity as fully-configured game objects.  I'm trying to do this through a Unity editor script, but I'm having some difficulty.  When I run my script, my game object is saved as a .prefab as expected.  However, the Sprite I'm assigning to my game object's SpriteRenderer component is missing:

In my script, I'm assigning my SpriteRenderer's sprite property to a Sprite object that I dynamically create in the script.  Here's the relevant excerpt from my editor script:

GameObject gameObject = new GameObject(fileName);

SpriteRenderer spriteRenderer = gameObject.AddComponent<SpriteRenderer>();

// texture size will be replaced during the LoadImage() call
Texture2D texture = new Texture2D(1, 1);
texture.LoadImage(File.ReadAllBytes(Path.Combine(generatedOutputPath, fileName + ".png")));

spriteRenderer.sprite = Sprite.Create(
    texture,
    new Rect(0.0f, 0.0f, texture.width, texture.height),
    new Vector2(0.0f, 0.0f)
);

PrefabUtility.CreatePrefab("Assets/Prefabs/" + fileName + ".prefab", gameObject);
DestroyImmediate(gameObject);

I can verify through logging that the image path to my .png is correct and that the Texture2D and Sprite objects seem to be instantiated correctly.  For example, I can do this:

// logs "580" as expected
Debug.Log(texture.width);

What am I doing wrong?  How can I save this game object as a .prefab without losing its sprite information?

sentences:
Meaning of errors when compiling Source animated assets This question will be composed of 3 somewhat separate questions regarding the creation of animated assets in Source. The documentation is quite poor and I am having a hard time understanding the errors that the model compiler throws.

1. Parent bones

I was trying to modify the collision mesh of an existing animated asset. I was able to make it work OK when animated in Blender but when compiled it throws something along the lines of "joint1 and joint2 have no parents, there can't be two root bones".

In the model viewer I can see two collision boxes, one static and another that is animated but which doesn't behave as I expected (it moves like the original collision mesh of the asset).

The problem disappears when I make all the vertices of the collision mesh have the same parent bone.
See https://developer.valvesoftware.com/wiki/Studiomdl_Data#Triangles
, it would be the  field (first column).

So the question is: does source allow you to have a collision mesh where all vertices don't share the same parent bone ? if not, how could I go around making a collision box that could be deformed (not only translated with the common parent bone) ?

2.  Conflicting bone names?

Sometimes, when creating certain skeletons the compiler throws the following error:

<Sergiy> Conflicting bone names: root vs root vs aaaa, try deleting one of the bones.
This is an old bug in studiomdl code that is about to be deprecated, so it may not be worthwhile fixing it

and the compilation is totally stopped. I tried renaming the bones, and changing the bones hierarchy to no avail. It should be noted that there are no two "root" named bones as the error might suggest. Even more, sometimes it shows three different named bones.

I don't understand what could be the cause of the error.

3. bone_followers

Finally, I noticed that the .qc of the decompiled model of some asset has a part like this:

$KeyValues
{
    bone_followers
    {
        "bone" "joint15"
    }
}

what does this (bone_followers) do?

sentences:
How do I implement the parallax effect in 3D graphics? With a perspective projection matrix and camera system already in place, I have a scene with a small jet fighter flying high over a wide and deep canyon with many cliffs and rocky surfaces; these are all being rendered as wireframes for now. The camera is following the ship which is flying entirely on the X-Z plane.

Right now, when the ship moves by some amount r, the entire canyon moves by that same amount in the opposite direction. I want to have parts that are further away from the camera to move slower, so I need parallax.

If I were going to implement parallax, in which part of the rendering system would it go, the projection matrix?

Below is a screenshot of the game as it is. The ship is moving forward and about to pass through some rocky crags.

sentences:
I found out how to rotate both Sphere and Cube (1) like a Turret facing a target but why is it so hard? I just added 3 objects to my scene to a new project.
To be sure where the problem is I created a new project.

Then added to the scene: 2 Cubes and 1 Sphere 1 empty GameObject.

Cube is the target.

Sphere and Cube (1) are the Turret and both are childs of the empty GameObject.
The script is attached to the empty GameObject.

The logic say if I will rotate the empty GameObject both Sphere and Cube (1) will rotate at the same time. But I found that if I'm not setting both Sphere and Cube (1) same direction before running the game they will never face to the target only the Sphere.

I had to figure out where is the Sphere facing direction before running the game and change the Cube (1) to face the same direction of the Sphere on the Z Blue axis.

I can't figure out yet and understand why is it so hard to rotate two objects at the same time to be facing the same direction (target).

Now it's working once the sphere and the cube (1) are facing same direction before running the game. It didn't work if I made them childs or parents or changed the Cube (1) position to 0,0,0 nothing.

They were both rotating but never faced the target only the Sphere faced the target.

So now each time I want to rotate two objects at the same time to face another gameobject like a turret, or cannon or anything that is built of two parts I need first to make them facing same direction ?

I guess I did something wrong but not sure what.

The script:

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

public class Rotateturret : MonoBehaviour
{
    public float speed = 3.0f;
    public GameObject m_target = null;
    Vector3 m_lastKnownPosition = Vector3.zero;
    Quaternion m_lookAtRotation;

    private void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (m_target)
        {
            if (m_lastKnownPosition != m_target.transform.position)
            {
                m_lastKnownPosition = m_target.transform.position;
                m_lookAtRotation = Quaternion.LookRotation(m_lastKnownPosition - transform.position);
            }

            if (transform.rotation != m_lookAtRotation)
            {
                transform.rotation = Quaternion.RotateTowards(transform.rotation, m_lookAtRotation, speed * Time.deltaTime);
            }
        }
    }

    bool SetTarget(GameObject target)
    {
        if (!target)
        {
            return false;
        }

        m_target = target;

        return true;
    }
}

Here is a link for a short video clip I recorded showing what I mean:

Video clip of the problem

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:
Android OpenGLES, getting number of fragments passed depth test/Occlusion Query? Afeter reading many blogs and searching on Internet, I did not get any sloution for getting number of fragments/pixels which are occludded or not occludded of the object on OpenGL ES3.0 Android version.
GL_SAMPLES_PASSED is not present on OpenGL ES3.0.
Is there any way to get these occluded or non occluded fragments on Android OpenGl ES3.0?

sentences:
How to determine what animation to render in a component-based system without breaking encapsulation? In a component based system, how should change the rendering/visual state of an entity such that I know what animation to use, without breaking encapsulation?

My guess is that it would have to be message-based system, not a query-based one, because having a few ifs checked every frame to determine the right animation based on the values of the attributes of the other components doesn't sound very efficient.

sentences: Why Canvas is used more than JPanel for making games in Java? I saw many ludum dare games, which are written in Java ( using it's standart library ), I checked the code of one or two of them and the thing that I saw is in their Game class, they extends Canvas.So my question is why they extends Canvas not JPanel?

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:
Make a bullet move towards the mouse position Before you give me a link to another post look first, just in case.

So I'm making a top down game where the person can shoot around, I want the bullets to move towards the mouse, I have tried this:

angle = (float) Math.atan2(pmx - x, pmy - y) * 180 / Math.PI;
x += this.getVelX() + (Math.cos(angle * Math.PI / 180) * 15);
y += this.getVelY() + (Math.sin(angle * Math.PI / 180) * 15);

The pmx means previous mouse position where I clicked, and the same for pmy.
But this doesn't work properly look at this screenshot, the gun is pointed towards the mouse (the screenshot doesn't show the mouse) and the yellow squares are the bullets.

How it moves the bullets is the goes towards the mouse about 50 pixels then curls down to the left and inverted for the other side.

After looking at Theraot's post Section B:

int speed = 15;
int velocityX = pmx - x;
int velocityY = pmy - y;
length = Math.sqrt(velocityX * velocityX + velocityY * velocityY);
velocityX *= speed / length;
velocityY *= speed / length;

x += velocityX;
y += velocityY;

This has worked to move it the direction of the mouse, but a new issue has occurred whether this is my issue or not I don't know, as I'm not that good at maths, what it does is moves in the correct direction and when it gets to the mouses old position where it was clicked it stop moving:

If there is a way to stop this from that method can someone tell me if not which Section should I use instead?

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:
How can I fill a Polygon with a certain color on Pixmap? Libgdx allows to fill area on a Pixmap just with circles, rectangles and triangles, but I need to fill complex figure that can be described with Polygon class, so how can I do that?

I was thinking about polygon triangulation, but it seems sophisticated to me.

May be exists some better way to fill complicated shapes with pixels?

sentences:
Rotating object around moving object/player in 2D I am trying to implement a camera which rotates around the world around the player. I have found many solutions online to the task of rotating an object about the origin, or about an arbitrary point. The procedure seems to be to translate the point to be rotated about to the origin, perform the rotation, translate back, then draw. I have gotten this working for rotation around the origin as well as for a fixed point. Rotation of objects around the player works as well, provided the player does not move. However, if the objects are rotated around the player by some non-zero degree, if the player moves after the rotation it causes the rotated objects to move as well. I probably have done a poor job explaining this so here's an image:

And here's the code for the behavior:

renderx = (Ox - Px)*cos(camAngle) - (Oy - Py)*sin(camAngle) + Px;

rendery = (Ox - Px)*sin(camAngle) + (Oy - Py)*cos(camAngle) + Py;

Where (Ox,Oy) is the actual position of the object to be rotated and (Px,Py) is the actual position of the player. Any ideas? I am using C++ with SDL2.0.

sentences:
Libgdx, lines between tiles I'm trying to make smooth following camera using this algorithm:

camera.position.add((pos.x - camera.position.x) * 1.2f * deltaTime, (pos.y - camera.position.y) * 1.2f * deltaTime, 0);

It works fine(camera movements are smooth), but when I move the player appears this artifacts:

Player move() function:

moveX(SPEED  * deltaTime);

protected void moveX (float amount) {
        float newX = pos.x + amount;
        if (!map.doesRectCollideWithMap(newX, pos.y, getWidth(), getHeight()))
            pos.x = newX;
    }

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:
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 to store game state for a multiplayer board game eg. poker First Approach: Store the state in database and play with database queries. Could a database handle the load, as poker is quite fast paced, and I have to query/update database for each player move.

Second Approach: Store the state in memory. What kind of architecture/implementation is needed to achieve this?

What are the pros/cons of each approach, what other options do I have?

What is the best fit for poker, and/or chess?

labels: multiplayer unity legal unity unity opengl community-management 3d c# game-design xna education c# android architecture c++ xna unreal-4 legal xna java android unity android javascript unity terrain-rendering javascript unity unity unity unity java monogame 3d algorithm game-design godot libgdx unity unity 2d sprites unity javascript unity game-maker opengl java c++ graphics c++ color unreal unreal-4 unity unity 3d sprites mathematics procedural-generation unity gui game-design unity libgdx shaders android android c++ assets terminology java unity java vector collision-detection tiles opengl unity java unity unity xna rotation unity unity game-design c++ unity 2d shaders android algorithm opengl c# unity unity opengl unity libgdx collision-detection unity java java unity box2d unity unity ai unity unity unity c++ unity unity unity unity c++ mathematics unity unity particles graphics opengl legal browser-based-games xna unity libgdx c++ xna sfml game-design architecture unity opengl level-design android entity-system opengl 2d rendering c++ c# unity architecture tiles opengl xna c# c# unity c# c xna 2d unity unity directx unity opengl unity unity 2d xna unity unity console unity unity java collision-detection android unity gui c# 2d 2d android multiplayer unity editors unity rendering textures box2d opengl architecture c++ opengl ai networking c++ c++ unity mathematics java directx9 shaders algorithm c++ android unity c# unity rigging android unity 3d unity unity unity game-design opengl-es java physics game-design multiplayer hlsl c++ physics c++ unity opengl c# xna ios c++ architecture algorithm java c++ udk tilemap path-finding unity unity opengl collision-detection javascript game-design unity c++ sky tiles entity-system lua unity javascript physx unity unity c++ unreal-4 animation 2d licensing c++ unity unity game-maker c++ input unity unity unity xna unity models android shaders c++ vector c++ xna opengl libgdx unity collision-detection rotation xna 2d java mathematics c++ unity python opengl unity algorithm game-design xna-4.0 unity unity unity lighting architecture javascript rotation textures directx c++ unity flash game-design opengl shaders ai xna c++ xna cocos2d-x unity unity opengl unity unity 2d xna java 2d unity unity hdr godot multiplayer camera python c++ c# unity c++ android collision-detection networking javascript unity tiles savegame opengl javascript 3d unity 2d shaders mathematics ruby rendering matrix software-engineering android leaderboards c++ java 2d unity ios unity sound-effects android xna-4.0 rendering unity opengl 3d unity 3d unity unity unity libgdx opengl collision-detection java unity directx11 3d c++ unity physics physics minecraft-modding java unity opengl unity unity 2d unity unity artemis software-engineering collision-resolution unreal-4 collision-detection path-finding xna xna unity 2d unity unity android shaders c++ unity libgdx xna 2d java box2d c++ geometry c++ unity android xna python c# c# unity collision-detection java camera 3d unity unity blender c# mathematics collision-detection c# java java java unity 3d xna android java unity unity unity opengl unity iphone c# unity unity physics unity unity unity multiplayer opengl camera c++ image box2d 2d godot xna sfml game-design java game-mechanics input textures c# rendering java xna cocos2d-x opengl ogre java c# libgdx java unity glsl nintendo unity procedural-generation mathematics game-design android opengl unity unity graphics c# phaser unity balance physics bullet-physics java unity unity opengl c++ unity unity physics unity unity 3d rendering unity sdl mathematics lua java opengl unity unity graphics unity unity java unity unity architecture unity architecture 2d opengl sprites opengl ios opengl-es ai copyright 2d mmo opengl java unity architecture opengl c++ unity opengl c++ collision-detection shaders terrain java libgdx unity opengl box2d path-finding shaders unity unity flash quake3 android algorithm architecture unity minecraft-modding 2d unity shaders xna unity c# unity game-design unity game-maker textures opengl playstation4 andengine 2d procedural-generation path-finding ai unity 2d opengl libgdx xna maps unity data-structure javascript competition c# 3d blender xna physics opengl java gui game-maker java iphone unity 2d python unity opengl c++ unity directx11 unity directx collision-detection physics opengl unity game-loop movement 3d physics tilemap opengl java camera game-maker procedural-generation opengl opengl movement c# 2d networking unity c# legal rpg c++ xna physics unity sdl2 camera ogre tiles unity directx graphics tilemap path-finding javascript unity unity tiles collision-detection physics window-management 2d unity unity sdl2 xna xna software-engineering networking unity unity unity collision-detection xna libgdx unity unity unity opengl graphics architecture textures unity 2d java godot java path-finding opengl java unity unity c++ unity c# unity legal unity 2d unity xna physics opengl unity mathematics android 2d blender python multiplayer ai libgdx 2d ai terrain nintendo c# libgdx animation game-mechanics c# sprites collision-detection java networking sales collision-detection opengl-es unityscript game-industry python algorithm libgdx unity directx unity physics 3d 2d cocos2d-iphone collision-detection unity c# blender unity unity xna unity collision-resolution procedural-generation xna c++ unity unity graphics collision-detection particles android flash unity physics javascript platform camera java unity unity unity c++ unity c# unity opengl opengl multithreading 2d 2d javascript opengl unity rendering unity unity 2d collision-detection unity ios game-design shadows physics unity game-design 2d android android deferred-rendering unity java android javascript xna c++ unity unity c# unity godot android unity c++ collision-detection unity architecture c++ unity unity c++ unity unity 2d 2d game-mechanics procedural-generation steam 2d unity unity unity procedural-generation java textures opengl-es opengl c++ unity hlsl architecture c# xna opengl ios 2d console card-game unity javascript unity iphone java opengl opengl 2d performance mathematics unity unity mathematics procedural-generation javascript unity c# java unity random skeletal-animation unity 2d unity game-design movement unity xna java game-maker scripting algorithm c++ unity android unity unity unity xna-4.0 input unity unity 2d 2d unity sprites android maps xna ai unity opengl unity opengl rotation javascript textures unity opengl nintendo physics-engine databases unity java unity ai game-design shaders unity unity physics unity c++ c# unity lwjgl java android performance controllers java unity physics architecture game-design architecture java rendering unity android algorithm c++ c++ iphone unity javascript content-rating libgdx libgdx opengl algorithm iphone javascript game-mechanics unity game-industry architecture frame-rate unity xna opengl algorithm opengl 2d 3d python xna game-design movement unity minecraft-modding physics unity legal 2d animation c# c# unity c++ java animation shaders unity software-engineering unity 3d development-speed unity opengl 2d direct3d12 directx11 java c++ javascript data-structure collision-detection unity networking unity raycasting xna ios java unity databases unity unity opengl libgdx opengl c# directx11 shaders java graphics-programming unity opengl xna architecture java unity directx mathematics unreal-4 unity opengl opengl-es architecture udk javascript 2d image game-design c# c++ unity actionscript-3 2d xna culling c# html5 algorithm java unity unity opengl vulkan unity mathematics tiles xna java animation unity lighting xna level-design c++ java animation xna unity javascript java c# unity unity opengl mission-design unity unreal-4 c++ c# unity opengl tools c# unity unity c# directx openscenegraph index-buffer c++ javascript directx11 c# libgdx game-design unity unity xna mathematics unreal-4 unity unity mathematics shaders c# mathematics unity android 3d-meshes c++ fluid-dynamics unity opengl c++ geometry unity unity unity unity scripting unity android java architecture game-maker xna collision-detection 2d unity directx hlsl opengl unreal-4 c++ collision-detection xna collision-detection legal java algorithm unity android unity unity unity c# javascript algorithm game-industry xna algorithm 2d unity lua unity xna tiles 2d opengl c++ unity unity windows procedural-generation unity unity c++ 2d unity xna collision-detection xna opengl 2d console legal architecture iphone tiles textures c# unity c++ algorithm xna android mathematics c++ mathematics unity opengl unity unity java voxels 2d c++ 2d unity 2d unity box2d collision-detection unity architecture opengl gui unity mathematics xna c++ sdl flash android geometry unity directx c++ 3d unity c++ terminology mathematics unity java shaders c# unity statistics rts tiles opengl unity three.js unity xna opengl java 3d 3d opengl-es2 unity unity udk unity c++ javascript animation physics unity unity opengl xna-4.0 c++ unity java unity events c# unity unity c++ xna unity java opengl ai actionscript-3 character collision-detection unity c++ unity lighting xna physics-engine directx opengl opengl networking c++ unity opengl monogame android opengl opengl flash xna game-industry c++ unity shaders xna unity unity javascript directx11 matrix cocos2d-x opengl opengl directx11 unity unity unity 3d opengl opengl game-design c++ unity opengl javascript android opengl game-mechanics unity unity game-design opengl unity c# android unity unity android c++ 2d vector opengl c# unity android 2d javascript android opengl c++ unity game-mechanics animation c# in-app-purchase unity architecture audio opengl mathematics unity 3d c# udk unity terminology sdl unity c++ tiles android collision-detection libgdx deployment mathematics unity box2d unity collision-detection multiplayer art opengl algorithm sdl2 unity 3d unreal-4 animation 2d unity architecture android unity c++ unity unity opengl unreal java c++ unity multiplayer unity 3d 2d xna opengl sfml 3d java unity ogre unity c++ unity sdl unity unity graphics ios unity c++ c++ xna game-industry unity php libgdx opengl cocos2d-iphone collision-detection c++ unity physics-engine java unity unity java java android java android glfw shaders lua python physics c++ unity 2d unity unity xna game-maker unity unity xna shaders unity 2d unity javascript component-based unity algorithm copyright xna physics lighting xna game-loop game-design multiplayer 2d 3d linux c# unity mathematics mathematics file-format c# architecture c# unity java npc unity game-design opengl java flash unity unity ai opengl ios sprites mathematics c# java game-design unity rpg android c++ unity unity unity rendering c++ java opengl software-engineering unity unity java unity windows opengl unity unity iphone xna animation opengl mathematics game-design 3d xna java game-mechanics unity unity alpha-blending 3d mathematics rpg xna textures 3dsmax unity cocos2d-x unity browser-based-games architecture python xna iphone unity c# iphone turn-based c++ opengl javascript architecture graphics xna gui rendering fonts opengl c# textures java unity physics physics unity architecture physics-engine opengl mmo c++ unity unity opengl-es2 unity unity text unityscript c# directx algorithm android xna lua unity legal unity xna c++ unity optimization mathematics unity unity c++ xna opengl unreal-4 c# opengl animation box2d legal unity 3d c++ camera xna-4.0 objects unity android c++ unity unity textures mathematics unity opengl unity ios unity game-design textures unity glsl unity xna scoring physics iphone android java directx9 unity algorithm unity java opengl unity 3d-meshes terrain libgdx c++ xna path-finding c# 3d graphics game-design unity animation unity unity unity rpg unity java android entity-component libgdx unity java unity minecraft-modding unity networking 2d java android path-finding path-finding c++ unity mobile collision-detection 2d 2d entity-component-system lighting libgdx c++ opengl opengl models unity javascript tiles alpha-blending 3d unity xna opengl unity unity path-finding 2d c# unity collision-detection unity graphics file geometry c++ opengl shaders 2d c# unity xna opengl unity java web software-engineering unity hlsl opengl shaders unity c++ xna server c++ rendering physics vector unity scene unity planning unity unity unity assets vertex javascript unity c# opengl gui iphone unity glsl android opengl c++ assets c++ opengl java 2d opengl unreal-4 java xna 3d unity c++ scripting unity art maps unity game-design javascript ai android c++ c# opengl unity xna javascript physics c++ unity c++ opengl marketing unity mathematics legal unity opengl opengl opengl unity java xna 3d physics textures libgdx unity unity architecture path-finding algorithm unity mathematics opengl opengl c# vector opengl opengl sprites c++ physics game-design unity unity xna copyright opengl graphics unity physics java animation java c++ libgdx unity cocos2d-x libgdx rpg mathematics path-finding directx opengl node.js unity augmented-reality 2d game-maker unity unity opengl game-design opengl unity geometry matrix unity unity opengl lua collision-detection multiplayer java xna mvc udk animation java xna rotation unity unity 3d xna java unity unity unity directx unity xna 3d xna unity unity game-design xna c# unity flash lua collision-detection game-design unity opengl software-engineering opengl collision-detection libgdx ios assets monogame rendering android architecture directx11 opengl 2d unity xna libgdx procedural-generation game-design flash game-design unity algorithm opengl opengl game-mechanics textures xna c++ cocos2d-iphone physics logic c++ unity unity textures java xna algorithm opengl xna geometry game-design unity unity unity unity opengl android java algorithm unity opengl-es2 xna unity mathematics android xna unity game-design allegro unity procedural-generation unity memory unity unity c++ opengl game-design c# unity architecture normals opengl opengl 2d javascript game-design mathematics c# c# unity opengl mathematics c# java java normals c++ algorithm unity xna gui xna shaders game-design c++ c++ unity java hlsl c++ unity unity libgdx monogame c++ unity unity open-source unity textures opengl movement c# opengl unity unity minecraft-modding graphics android maya xna unity 3d directx unity iphone xna android java unity architecture unity unity 2d unity 2d unity c++ sprites unity game-design javascript unity opengl lighting mmo opengl shaders java c# c# godot shaders libgdx c# javascript c++ c++ unity opengl-es physics 2d camera game-design android graphics xna mathematics unity unity unity opengl unity xna-4.0 unity c# marketing c++ ios component-based unity 2d unity directx xna xna networking sprites modding unity movement c++ libgdx unity collision-detection unity procedural-generation raycasting c++ java c++ directx unity networking unity xna unity architecture mathematics opengl c++ opengl unity opengl 3d collision-detection opengl xna c++ javascript udk unity opengl 3d opengl architecture lighting ai android architecture unity unity rotation algorithm google-play direct3d12 c++ c# godot xna javascript unity unity phaser directx unity java shadow-mapping unity xna textures data-structure unreal-4 opengl legal c++ architecture unity unity c# unity fonts physics-engine unity xna procedural-generation android graphics-programming unity c# javascript unity unity opengl networking libgdx unity opengl c# unity unity collision-detection unity unity c# legal c++ unity libgdx architecture unity mathematics unity xna websocket php opengl-es unity rotation mathematics unity facebook unity opengl c++ unity unity libgdx c++ game-mechanics directx11 graphics physics tiles opengl unity path-finding unreal-4 game-mechanics opengl xna android 3d-meshes c# xna libgdx unity phaser unity graphics unity opengl unity flash 2d unity unity algorithm sdl2 unity ai ios opengl-es linux collision-detection unity 3d marketing software-engineering unity 3d java unity opengl geometry unity 2d opengl unity directx mathematics level-design webgl windows java shaders javascript unity c++ lwjgl iphone unity xna unity html5 lwjgl opengl unity unity opengl movement xna unity ui-design animation architecture unity java unity opengl-es2 animation unity multiplayer flash unity java html5 2d unity xna 2d libgdx unreal-4 architecture graphics opengl opengl c# 2d c++ multiplayer textures unity c# java shaders xna unity lighting opengl blender c# unity c# legal unity unity java 2d 2d cocos2d-iphone c# xna assets skybox textures mathematics monogame unity special-effects unity unity c# unity unity xna opengl unity 2d textures unity monogame iphone keyboard c++ unity unity xna java graphics methodology rendering c# c++ opengl c++ 2d opengl c++ physics java c# unity unity performance unity unity java opengl unity unity objective-c unity xna-4.0 java c++ game-maker unity unity xna c++ unity xna performance physics matrix projectile-physics unity unity c++ savegame graphics-design multiplayer opengl architecture rts licensing xna game-loop unity libgdx unity collision-detection unity unity c++ networking unity unity xna unity minecraft-modding mathematics unity webgl unity unity unity performance 2d 2d javascript java android c++ physics opengl libgdx unity rotation c# opengl javascript libgdx algorithm opengl-es2 c++ unity ai opengl c# c++ mathematics opengl movement c++ path-finding directx mathematics game-design game-design unity xna multiplayer unity c++ c# xna graphics shaders java unity java javascript sprites xna unity unity entity-system opengl c++ 2d game-design game-design architecture unity animation unity raycasting 3d maps unity c# opengl unity java unity unity 2d unity game-design unity collision-detection java macos c++ 3d multiplayer 3d game-maker opengl unity procedural-generation 2d unity 2d unity c# c++ camera google-play-services java 3d physics xna game-design c# unity android xna unity unity unity unity spritekit tiles xna 2d multiplayer c++ unity 3d unity java opengl 2d rotation opengl shaders c++ unity java game-design unity steam economy unity opengl 3d timer procedural-generation unity java 2d game-design unity spritekit hlsl opengl-es opengl c# java opengl ios unity unity multiplayer xna unity unity game-design unity android 2d architecture javascript opengl unity libgdx mathematics c# pixel-art unity android unity opengl xna-4.0 unity unity sdl c# unity unity game-industry 2d c++ opengl c++ unity opengl unity unity java c++ unity java unity graphics iphone game-mechanics unity unity opengl algorithm unity crusader-kings-2-modding opengl-es2 unity opengl ios godot mathematics unity opengl 3d unity opengl java turn-based-strategy opengl unity xna algorithm android legal c# xna 2d unity unity c# xna unity unity mathematics mmo unity game-design unity opengl xna hlsl opengl java xna lumberyard-engine unity unity opengl godot actionscript-3 mathematics 3d opengl unity xna unity c# unity networking 2d libgdx c++ python copyright unity java 2d unity physics multithreading unity xna unity optimization unity animation c++ libgdx xna c# animation unreal-4 shaders opengl gamesalad xna java c++ xna matrix 2d 3d physics unity shaders unity xna 3d c++ shaders android xna opengl opengl animation unity libgdx unity c# unity browser-based-games unity c++ unity java android architecture skeletal-animation c++ c++ steam unity android unity java ai xna javascript unity andengine browser-based-games opengl scripting unity xna graphics minecraft-modding 3d unity opengl xna android flash skeletal-animation unity unity 2d xna tilemap 3d swift android unity unity architecture c# unity fragment-shader unity collision-detection opengl opengl hlsl unity opengl game-design unity unity godot unity c# isometric unity opengl unity unity xna c++ c# animation unity android game-mechanics algorithm projection vector 2d path-finding opengl box2d java opengl-es textures actionscript-3 game-industry unity opengl game-design collision-detection libgdx libgdx c++ models unity xna unity algorithm c# c# xna models c++ hlsl modding 2d opengl java python minecraft-modding unity c# unity music xna java unity publishing lighting c++ unity game-design unity opengl physics xna unity c++ shaders ios xna xna unity c++ opengl unity monogame unreal unity first-person-shooter unity javascript java windows combat opengl c++ architecture godot java networking collision-detection tiles networking directx11 2d javascript open-source unity c++ browser-based-games unity unity sdl2 opengl c++ xna-4.0 procedural-generation opengl path-finding 2d procedural-generation godot turn-based xna opengl unity xna unity animation pipeline path-finding card-game optimization algorithm unity c# unreal-4 procedural-generation career c# models unity mmo path-finding unity bukkit c++ unity unity sound-effects c++ unity 3d unity game-design unity game-design mathematics networking libgdx android android java performance unity directx javascript unity unity unity rpg unity physics xna 2d javascript architecture c# networking unity java java unity pygame movement java java c# c# 3d android 3dsmax c++ data 3d java assets opengl java jobs unity glsl libgdx collision-detection ios unity textures xna unity fund-raising unity unity animation c# sprites 2d xna xna shaders server objective-c unity xna unity unity unity unity 2d unity unity java c++ ios game-loop architecture unity c++ opengl interpolation unity xna movement shaders c++ ai unity unity opengl c++ movement unity python c++ xna sdl2 opengl xna input directx c++ java algorithm opengl balance textures c# android opengl ios unity xna java c# c# c++ opengl javascript c# flash xna opengl c# opengl 2d unity unity 2d character c# xna xna xna opengl path-finding timer path collision-detection isometric c++ unity mathematics c++ physics unity shaders unity game-industry c++ c# c++ 3d models unity opengl unity networking unity libgdx unity matrix physics graphics unity board-game algorithm c++ unity game-design xna coordinates unity xna-4.0 iphone unity c# libgdx jobs 2d physics 2d phaser unreal-4 3d opengl c++ c++ opengl unity unity unity unity software-engineering opengl xna unity unity unity andengine unity rpg ai javascript ios rpg 2d animation shaders java c# unity ios c++ game-design unity c++ godot multiplayer opengl c++ unity unity graphics shaders software-engineering unity unity graphics c++ minecraft-modding procedural-generation gpu html-canvas xna unity opengl unity java xna opengl physics c# xna opengl rotation unity entity-system unity opengl c# unity input game-design collision-detection unity unity game-design opengl javascript 2d unity opengl unity java javascript procedural-generation rendering algorithm opengl c# c# java xna game-design javascript java unity c++ antialiasing sharpdx java opengl unity path-finding c# cocos2d-iphone algorithm architecture modding c# c++ libgdx legal sprites unity sprites udk algorithm shaders architecture security mathematics collision-detection xna transformation unity flash directx unity collision-detection game-design unity unity opengl architecture c++ opengl 2d mathematics unity unity java unity xna c++ libgdx c# unity unity opengl c++ unity textures opengl java c collision-detection animation c++ libgdx opengl c# game-design unity opengl sdl2 tiles books open-source android unity sprites unity unity unity networking javascript game-design directx mmo javascript shaders xna unity effect rotation unity c# collision-detection 2d unity game-maker unity java c++ xna xna monogame android java unity unity unity xna-4.0 mathematics c++ unity opengl unity javascript xna directx javascript c++ game-mechanics c# ios filesystem xna javascript mud game-design unity skeletal-animation opengl c++ mathematics xna directx11 opengl performance renpy unity 3d c++ animation unity marketing opengl c# unity 3d-meshes 3d algorithm java box2d javascript html5 opengl opengl c# rigidbody opengl flash animation unity unity unity unity android xna-4.0 unity unity html5 directx google-play-services libgdx graphics-programming algorithm unity mathematics javascript multiplayer unity 2d 2d marketing 2d opengl legal software-engineering input c++ c# java unity unity xna terminology java game-maker c# c++ android collision-detection android physics path-finding xna 3d c++ sprites optimization 2d performance licensing vulkan legal c++ xna unity unity unity unity xna unity screen 3d c++ c++ trademark android unity iphone 3d animation unity 2d textures collision-detection sprites opengl unity physics bullet-physics unity android books xna mathematics unity collision-detection sprites unity opengl android java physics opengl opengl physics xna udk opengl unity mathematics directx11 unity c++ game-mechanics game-design libgdx java unity unity unity graphics c++ game-design c++ unity unity libgdx java php unity android unity sprites unity unity legal architecture 2d 3d unity 3d architecture c++ directx9 libgdx ai unity unity java opengl opengl 3d opengl textures 2d c++ unity unity rotation opengl xna c++ c# iphone c++ unity opengl 3d shaders physics c++ python architecture unity pygame unreal-4 opengl unity unity random unity opengl android opengl unity unity linear-algebra c++ java xna unity css xna opengl xna c# unity c# double-buffering 2d unity c++ shaders xna iphone unity iphone component-based game-mechanics c++ java game-maker collision-detection 2d unity rotation game-mechanics unity ai unity unity unity libgdx directx directx11 tools opengl libgdx opengl gui unity xna scene directx box2d unity hexagonal-grid unity c# architecture 3d 2d game-loop unity c++ javascript flash opengl java networking education unity opengl xna sprites movement opengl android unity project-management unity java rpg android video collision-detection content-rating game-maker c# tilemap opengl java unity unity unity c++ nintendo opengl graphics unity c++ unreal-4 c++ color c++ iphone unity shaders coordinates unity android java collision-detection textures algorithm java unity game-design textures unity game-design java c++ opengl java ios normal-mapping collision-detection libgdx opengl xna opengl unity unity opengl directx11 unity unity unity mathematics javascript unity directx xna c++ libgdx unreal unity unity shaders c++ c++ opengl box2d unity c# unity xna isometric game-design xna playtesting java 2d android android directx shaders unity java directx unity game-design game-design java textures libgdx java unity javascript java game-design opengl collision-detection unity c# c++ raytracing libgdx unity unity java javascript actionscript-3 unity unity grid c# javascript java geometry html-canvas c++ xna 3d mathematics mathematics opengl unity unity rendering unity opengl unity unity 3d unity mathematics unity unity camera opengl opengl graphics-programming sdl2 unity opengl libgdx textures unity shaders game-design physics unity libgdx unity libgdx game-loop c++ 2d collision-detection platform procedural-generation c# unity c++ opengl xna java architecture xna java c# architecture physics game-design libgdx unity game-design unity unity flash opengl xna audio path-finding 3d unity opengl 3d opengl 3d unity databases phaser webgl c# 2d textures input 3d c# java unity textures c++ unity phaser textures xna-4.0 iphone java opengl directx 2d unity opengl java collision-detection c++ c# unity opengl java xna c++ unity unity libgdx c++ collision-resolution game-design opengl 3d java unity entity-system udk c++ c++ xna java tools opengl unity java unity opengl libgdx libgdx android architecture c# unity unity unity 2d data-structure xna java architecture hlsl unity libgdx opengl xna opengl unity unreal-4 maps c# java unity 3d unity c# unity c# unity unity c# udk xna c# iphone textures android xna opengl color c# cocos2d-x-js opengl levels game-design unity-networking web game-design unreal-4 2d coordinates objects xna unity roguelikes c# unity mathematics opengl shaders unity steam libgdx unity cocos2d-iphone unity opengl java c++ unity unity unity xna-4.0 libgdx textures java unity unity procedural-generation 2d java game-design c++ camera algorithm unity unity game-loop physics unity-webgl unity opengl software-engineering tiles unity xna opengl android game-design libgdx actionscript-3 game-mechanics xna unity unity unity architecture opengl python shaders collision-detection c++ ai unity unity textures java networking unity game-design opengl unity ios unity unity game-maker 3d opengl unity xna xna unity unity algorithm ai c++ procedural-generation physics opengl unity windows-phone-7 java opengl path-finding c++ physics xna normal-generation algorithm libgdx path-finding javascript game-maker opengl unity textures android unity unity unity roblox collision-detection input unity c# unity xna c++ xna opengl 3d-meshes opengl unity algorithm c++ android 2d corona-sdk javascript java 2d unity 2d java modding android mathematics unity 3d rotation opengl java unity box2d opengl directx c++ software-engineering c++ android entity-system xna opengl android marketing java xna-4.0 unity opengl c++ java collision-detection efficiency libgdx algorithm minecraft-modding c++ unity iphone c++ opengl-es2 c++ directx11 c++ open-source unity c# opengl unity 3d c++ input xna unity opengl android game-design opengl java opengl unity java game-design 3d actionscript-3 opengl terminology unity unity opengl unreal-4 scripting c++ path-finding c++ 2d flash unity c++ c++ unity 2d unity unity c# shadow-mapping opengl unity c# antialiasing multiplayer c# xcode unity unity c++ android java opengl software-engineering c# unity xna unity unity c++ opengl c# unity c# unity unity c++ career c# input unity unity xna terrain java mathematics java c++ glsl c# unity 3d mathematics opengl unity c# models physics unity unity opengl terminology game-maker xna unreal game-mechanics architecture mmo unity libgdx unity unity level-design 3dsmax flash game-design unity c# unity xna opengl collision-detection architecture unity architecture vector c++ 2d opengl c# collision-detection collision-detection c++ animation c++ libgdx licensing android unity unity c++ c# unity directx11 c# unity 2d fsm unity unity unity android unity unity unity opengl unity c# game-mechanics java libgdx godot game-design performance audio unity c++ unity ai monogame movement assets multiplayer java 3d architecture multiplayer unity unity unity unity unity c# opengl unity unity unity c++ libgdx architecture mathematics opengl c# opengl unity game-design unity procedural-generation actionscript-3 unity algorithm 3d unity graphics matrix libgdx software-engineering opengl android graphics server opengl c# rendering libgdx opengl physics-engine python xna c# c# c++ java java unity 2d version-control xna c# 3d opengl unity opengl tools camera unity android unity unity unity opengl game-design c# skybox unity unity 2d server java rotation c++ opengl python terminology game-maker opengl unity java modding unity animation 2d maps unity 2d 3d business c++ sdl terrain unity unity unity vector game-design software-engineering unity unity box2d unity debugging c++ unity entity-system unity textures xna 3d-meshes game-design maps unity c# multithreading unity unity testing unity xna unity legal unity html collision-detection unity unity opengl phaser c# behavior-tree godot opengl minecraft-modding collision-detection mathematics c++ unity unity unity unity rotation angelscript 2d c++ c++ c++ java unity 2d unity xna-4.0 unity unity unity java javascript software-engineering javascript monetization textures opengl android unity java godot c++ xna collision-detection uv-mapping xna java c# game-design opengl tilemap opengl unity architecture lighting game-design unity java java xna c++ unity opengl c++ unity browser-based-games opengl browser-based-games physics c# java libgdx sdl camera collision-detection opengl game-design opengl 3d unity game-design sprites unity collision-detection unity hlsl libgdx physics component-based unity game-design unity collision-detection spritesheet unityscript c++ fragment-shader unity unity opengl steam android rendering unity mmo unity animation unity c unity game-design c# opengl physics directx 2d game-industry multiplayer xna c++ ai opengl physics architecture libgdx opengl java android java 3d c++ xna unity c++ publishing c++ unity java unity xna xna entity-component procedural-generation java 2d libgdx textures opengl java architecture c++ libgdx movement iphone unity 2d unity hammer c# textures terrain opengl unity unity multiplayer unity opengl mathematics computational-geometry minecraft-modding ai level-design java directx11 water unity opengl mobile cocos2d-iphone unity opengl multithreading game-design unreal-4 opengl opengl physics architecture c++ motivation windows unity glsl 2d rendering unity unity shaders c++ frame-rate glsl game-design unity collision-detection collision-detection opengl java javascript java algorithm c# java textures unity unity python unity xna java 3d opengl xna 3d udk java unity licensing ios libgdx animation unity unity c++ rpg-maker collision-detection projection graphics java animation sharpdx unity java game-design xna unity opengl entity-system unreal-4 game-loop unity unity c++ unity roblox c# shaders c# xna unity c++ unity c++ unity c++ c# unity textures unity xna c++ unity random xna 2d java multiplayer game-design java c# android ai c# libgdx java unity smartfox opengl text java 2d 3d unity virtual-reality c# 3d trademark unity unity android unity 3d unity xna deferred-rendering mathematics 2d unity javascript grid collision-detection animation unity textures opengl algorithm android 2d game-design opengl flixel mathematics unreal-4 physics unity websocket c# java browser-based-games android unity multiplayer unity java libgdx collision-detection opengl procedural-generation javascript unreal-4 unity opengl collision-detection java game-design collision-detection marketing unity game-design opengl unity unity profiling game-maker 2d unity opengl unity libgdx fbx education performance unity 3d opengl game-design architecture c# unity unity libgdx android unity opengl opengl java networking c++ cocos2d-iphone timer textures cocos2d-iphone java software-engineering unity mathematics unity c# collision-detection unity c++ opengl c# unity unity tiles box2d xna-4.0 physics cocos2d-x unity random unity opengl java xna unity copyright actionscript-3 flash tools javascript unity libgdx unity opengl unity javascript unity mathematics c++ godot opengl sdl2 c++ xna projectile-physics ios unity unity unity opengl java unity cocos2d physics xna ios physics-engine unity hlsl animation libgdx opengl opengl flash xna animation c# xna graphics-programming flash html5 unity mathematics curves c# sprites java unity opengl ai android unity xna android unity xna unity c# c++ unity networking c++ android c# android c# animation unity unity animation opengl xna unity java opengl unity collision-detection xna unity pixel-art libgdx unity mmo unity c++ ai libgdx javascript opengl libgdx unity directx javascript unity unity distribution unity models unity unity xna collision-detection opengl-es opengl xna-4.0 unity unity unity beta unity 3d unity unity unreal-4 c++ rotation xna selection c# c++ java xna xna unity linear-algebra java models mathematics xna algorithm game-design textures mathematics xna unity unity physics opengl unity opengl ios opengl unity networking opengl animation architecture unity opengl windows 2d c++ game-mechanics android libgdx unity opengl c++ opengl unity opengl game-design libgdx mathematics godot unity opengl simulations java java c# unity unity javascript textures shaders collision-resolution mathematics networking unity image opengl animation unity 3d c# c# multiplayer unity 2d game-loop unity algorithm opengl xna java shaders mmo unity unity mathematics unity camera c# unity camera unity game-industry android unity unity skeletal-animation 3d unity opengl opengl animation java unity-networking java c# libgdx c++ java c++ physics architecture